Skip to content

Remove OpaqueListContents#154399

Open
nnethercote wants to merge 3 commits intorust-lang:mainfrom
nnethercote:rm-OpaqueListContents
Open

Remove OpaqueListContents#154399
nnethercote wants to merge 3 commits intorust-lang:mainfrom
nnethercote:rm-OpaqueListContents

Conversation

@nnethercote
Copy link
Contributor

ty::List has an OpaqueListContents field that supposedly prevents &List from being a fat pointer but (a) it doesn't actually do that and (b) it causes other annoyances and complications. This PR removes it. Details in individual commits.

r? @cuviper

These will be augmented in the next commit.
`RawList::opaque` has type `OpaqueListContents`, which is commented
thusly:

> A dummy type used to force `List` to be unsized while not requiring
> references to it be wide pointers.

The first part is true: it does make `List` unsized. This is a little
annoying at times, requiring special handling.

The second part is false: `&List<T>` is a narrow pointer whether the
`opaque` field is present or not.

This commit removes `RawList::opaque` and `OpaqueListContents`.
Consequences:
- `List`/`RawList` are now sized and we can add size assertions.
- The `Erasable` impls for `&List`/`&ListWithCachedTypeInfo` are no longer
  necessary, because the impl for `&T` now covers them.
- The unsafe `DynSync` and `Aligned` impls can be removed.
- A couple of features are no longer needed by `rustc_middle`.
They now have identical layout, so we don't need both.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 26, 2026
@nnethercote
Copy link
Contributor Author

I don't expect this to have perf effects but it's a widely-used type so let's check.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 26, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 26, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 26, 2026

☀️ Try build successful (CI)
Build commit: 7c5a6c1 (7c5a6c16c4a5d19afc9defe792d5c40dc6c3a35b, parent: 1174f784096deb8e4ba93f7e4b5ccb7bb4ba2c55)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7c5a6c1): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.2%, -0.1%] 5
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.0%] 13
All ❌✅ (primary) -0.2% [-0.2%, -0.1%] 5

Max RSS (memory usage)

Results (secondary -4.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.3% [-4.3%, -4.3%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 483.566s -> 485.77s (0.46%)
Artifact size: 395.05 MiB -> 395.16 MiB (0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants