diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2022-12-09 15:21:12 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2022-12-09 15:21:12 -0800 |
| commit | fb3e4b349a7b9e7bceb1f222551483550ee42ab7 (patch) | |
| tree | 239e2853406de141b996f3d250e03fd85445bb90 | |
| parent | e10201c9bb8e225095d76e6650dcfe8dadc50327 (diff) | |
Account for macros in const generics
| -rw-r--r-- | compiler/rustc_lint/src/unused.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/lint/unused_braces_macro.rs | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index b5db94f8c06..4699f7487e6 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -1138,6 +1138,7 @@ impl UnusedDelimLint for UnusedBraces { && !cx.sess().source_map().is_multiline(value.span) && value.attrs.is_empty() && !value.span.from_expansion() + && !inner.span.from_expansion() { self.emit_unused_delims_expr(cx, value, ctx, left_pos, right_pos) } diff --git a/src/test/ui/lint/unused_braces_macro.rs b/src/test/ui/lint/unused_braces_macro.rs new file mode 100644 index 00000000000..bfee95378bf --- /dev/null +++ b/src/test/ui/lint/unused_braces_macro.rs @@ -0,0 +1,6 @@ +// build-pass +pub fn foo<const BAR: bool> () {} + +fn main() { + foo::<{cfg!(feature = "foo")}>(); +} |
