-
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
Let #[allow(unstable_name_collisions)]
work for things other than function
#81922
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
Hmm, according to the CI, my fix doesn't work for macro invocations (so I made this PR drafted for now). But perhaps is it expected behavior? In fact, take the following as an example: macro_rules! foo {
($i:ident) => {
let $i = 42;
};
}
fn main() {
#[allow(unused_variables)]
foo!(a);
}
However, if the attribute is appended to macro_rules! foo {
($i:ident) => {
let $i = 42;
};
}
#[allow(unused_variables)]
fn main() {
foo!(a);
} then it does suppress the lint! For now, I just deleted a test for macro invocation from |
f7aaacb
to
181e62b
Compare
@@ -1511,6 +1519,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { | |||
self.orig_steps_var_values.clone(), | |||
steps, | |||
IsSuggestion(true), | |||
scope_expr_id, |
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.
Can this be self.scope_expr_id
?
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's correct! Fixed it.
@bors r+ |
📌 Commit 06b3636 has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#81922 (Let `#[allow(unstable_name_collisions)]` work for things other than function) - rust-lang#82483 (Use FromStr trait for number option parsing) - rust-lang#82739 (Use the beta compiler for building bootstrap tools when `download-rustc` is set) - rust-lang#83650 (Update Source Serif to release 4.004) - rust-lang#83826 (List trait impls before deref methods in doc's sidebar) - rust-lang#83831 (Add `#[inline]` to IpAddr methods) - rust-lang#83863 (Render destructured struct function param names as underscore) - rust-lang#83865 (Don't report disambiguator error if link would have been ignored) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #81522
In addition to the report in #81522, currently
#[allow(unstable_name_collisions)]
doesn't suppress the corresponding diagnostics even if this attribute is appended to an expression statement or a let statement. It seems like this is because the wrongHirId
is passed tostruct_span_lint_hir
.It's fixed in this PR, and a regression test for it is also added.