Add regression test for unstable path suggestions - #161540
KevinA-cpu wants to merge 1 commit into
Conversation
|
rustbot has assigned @dingxiangfei2009. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| | | ||
| help: consider importing this function | ||
| | | ||
| LL + use std::intrinsics::assert_zero_valid; |
There was a problem hiding this comment.
Hmmm wel it seems like rust is suggesting an unstable path, so it is not fixed
There was a problem hiding this comment.
Hi @JonathanBrouwer , would it be acceptable to add a note for unstable features in nightly builds?
let note = if !is_stable {
this.tcx.lookup_stability(did).and_then(|stab| match stab.level {
StabilityLevel::Unstable { .. } => Some(format!(
"'{}' is unstable in nightly Rust and is only available with the `#![feature({})]` attribute",
path_names_to_string(&path),
stab.feature
)),
_ => None,
})
}or should this be addressed in a different item for nightly builds?
There was a problem hiding this comment.
From taking a look at the current code:
It seems that showing unstable suggestions on nightly is intentional, and I like this.
I think there are two things I'd like to change here:
- IMO We should never be suggesting intrinsics to be imported, unless the
core_intrinsicsfeature is already enabled. The current implementation still suggests them if there is nothing else to suggest, I don't see the point of this as nobody outside of the stdlib should be using these. This is implemented here
This was discussed previously here E0425: Don't recommend the use of intrinsics first #97618
cc @compiler-errors @oli-obk if you have opinions as people who were previously involved in this issue - As you mentioned, adding an extra note when a suggestion is unstable is a good idea to prevent people from adding the import and then immediately removing it again if they don't want to use features. Make sure to only add this note if the feature is not already enabled.
@KevinA-cpu Do you feel like implementing these two points? Preferably in separate PRs as they are mostly unrelated. Feel free to assign me as a reviewer
@rustbot author
There was a problem hiding this comment.
Hi @JonathanBrouwer , thank you for the suggestion. I'd love to try my hand at implementing those two points. As I am still new, let's hope it does not take 10 years 🤣
|
Reminder, once the PR becomes ready for a review, use |
closes #78130