-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Give all bytes of TypeId provenance #143736
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, r=me with comment nits resolved. :)
let offset = self.read_scalar(&elem)?.to_target_usize(&tcx)?; | ||
let ptr = Pointer::new(alloc_id.into(), Size::from_bytes(offset)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let offset = self.read_scalar(&elem)?.to_target_usize(&tcx)?; | |
let ptr = Pointer::new(alloc_id.into(), Size::from_bytes(offset)); | |
// Decorate this part of the hash with provenance; leave the integer part unchanged. | |
let hash_fragment = self.read_scalar(&elem)?.to_target_usize(&tcx)?; | |
let ptr = Pointer::new(alloc_id.into(), Size::from_bytes(hash_fragment)); |
let mut b = TypeId::of::<()>(); | ||
unsafe { | ||
let ptr = &mut b as *mut TypeId as *mut *const (); | ||
let val = std::ptr::read(ptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let val = std::ptr::read(ptr); | |
// Copy the ptr at index 0 to index 1. | |
let val = std::ptr::read(ptr); |
2f16de4
to
aa4675c
Compare
aa4675c
to
eef08a3
Compare
@bors r=RalfJung |
@bors rollup |
Rollup of 13 pull requests Successful merges: - #142301 (tests: Fix duplicated-path-in-error fail with musl) - #143630 (Drop `./x suggest`) - #143736 (Give all bytes of TypeId provenance) - #143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler) - #143837 (Adjust `run_make_support::symbols` helpers) - #143878 (Port `#[pointee]` to the new attribute parsing infrastructure) - #143905 (Recover and suggest to use `;` to construct array type) - #143907 (core: make `str::split_at_unchecked()` inline) - #143910 (Add experimental `backtrace-trace-only` std feature) - #143927 (Preserve constness in trait objects up to hir ty lowering) - #143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself) - #143938 (Update books) - #143941 (update `cfg_select!` documentation) Failed merges: - #143926 (Remove deprecated fields in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143736 - oli-obk:uninspectable-type-id, r=RalfJung Give all bytes of TypeId provenance This makes all bytes of TypeId uninspectable at compile-time. For context see #77125 (comment) r? ``@RalfJung``
This makes all bytes of TypeId uninspectable at compile-time.
For context see #77125 (comment)
r? @RalfJung