File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
compiler/rustc_middle/src Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,6 @@ pub fn struct_lint_level(
350350 ( Level :: Deny | Level :: Forbid , None ) => sess. diagnostic ( ) . struct_err_lint ( "" ) ,
351351 } ;
352352
353- err. set_primary_message ( msg) ;
354353 err. set_is_lint ( ) ;
355354
356355 // If this code originates in a foreign macro, aka something that this crate
@@ -375,6 +374,10 @@ pub fn struct_lint_level(
375374 }
376375 }
377376
377+ // Delay evaluating and setting the primary message until after we've
378+ // suppressed the lint due to macros.
379+ err. set_primary_message ( msg) ;
380+
378381 // Lint diagnostics that are covered by the expect level will not be emitted outside
379382 // the compiler. It is therefore not necessary to add any information for the user.
380383 // This will therefore directly call the decorate function which will in turn emit
Original file line number Diff line number Diff line change 1+ #[ macro_export]
2+ macro_rules! foo {
3+ ( ) => {
4+ let x: & Option <i32 > = & Some ( 1 ) ;
5+ let _y = x as * const Option <i32 >;
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ // aux-build:trivial-cast-ice.rs
2+ // check-pass
3+
4+ // Demonstrates the ICE in #102561
5+
6+ #![ deny( trivial_casts) ]
7+
8+ extern crate trivial_cast_ice;
9+
10+ fn main ( ) {
11+ trivial_cast_ice:: foo!( ) ;
12+ }
You can’t perform that action at this time.
0 commit comments