diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-27 08:57:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-27 08:57:45 +0100 |
| commit | b8d71fc41fe3476da0e4857294583eff271aa625 (patch) | |
| tree | 828ce89bb01bc4161b4dc0f581a5b5315ac44ad1 | |
| parent | e3961864075eaa9e855e5eec6b4f148029684539 (diff) | |
| parent | fb3e4b349a7b9e7bceb1f222551483550ee42ab7 (diff) | |
| download | rust-b8d71fc41fe3476da0e4857294583eff271aa625.tar.gz rust-b8d71fc41fe3476da0e4857294583eff271aa625.zip | |
Rollup merge of #105515 - estebank:issue-104141, r=oli-obk
Account for macros in const generics Fix #104141.
| -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 3b8df61a0ea..a7a5234049f 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -1142,6 +1142,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")}>(); +} |
