Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ pub struct SyntaxExtension {
/// Should debuginfo for the macro be collapsed to the outermost expansion site (in other
/// words, was the macro definition annotated with `#[collapse_debuginfo]`)?
pub collapse_debuginfo: bool,
pub hide_backtrace: bool,
}

impl SyntaxExtension {
Expand Down Expand Up @@ -884,6 +885,7 @@ impl SyntaxExtension {
allow_internal_unsafe: false,
local_inner_macros: false,
collapse_debuginfo: false,
hide_backtrace: false,
}
}

Expand Down Expand Up @@ -939,6 +941,12 @@ impl SyntaxExtension {
collapse_table[flag as usize][attr as usize]
}

fn get_hide_backtrace(attrs: &[hir::Attribute]) -> bool {
// FIXME(estebank): instead of reusing `#[rustc_diagnostic_item]` as a proxy, introduce a
// new attribute purely for this under the `#[diagnostic]` namespace.
ast::attr::find_by_name(attrs, sym::rustc_diagnostic_item).is_some()
}

/// Constructs a syntax extension with the given properties
/// and other properties converted from attributes.
pub fn new(
Expand Down Expand Up @@ -975,6 +983,7 @@ impl SyntaxExtension {
// Not a built-in macro
None => (None, helper_attrs),
};
let hide_backtrace = builtin_name.is_some() || Self::get_hide_backtrace(attrs);

let stability = find_attr!(attrs, AttributeKind::Stability { stability, .. } => *stability);

Expand Down Expand Up @@ -1009,6 +1018,7 @@ impl SyntaxExtension {
allow_internal_unsafe,
local_inner_macros,
collapse_debuginfo,
hide_backtrace,
}
}

Expand Down Expand Up @@ -1088,7 +1098,7 @@ impl SyntaxExtension {
self.allow_internal_unsafe,
self.local_inner_macros,
self.collapse_debuginfo,
self.builtin_name.is_some(),
self.hide_backtrace,
)
}
}
Expand Down
18 changes: 0 additions & 18 deletions src/tools/clippy/tests/ui/recursive_format_impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,54 @@ error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
LL | write!(f, "{}", self)
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Display` in `impl Display` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:86:9
|
LL | write!(f, "{}", &self)
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Debug` in `impl Debug` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:93:9
|
LL | write!(f, "{:?}", &self)
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Display` in `impl Display` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:103:9
|
LL | write!(f, "{}", &&&self)
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Display` in `impl Display` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:178:9
|
LL | write!(f, "{}", &*self)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Debug` in `impl Debug` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:185:9
|
LL | write!(f, "{:?}", &*self)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Display` in `impl Display` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:202:9
|
LL | write!(f, "{}", *self)
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Display` in `impl Display` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:219:9
|
LL | write!(f, "{}", **&&*self)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using `self` as `Display` in `impl Display` will cause infinite recursion
--> tests/ui/recursive_format_impl.rs:236:9
|
LL | write!(f, "{}", &&**&&*self)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 10 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ help: ALLOC was deallocated here:
|
LL | };
| ^
= note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ help: ALLOC was allocated here:
|
LL | let v: Vec<u16> = vec![1, 2];
| ^^^^^^^^^^
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ help: ALLOC was allocated here:
|
LL | let v: Vec<u16> = vec![1, 2];
| ^^^^^^^^^^
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ help: ALLOC was allocated here:
|
LL | let mut v: Vec<u16> = vec![1, 2];
| ^^^^^^^^^^
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
2 changes: 0 additions & 2 deletions src/tools/miri/tests/fail/erroneous_const2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ note: erroneous constant encountered
|
LL | println!("{}", FOO);
| ^^^
|
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ LL | dbg!(x.0);
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)

Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
ALLOC (stack variable, size: 132, align: 4) {
Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/fail/intrinsics/simd-scatter.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ help: ALLOC was allocated here:
|
LL | let mut vec: Vec<i8> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/fail/provenance/mix-ptrs1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ LL | assert_eq!(*strange_ptr.with_addr(ptr.addr()), 0);
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/fail/provenance/mix-ptrs2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ LL | assert_eq!(*ptr, 42);
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/fail/rc_as_ptr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ help: ALLOC was deallocated here:
|
LL | drop(strong);
| ^^^^^^^^^^^^
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/fail/stacked_borrows/zst_slice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ help: <TAG> would have been created here, but this is a zero-size retag ([0x0..0
|
LL | assert_eq!(*s.as_ptr().add(1), 2);
| ^^^^^^^^^^
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ help: the accessed tag <TAG> later transitioned to Frozen due to a reborrow (act
LL | assert_eq!(root, 0); // Parent Read
| ^^^^^^^^^^^^^^^^^^^
= help: this transition corresponds to a loss of write permissions
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ help: the accessed tag <TAG> later transitioned to Disabled due to a protector r
LL | }
| ^
= help: this transition corresponds to a loss of read and write permissions
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
2 changes: 0 additions & 2 deletions src/tools/miri/tests/pass/alloc-access-tracking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ note: read access at ALLOC[0..1]
|
LL | assert_eq!(*ptr, 42);
| ^^^^^^^^^^^^^^^^^^^^ tracking was triggered here
|
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: freed allocation ALLOC
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
Expand Down
1 change: 0 additions & 1 deletion tests/ui/asm/aarch64/type-check-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ LL | asm!("{}", in(reg) vec![0]);
| ^^^^^^^
|
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot use value of type `(i32, i32, i32)` for inline assembly
--> $DIR/type-check-2.rs:36:28
Expand Down
8 changes: 0 additions & 8 deletions tests/ui/asm/parse-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,12 @@ error: asm template must be a string literal
|
LL | asm!(format!("{{{}}}", 0), in(reg) foo);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error: asm template must be a string literal
--> $DIR/parse-error.rs:86:21
|
LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error: _ cannot be used for input operands
--> $DIR/parse-error.rs:88:28
Expand Down Expand Up @@ -357,16 +353,12 @@ error: asm template must be a string literal
|
LL | global_asm!(format!("{{{}}}", 0), const FOO);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error: asm template must be a string literal
--> $DIR/parse-error.rs:143:20
|
LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error: the `in` operand cannot be used with `global_asm!`
--> $DIR/parse-error.rs:146:19
Expand Down
3 changes: 0 additions & 3 deletions tests/ui/associated-consts/defaults-not-assumed-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ note: erroneous constant encountered
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:34:5
Expand All @@ -33,7 +31,6 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error

Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/unreachable-lint-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ note: the lint level is defined here
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ LL | assert_eq!(a, 0);
| |
| fn() -> i32 {a}
| {integer}
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
--> $DIR/binary-operation-error-on-function-70724.rs:7:5
Expand All @@ -17,7 +15,6 @@ LL | assert_eq!(a, 0);
|
= note: expected fn item `fn() -> i32 {a}`
found type `{integer}`
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `fn() -> i32 {a}` doesn't implement `Debug`
--> $DIR/binary-operation-error-on-function-70724.rs:7:5
Expand All @@ -29,7 +26,6 @@ LL | assert_eq!(a, 0);
| ^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn() -> i32 {a}`
|
= help: use parentheses to call this function: `a()`
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

