-
Notifications
You must be signed in to change notification settings - Fork 13k
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
warn against using intrinsics that leave the scope of our memory model #118128
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Can't we just remove them? At least for
|
@@ -341,6 +341,7 @@ extern "rust-intrinsic" { | |||
/// [`Ordering::Relaxed`] as the `order`. For example, [`AtomicBool::load`]. | |||
#[rustc_nounwind] | |||
pub fn atomic_load_relaxed<T: Copy>(src: *const T) -> T; | |||
/// Do NOT use this intrinsic; "unordered" operations do not exist in our memory model! |
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.
IIRC they were added for experimentation. Maybe the warning could be a bit more informative?
For whom is that warning anyway? std/compiler devs or for nightly users?
I.e. are you trying to convey that they shouldn't be exposed through stable std APIs or that nightly users are moving on thin ice when they experiment with this? Because the latter could be reasonable if they're doing that to experiment and demonstrate performance differences.
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.
I have clarified: in terms of the AM, I think the best that we can do is that these intrinsics act like regular non-atomic reads and writes.
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.
Hrrm, I still think the language is a bit too unspecific. Then again, people who are just doing experiments are free to ignore any such warning anyway, so whatever.
They are used by compiler_builtins. We'll need to take a close look at that eventually, but for now we can at least discourage further usage of them. |
ee04cb2
to
79ad512
Compare
@the8472 can you take the review of this one, since you already took a look? |
@bors r+ rollup |
☀️ Test successful - checks-actions |
Finished benchmarking commit (2f1ba4a): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 672.67s -> 671.206s (-0.22%) |
No description provided.