-
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
Display function path in unsafety violations - E0133 #96294
Display function path in unsafety violations - E0133 #96294
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
see (small) zulip discussion |
r? @oli-obk |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 434eb13 with merge 165df72f4556d54e1da1587e70ee8fe7448df49b... |
☀️ Try build successful - checks-actions |
Queued 165df72f4556d54e1da1587e70ee8fe7448df49b with parent 1158ade, future comparison URL. |
Finished benchmarking commit (165df72f4556d54e1da1587e70ee8fe7448df49b): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Footnotes |
The perf regression is just the usual syn noise |
"call to unsafe function", | ||
CallToUnsafeFunction(did) => ( | ||
if let Some(did) = did { | ||
Cow::from(format!("call to unsafe function `{}`", tcx.def_path_str(*did))) |
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'm not entirely sure I like this wording
This comment has been minimized.
This comment has been minimized.
You need to update some more |
2c3c140
to
5644d19
Compare
Done, I hope. https://rustc-dev-guide.rust-lang.org/tests/ui.html#cfg-revisions needs to be updated also. Was thinking about dropping the also, if to be merged, the title should probably be changed |
Ah interesting. The thir unsafety check is what we are moving to, so it may be that some day in the future you may lose all the information you're looking for. I'm not sure we even have a way of extracting the information you want from THIR. So for now, this will work, and we'll adjust the thir diagnostics to match, but I'm not sure how to give you what you need in the longer term. |
5644d19
to
aeab071
Compare
fixed the inconsistency between thir and mir, with the added benefit that thir will display a nicer path. |
//[mir]~^ ERROR call to unsafe function `std::thread::__FastLocalKeyInner::<T>::get` is unsafe | ||
//[thir]~^^ ERROR call to unsafe function `__FastLocalKeyInner::<T>::get` is unsafe |
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.
this is the difference between mir and thir now.
sidenote: I don't understand why def_path_str
decides to remove std::thread
here
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.
That usually happens when there are imports for these modules. Anyway, seems fine to me for now.
DefId
to UnsafetyViolationDetails
I don't know how to solve this but to remove stderr checking |
This comment has been minimized.
This comment has been minimized.
d0be897
to
f71597c
Compare
fixed with some normalization :D |
Ah perfect, you found it! @bors r+ |
📌 Commit f71597c has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (ec8619d): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Footnotes |
Oh oh, that perf change was unexpected. It's solely in incremental, rereading the source to find out what happened |
@Emilgardis do you still need the def ids in the result of |
@oli-obk @Emilgardis Do you expect to be able to address the perf regressions here? It seems they were introduced by a code that's not fundamental to this change since previous perf runs didn't report these regressions. If you're not able to get to it soon, can you please open an issue for this so that it doesn't get lost? Once you do that, we can mark this as triaged. |
Yes, I just need feedback to see if the easy solution can be done first, if not, i'll look into alternative routes. |
Go ahead, not needed |
…safety_checking, r=compiler-errors Fix incremental perf regression unsafety checking Perf regression introduced in rust-lang#96294 We will simply avoid emitting the name of the unsafe function in MIR unsafeck, since we're moving to THIR unsafeck anyway.
adds
DefId
toUnsafetyViolationDetails
this enables consumers to access the function definition that was reported to be unsafe and also changes the output for some E0133 diagnostics