File tree 3 files changed +38
-2
lines changed
compiler/rustc_expand/src
3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -774,8 +774,11 @@ impl SyntaxExtension {
774
774
sess. parse_sess
775
775
. span_diagnostic
776
776
. struct_span_err ( sp, "macros cannot have const stability attributes" )
777
- . span_label ( sp, "invalid stability attribute" )
778
- . span_label ( span, "in this macro" )
777
+ . span_label ( sp, "invalid const stability attribute" )
778
+ . span_label (
779
+ sess. source_map ( ) . guess_head_span ( span) ,
780
+ "const stability attribute affects this macro" ,
781
+ )
779
782
. emit ( ) ;
780
783
}
781
784
Original file line number Diff line number Diff line change
1
+ #[ rustc_const_stable( feature = "foo" , since = "0" ) ]
2
+ //~^ ERROR macros cannot have const stability attributes
3
+ macro_rules! foo {
4
+ ( ) => { } ;
5
+ }
6
+
7
+ #[ rustc_const_unstable( feature = "bar" , issue="none" ) ]
8
+ //~^ ERROR macros cannot have const stability attributes
9
+ macro_rules! bar {
10
+ ( ) => { } ;
11
+ }
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: macros cannot have const stability attributes
2
+ --> $DIR/const-stability-on-macro.rs:1:1
3
+ |
4
+ LL | #[rustc_const_stable(feature = "foo", since = "0")]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
6
+ LL |
7
+ LL | macro_rules! foo {
8
+ | ---------------- const stability attribute affects this macro
9
+
10
+ error: macros cannot have const stability attributes
11
+ --> $DIR/const-stability-on-macro.rs:7:1
12
+ |
13
+ LL | #[rustc_const_unstable(feature = "bar", issue="none")]
14
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
15
+ LL |
16
+ LL | macro_rules! bar {
17
+ | ---------------- const stability attribute affects this macro
18
+
19
+ error: aborting due to 2 previous errors
20
+
You can’t perform that action at this time.
0 commit comments