diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-10-04 06:14:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-04 06:14:11 +0200 |
| commit | 8a0fda2ec1b9f70b9cbcb52c2b72ee0fe7987b44 (patch) | |
| tree | 8d72e227d6e2da246feb4478648bf9f390d59785 /compiler/rustc_middle | |
| parent | f33343632e3dccb0b95a4e9c59ad4b83bc687aa8 (diff) | |
| parent | f088e543cb51afa12c05097c131969d7962eca36 (diff) | |
| download | rust-8a0fda2ec1b9f70b9cbcb52c2b72ee0fe7987b44.tar.gz rust-8a0fda2ec1b9f70b9cbcb52c2b72ee0fe7987b44.zip | |
Rollup merge of #102567 - compiler-errors:issue-102561, r=davidtwco
Delay evaluating lint primary message until after it would be suppressed Fixes #102561 Fixes #102572
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/lint.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 7b0054a96d3..b3b02f5b987 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -350,7 +350,6 @@ pub fn struct_lint_level( (Level::Deny | Level::Forbid, None) => sess.diagnostic().struct_err_lint(""), }; - err.set_primary_message(msg); err.set_is_lint(); // If this code originates in a foreign macro, aka something that this crate @@ -375,6 +374,10 @@ pub fn struct_lint_level( } } + // Delay evaluating and setting the primary message until after we've + // suppressed the lint due to macros. + err.set_primary_message(msg); + // Lint diagnostics that are covered by the expect level will not be emitted outside // the compiler. It is therefore not necessary to add any information for the user. // This will therefore directly call the decorate function which will in turn emit |
