Skip to content

Commit 2054a0c

Browse files
committed
mbe: In error messages, don't assume attributes are always proc macros
Now that `macro_rules` macros can define attribute rules, make sure error messages account for that.
1 parent a980cd4 commit 2054a0c

File tree

12 files changed

+17
-17
lines changed

12 files changed

+17
-17
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ pub trait Emitter {
409409
if !redundant_span || always_backtrace {
410410
let msg: Cow<'static, _> = match trace.kind {
411411
ExpnKind::Macro(MacroKind::Attr, _) => {
412-
"this procedural macro expansion".into()
412+
"this attribute macro expansion".into()
413413
}
414414
ExpnKind::Macro(MacroKind::Derive, _) => {
415415
"this derive macro expansion".into()

src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: inside `_::__rg_oom`
1111
--> tests/fail/alloc/alloc_error_handler_custom.rs:LL:CC
1212
|
1313
LL | #[alloc_error_handler]
14-
| ---------------------- in this procedural macro expansion
14+
| ---------------------- in this attribute macro expansion
1515
LL | fn alloc_error_handler(layout: Layout) -> ! {
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1717
= note: inside `alloc::alloc::handle_alloc_error::rt_error` at RUSTLIB/alloc/src/alloc.rs:LL:CC

tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:1
33
|
44
LL | #[alloc_error_handler]
5-
| ---------------------- in this procedural macro expansion
5+
| ---------------------- in this attribute macro expansion
66
LL | // fn oom(
77
LL | || info: &Layout,
88
LL | || ) -> ()
@@ -23,7 +23,7 @@ error[E0308]: mismatched types
2323
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:1
2424
|
2525
LL | #[alloc_error_handler]
26-
| ---------------------- in this procedural macro expansion
26+
| ---------------------- in this attribute macro expansion
2727
LL | // fn oom(
2828
LL | || info: &Layout,
2929
LL | || ) -> ()

tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/alloc-error-handler-bad-signature-2.rs:10:1
33
|
44
LL | #[alloc_error_handler]
5-
| ---------------------- in this procedural macro expansion
5+
| ---------------------- in this attribute macro expansion
66
LL | // fn oom(
77
LL | || info: Layout,
88
LL | || ) {
@@ -31,7 +31,7 @@ error[E0308]: mismatched types
3131
--> $DIR/alloc-error-handler-bad-signature-2.rs:10:1
3232
|
3333
LL | #[alloc_error_handler]
34-
| ---------------------- in this procedural macro expansion
34+
| ---------------------- in this attribute macro expansion
3535
LL | // fn oom(
3636
LL | || info: Layout,
3737
LL | || ) {

tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
22
--> $DIR/alloc-error-handler-bad-signature-3.rs:10:1
33
|
44
LL | #[alloc_error_handler]
5-
| ---------------------- in this procedural macro expansion
5+
| ---------------------- in this attribute macro expansion
66
LL | fn oom() -> ! {
77
| _-^^^^^^^^^^^^
88
LL | | loop {}

tests/ui/allocator/not-an-allocator.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
22
--> $DIR/not-an-allocator.rs:2:11
33
|
44
LL | #[global_allocator]
5-
| ------------------- in this procedural macro expansion
5+
| ------------------- in this attribute macro expansion
66
LL | static A: usize = 0;
77
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
88
|
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
1212
--> $DIR/not-an-allocator.rs:2:11
1313
|
1414
LL | #[global_allocator]
15-
| ------------------- in this procedural macro expansion
15+
| ------------------- in this attribute macro expansion
1616
LL | static A: usize = 0;
1717
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
1818
|
@@ -23,7 +23,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
2323
--> $DIR/not-an-allocator.rs:2:11
2424
|
2525
LL | #[global_allocator]
26-
| ------------------- in this procedural macro expansion
26+
| ------------------- in this attribute macro expansion
2727
LL | static A: usize = 0;
2828
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
2929
|
@@ -34,7 +34,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
3434
--> $DIR/not-an-allocator.rs:2:11
3535
|
3636
LL | #[global_allocator]
37-
| ------------------- in this procedural macro expansion
37+
| ------------------- in this attribute macro expansion
3838
LL | static A: usize = 0;
3939
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
4040
|

tests/ui/allocator/two-allocators.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: cannot define multiple global allocators
44
LL | static A: System = System;
55
| -------------------------- previous global allocator defined here
66
LL | #[global_allocator]
7-
| ------------------- in this procedural macro expansion
7+
| ------------------- in this attribute macro expansion
88
LL | static B: System = System;
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
1010

tests/ui/custom_test_frameworks/mismatch.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `TestDescAndFn: Testable` is not satisfied
22
--> $DIR/mismatch.rs:9:1
33
|
44
LL | #[test]
5-
| ------- in this procedural macro expansion
5+
| ------- in this attribute macro expansion
66
LL | fn wrong_kind(){}
77
| ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn`
88
|

tests/ui/proc-macro/span-from-proc-macro.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | field: MissingType
1010
::: $DIR/span-from-proc-macro.rs:8:1
1111
|
1212
LL | #[error_from_attribute]
13-
| ----------------------- in this procedural macro expansion
13+
| ----------------------- in this attribute macro expansion
1414

1515
error[E0412]: cannot find type `OtherMissingType` in this scope
1616
--> $DIR/auxiliary/span-from-proc-macro.rs:42:21

tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `f32: Termination` is not satisfied
22
--> $DIR/termination-trait-test-wrong-type.rs:6:31
33
|
44
LL | #[test]
5-
| ------- in this procedural macro expansion
5+
| ------- in this attribute macro expansion
66
LL | fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> {
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Termination` is not implemented for `f32`
88
|

0 commit comments

Comments
 (0)