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
10 changes: 7 additions & 3 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,13 @@ pub trait Emitter {
.chain(span.span_labels().iter().map(|sp_label| sp_label.span))
.filter_map(|sp| {
if !sp.is_dummy() && source_map.is_imported(sp) {
let maybe_callsite = sp.source_callsite();
if sp != maybe_callsite {
return Some((sp, maybe_callsite));
let mut span = sp;
while let Some(callsite) = span.parent_callsite() {
span = callsite;
if source_map.is_imported(span) {
continue;
}
return Some((sp, span));
}
}
None
Expand Down
12 changes: 9 additions & 3 deletions tests/ui/binop/binary-op-suggest-deref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,19 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str());
help: the following other types implement trait `BitAnd<Rhs>`
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
= note: `&i32` implements `BitAnd<i32>`
= note: `i32` implements `BitAnd`
::: $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
= note: `&i32` implements `BitAnd`
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&i32` implements `BitAnd<i32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i32` implements `BitAnd<&i32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i32` implements `BitAnd`
= note: `&i32` implements `BitAnd`
= note: this error originates in the macro `bitand_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `str` cannot be known at compilation time
Expand Down
12 changes: 9 additions & 3 deletions tests/ui/binop/binop-mul-i32-f32.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ LL | x * y
help: the following other types implement trait `Mul<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&i32` implements `Mul<i32>`
= note: `i32` implements `Mul`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&i32` implements `Mul`
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&i32` implements `Mul<i32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i32` implements `Mul<&i32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i32` implements `Mul`
= note: `&i32` implements `Mul`
= note: this error originates in the macro `mul_impl` (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 @@ -84,6 +84,9 @@ LL | check(&mut () as *mut ());
|
help: the trait `ConstParamTy_` is implemented for `()`
--> $SRC_DIR/core/src/marker.rs:LL:COL
::: $SRC_DIR/core/src/marker.rs:LL:COL
|
= note: in this macro invocation
note: required by a bound in `check`
--> $DIR/const_param_ty_bad.rs:4:18
|
Expand All @@ -101,6 +104,9 @@ LL | check(&() as *const ());
|
help: the trait `ConstParamTy_` is implemented for `()`
--> $SRC_DIR/core/src/marker.rs:LL:COL
::: $SRC_DIR/core/src/marker.rs:LL:COL
|
= note: in this macro invocation
note: required by a bound in `check`
--> $DIR/const_param_ty_bad.rs:4:18
|
Expand Down
12 changes: 9 additions & 3 deletions tests/ui/consts/const-eval/const-eval-overflow-3b.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ LL | = [0; (i8::MAX + 1u8) as usize];
help: the following other types implement trait `Add<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&i8` implements `Add<i8>`
= note: `i8` implements `Add`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&i8` implements `Add`
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&i8` implements `Add<i8>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i8` implements `Add<&i8>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i8` implements `Add`
= note: `&i8` implements `Add`
= note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors
Expand Down
12 changes: 9 additions & 3 deletions tests/ui/consts/const-eval/const-eval-overflow-4b.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
help: the following other types implement trait `Add<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&i8` implements `Add<i8>`
= note: `i8` implements `Add`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&i8` implements `Add`
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&i8` implements `Add<i8>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i8` implements `Add<&i8>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i8` implements `Add`
= note: `&i8` implements `Add`
= note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0604]: only `u8` can be cast as `char`, not `i8`
Expand Down
7 changes: 5 additions & 2 deletions tests/ui/consts/const-eval/issue-85155.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ LL | let _ = 1 / ((IMM >= MIN && IMM <= MAX) as usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `post_monomorphization_error::ValidateConstImm::<2, 0, 1>::VALID` failed here

note: erroneous constant encountered
--> $DIR/auxiliary/post_monomorphization_error.rs:19:5
--> $DIR/auxiliary/post_monomorphization_error.rs:13:17
|
LL | let _ = $crate::ValidateConstImm::<$imm, 0, { (1 << 1) - 1 }>::VALID;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | static_assert_imm1!(IMM1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| ------------------------- in this macro invocation
|
= note: this note originates in the macro `static_assert_imm1` (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
12 changes: 12 additions & 0 deletions tests/ui/consts/const-eval/parse_ints.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); };
|
note: inside `core::num::<impl u64>::from_str_radix`
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
::: $SRC_DIR/core/src/num/mod.rs:LL:COL
|
= note: in this macro invocation
note: inside `core::num::<impl u64>::from_ascii_radix`
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
::: $SRC_DIR/core/src/num/mod.rs:LL:COL
|
= note: in this macro invocation
= note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: evaluation panicked: from_ascii_radix: radix must lie in the range `[2, 36]`
Expand All @@ -18,8 +24,14 @@ LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); };
|
note: inside `core::num::<impl u64>::from_str_radix`
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
::: $SRC_DIR/core/src/num/mod.rs:LL:COL
|
= note: in this macro invocation
note: inside `core::num::<impl u64>::from_ascii_radix`
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
::: $SRC_DIR/core/src/num/mod.rs:LL:COL
|
= note: in this macro invocation
= note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/consts/const-ptr-is-null.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ LL | assert!(!ptr.wrapping_sub(512).is_null());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `MAYBE_NULL` failed inside this call
|
note: inside `std::ptr::const_ptr::<impl *const i32>::is_null`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
= note: in this macro invocation
note: inside `std::ptr::const_ptr::<impl *const T>::is_null::compiletime`
--> $SRC_DIR/core/src/panic.rs:LL:COL
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
= note: in this macro invocation

error: aborting due to 1 previous error

Expand Down
4 changes: 4 additions & 0 deletions tests/ui/consts/const_transmute_type_id2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ LL | assert!(a == b);
| ^^^^^^ evaluation of `_` failed inside this call
|
note: inside `<TypeId as PartialEq>::eq`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
--> $SRC_DIR/core/src/any.rs:LL:COL
::: $SRC_DIR/core/src/any.rs:LL:COL
|
= note: in this macro invocation
note: inside `<TypeId as PartialEq>::eq::compiletime`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/consts/const_transmute_type_id3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ LL | assert!(a == b);
| ^^^^^^ evaluation of `_` failed inside this call
|
note: inside `<TypeId as PartialEq>::eq`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
--> $SRC_DIR/core/src/any.rs:LL:COL
::: $SRC_DIR/core/src/any.rs:LL:COL
|
= note: in this macro invocation
note: inside `<TypeId as PartialEq>::eq::compiletime`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/consts/const_transmute_type_id4.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ LL | assert!(a == b);
| ^^^^^^ evaluation of `_` failed inside this call
|
note: inside `<TypeId as PartialEq>::eq`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
--> $SRC_DIR/core/src/any.rs:LL:COL
::: $SRC_DIR/core/src/any.rs:LL:COL
|
= note: in this macro invocation
note: inside `<TypeId as PartialEq>::eq::compiletime`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/consts/const_transmute_type_id5.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ LL | assert!(b == b);
| ^^^^^^ evaluation of `_` failed inside this call
|
note: inside `<TypeId as PartialEq>::eq`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
--> $SRC_DIR/core/src/any.rs:LL:COL
::: $SRC_DIR/core/src/any.rs:LL:COL
|
= note: in this macro invocation
note: inside `<TypeId as PartialEq>::eq::compiletime`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/consts/const_transmute_type_id6.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ LL | id == id
| ^^^^^^^^ evaluation of `X` failed inside this call
|
note: inside `<TypeId as PartialEq>::eq`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
--> $SRC_DIR/core/src/any.rs:LL:COL
::: $SRC_DIR/core/src/any.rs:LL:COL
|
= note: in this macro invocation
note: inside `<TypeId as PartialEq>::eq::compiletime`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/consts/timeout.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
error: constant evaluation is taking a long time
--> $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
::: $SRC_DIR/core/src/num/mod.rs:LL:COL
|
= note: in this macro invocation
|
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
If your compilation actually takes a long time, you can safely allow the lint.
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/hygiene/cross-crate-name-hiding-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ error[E0422]: cannot find struct, variant or union type `MyStruct` in this scope
LL | let x = MyStruct {};
| ^^^^^^^^ not found in this scope
|
::: $DIR/auxiliary/use_by_macro.rs:15:1
::: $DIR/auxiliary/use_by_macro.rs:7:24
|
LL | x!(my_struct);
| ------------- you might have meant to refer to this struct
LL | pub struct MyStruct;
| -------- you might have meant to refer to this struct

error: aborting due to 1 previous error

Expand Down
12 changes: 9 additions & 3 deletions tests/ui/impl-trait/equality.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ LL | n + sum_to(n - 1)
help: the following other types implement trait `Add<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&u32` implements `Add<u32>`
= note: `u32` implements `Add`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `&u32` implements `Add`
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&u32` implements `Add<u32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `u32` implements `Add<&u32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `u32` implements `Add`
= note: `&u32` implements `Add`
= note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors; 1 warning emitted
Expand Down
14 changes: 10 additions & 4 deletions tests/ui/infinite/issue-41731-infinite-macro-print.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
error: recursion limit reached while expanding `$crate::format_args!`
--> $DIR/issue-41731-infinite-macro-print.rs:14:5
--> $DIR/issue-41731-infinite-macro-print.rs:8:13
|
LL | print!(stack!($overflow))
| ^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | stack!("overflow");
| ^^^^^^^^^^^^^^^^^^
| ------------------ in this macro invocation
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "10"]` attribute to your crate (`issue_41731_infinite_macro_print`)
= note: this error originates in the macro `print` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand All @@ -23,10 +26,13 @@ LL | stack!("overflow");
= note: to `{ $crate :: io :: _print($crate :: format_args! (stack! ("overflow"))); }`

error: format argument must be a string literal
--> $DIR/issue-41731-infinite-macro-print.rs:14:5
--> $DIR/issue-41731-infinite-macro-print.rs:8:13
|
LL | print!(stack!($overflow))
| ^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | stack!("overflow");
| ^^^^^^^^^^^^^^^^^^
| ------------------ in this macro invocation
|
= note: this error originates in the macro `print` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you might be missing a string literal to format with
Expand Down
14 changes: 10 additions & 4 deletions tests/ui/infinite/issue-41731-infinite-macro-println.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
error: recursion limit reached while expanding `$crate::format_args_nl!`
--> $DIR/issue-41731-infinite-macro-println.rs:14:5
--> $DIR/issue-41731-infinite-macro-println.rs:8:13
|
LL | println!(stack!($overflow))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | stack!("overflow");
| ^^^^^^^^^^^^^^^^^^
| ------------------ in this macro invocation
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "10"]` attribute to your crate (`issue_41731_infinite_macro_println`)
= note: this error originates in the macro `println` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand All @@ -23,10 +26,13 @@ LL | stack!("overflow");
= note: to `{ $crate :: io :: _print($crate :: format_args_nl! (stack! ("overflow"))); }`

error: format argument must be a string literal
--> $DIR/issue-41731-infinite-macro-println.rs:14:5
--> $DIR/issue-41731-infinite-macro-println.rs:8:13
|
LL | println!(stack!($overflow))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | stack!("overflow");
| ^^^^^^^^^^^^^^^^^^
| ------------------ in this macro invocation
|
= note: this error originates in the macro `println` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you might be missing a string literal to format with
Expand Down
Loading
Loading