-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PointerLike
for isize
, NonNull
, Cell
, UnsafeCell
, and SyncUnsafeCell
.
#134642
Conversation
This comment has been minimized.
This comment has been minimized.
pls squash this into one commit, then i can approve -- 4 commits is definitely a bit excessive to touch a few of impls |
… and `SyncUnsafeCell`. Implementing `PointerLike` for `UnsafeCell` enables the possibility of interior mutable `dyn*` values. Since this means potentially exercising new codegen behavior, I added a test for it in `tests/ui/dyn-star/cell.rs`. Also updated UI tests to account for the `isize` implementation changing error messages.
b93553c
to
5c04151
Compare
Squashed. I was refraining from squashing/amending because I had been previously advised that PRs actively in review should not be force-pushed to avoid losing context for review comments; if it were up to my choice I would be doing a lot more rebasing and amending. |
No worries. This PR is like 6 files large; I have no trouble maintaining the state here. @bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#130289 (docs: Permissions.readonly() also ignores root user special permissions) - rust-lang#134583 (docs: `transmute<&mut T, &mut MaybeUninit<T>>` is unsound when exposed to safe code) - rust-lang#134611 (Align `{i686,x86_64}-win7-windows-msvc` to their parent targets) - rust-lang#134629 (compiletest: Allow using a specific debugger when running debuginfo tests) - rust-lang#134642 (Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`.) - rust-lang#134660 (Fix spacing of markdown code block fences in compiler rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#130289 (docs: Permissions.readonly() also ignores root user special permissions) - rust-lang#134583 (docs: `transmute<&mut T, &mut MaybeUninit<T>>` is unsound when exposed to safe code) - rust-lang#134611 (Align `{i686,x86_64}-win7-windows-msvc` to their parent targets) - rust-lang#134629 (compiletest: Allow using a specific debugger when running debuginfo tests) - rust-lang#134642 (Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`.) - rust-lang#134660 (Fix spacing of markdown code block fences in compiler rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134642 - kpreid:pointerlike-cell, r=compiler-errors Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`. * Implementing `PointerLike` for `UnsafeCell` enables the possibility of interior mutable `dyn*` values. Since this means potentially exercising new codegen behavior, I added a test for it in `tests/ui/dyn-star/cell.rs`. Please let me know if there are further sorts of tests that should be written, or other care that should be taken with this change. It is unfortunately not possible without compiler changes to implement `PointerLike` for `Atomic*` types, since they are not `repr(transparent)` (and, in theory if not in practice, `AtomicUsize`'s alignment may be greater than that of an ordinary pointer or `usize`). * Implementing `PointerLike` for `NonNull` is useful for pointer types which wrap `NonNull`. * Implementing `PointerLike` for `isize` is just for completeness; I have no use cases in mind, but I cannot think of any reason not to do this. * Tracking issue: rust-lang#102425 `@rustbot` label +F-dyn_star (there is no label or tracking issue for F-pointer_like_trait)
Implementing
PointerLike
forUnsafeCell
enables the possibility of interior mutabledyn*
values. Since this means potentially exercising new codegen behavior, I added a test for it intests/ui/dyn-star/cell.rs
. Please let me know if there are further sorts of tests that should be written, or other care that should be taken with this change.It is unfortunately not possible without compiler changes to implement
PointerLike
forAtomic*
types, since they are notrepr(transparent)
(and, in theory if not in practice,AtomicUsize
's alignment may be greater than that of an ordinary pointer orusize
).Implementing
PointerLike
forNonNull
is useful for pointer types which wrapNonNull
.Implementing
PointerLike
forisize
is just for completeness; I have no use cases in mind, but I cannot think of any reason not to do this.Tracking issue: Tracking issue for dyn-star #102425
@rustbot label +F-dyn_star
(there is no label or tracking issue for F-pointer_like_trait)