Expand Down
1 change: 0 additions & 1 deletion tests/ui/binop/eq-vec.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ note: an implementation of `PartialEq` might be missing for `Foo`
|
LL | enum Foo {
| ^^^^^^^^ must implement `PartialEq`
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `Foo` with `#[derive(PartialEq)]`
|
LL + #[derive(PartialEq)]
Expand Down
6 changes: 0 additions & 6 deletions tests/ui/binop/function-comparison-errors-59488.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,18 @@ LL | assert_eq!(Foo::Bar, i);
| |
| fn(usize) -> Foo {Foo::Bar}
| fn(usize) -> Foo {Foo::Bar}
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
--> $DIR/function-comparison-errors-59488.rs:31:5
|
LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
--> $DIR/function-comparison-errors-59488.rs:31:5
|
LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 10 previous errors

Expand Down
3 changes: 0 additions & 3 deletions tests/ui/binop/issue-77910-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ LL | assert_eq!(foo, y);
| |
| for<'a> fn(&'a i32) -> &'a i32 {foo}
| _
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `for<'a> fn(&'a i32) -> &'a i32 {foo}` doesn't implement `Debug`
--> $DIR/issue-77910-1.rs:8:5
Expand All @@ -19,7 +17,6 @@ LL | assert_eq!(foo, y);
| ^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `for<'a> fn(&'a i32) -> &'a i32 {foo}`
|
= help: use parentheses to call this function: `foo(/* &i32 */)`
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0381]: used binding `xs` isn't initialized
--> $DIR/issue-77910-1.rs:3:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ LL | test(&vec![])
| argument requires that borrow lasts for `'static`
LL | }
| - temporary value is freed at the end of this statement
|
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error

Expand Down
Loading
Loading