Store idents for DefPathData into crate metadata
Previously, we threw away the `Span` associated with a definition's identifier when we encoded crate metadata, causing us to lose location and hygiene information. We now store the identifier's `Span` in the crate metadata. When we decode items from the metadata, we combine the name and span back into an `Ident`. This improves the output of several tests, which previously had messages suppressed due to dummy spans. This is a prerequisite for #68686, since throwing away a `Span` means that we lose hygiene information.
This commit is contained in:
parent
e4b01c7791
commit
96e2d03d4b
28 changed files with 224 additions and 39 deletions
|
|
@ -6,6 +6,14 @@ LL | struct Foo {
|
|||
...
|
||||
LL | let _y = x.clone();
|
||||
| ^^^^^ method not found in `Foo`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<Foo>` here
|
||||
| the method is available for `std::rc::Rc<Foo>` here
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@ LL | struct NotClone;
|
|||
...
|
||||
LL | Bar::<NotClone> { x: 1 }.clone();
|
||||
| ^^^^^ method not found in `Bar<NotClone>`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<Bar<NotClone>>` here
|
||||
| the method is available for `std::rc::Rc<Bar<NotClone>>` here
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`NotClone: std::clone::Clone`
|
||||
|
|
|
|||
|
|
@ -3,6 +3,14 @@ error[E0004]: non-exhaustive patterns: `None` and `Some(_)` not covered
|
|||
|
|
||||
LL | match x { }
|
||||
| ^ patterns `None` and `Some(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/option.rs:LL:COL
|
||||
|
|
||||
LL | None,
|
||||
| ---- not covered
|
||||
...
|
||||
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| ---- not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ error[E0005]: refutable pattern in local binding: `None` not covered
|
|||
|
|
||||
LL | let Some(y) = x;
|
||||
| ^^^^^^^ pattern `None` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/option.rs:LL:COL
|
||||
|
|
||||
LL | None,
|
||||
| ---- not covered
|
||||
|
|
||||
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ error[E0005]: refutable pattern in `for` loop binding: `None` not covered
|
|||
|
|
||||
LL | for Some(x) in xs {}
|
||||
| ^^^^^^^ pattern `None` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/option.rs:LL:COL
|
||||
|
|
||||
LL | None,
|
||||
| ---- not covered
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
|||
|
|
||||
LL | let Ok(_x) = foo();
|
||||
| ^^^^^^ pattern `Err(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/result.rs:LL:COL
|
||||
|
|
||||
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
|
||||
| --- not covered
|
||||
|
|
||||
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ LL | impl<T> Iterable for Vec<T> {
|
|||
| --------------------------- in this `impl` item
|
||||
LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type
|
||||
|
|
||||
::: $SRC_DIR/libcore/iter/traits/iterator.rs:LL:COL
|
||||
|
|
||||
LL | type Item;
|
||||
| ---- associated type defined here
|
||||
|
|
||||
= note: expected reference `&T`
|
||||
found associated type `<std::vec::Vec<T> as Iterable>::Item<'_>`
|
||||
|
|
@ -18,6 +23,11 @@ LL | impl<T> Iterable for [T] {
|
|||
| ------------------------ in this `impl` item
|
||||
LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type
|
||||
|
|
||||
::: $SRC_DIR/libcore/iter/traits/iterator.rs:LL:COL
|
||||
|
|
||||
LL | type Item;
|
||||
| ---- associated type defined here
|
||||
|
|
||||
= note: expected reference `&T`
|
||||
found associated type `<[T] as Iterable>::Item<'_>`
|
||||
|
|
|
|||
|
|
@ -83,6 +83,16 @@ error[E0599]: no method named `method` found for struct `std::rc::Rc<&mut std::b
|
|||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&1i32)).method();
|
||||
| ^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&i32>>`
|
||||
|
|
||||
::: $DIR/auxiliary/no_method_suggested_traits.rs:8:12
|
||||
|
|
||||
LL | fn method(&self) {}
|
||||
| ------
|
||||
| |
|
||||
| the method is available for `std::boxed::Box<std::rc::Rc<&mut std::boxed::Box<&i32>>>` here
|
||||
| the method is available for `std::pin::Pin<std::rc::Rc<&mut std::boxed::Box<&i32>>>` here
|
||||
| the method is available for `std::sync::Arc<std::rc::Rc<&mut std::boxed::Box<&i32>>>` here
|
||||
| the method is available for `std::rc::Rc<std::rc::Rc<&mut std::boxed::Box<&i32>>>` here
|
||||
|
|
||||
= help: items from traits can only be used if the trait is in scope
|
||||
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@ LL | struct C {
|
|||
...
|
||||
LL | let _d = c.clone();
|
||||
| ^^^^^ method not found in `C`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<C>` here
|
||||
| the method is available for `std::rc::Rc<C>` here
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ LL | let _ = Struct::<A>::new().clone();
|
|||
|
|
||||
LL | pub struct Struct<A>(A);
|
||||
| ------------------------ doesn't satisfy `issue_69725::Struct<A>: std::clone::Clone`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<issue_69725::Struct<A>>` here
|
||||
| the method is available for `std::rc::Rc<issue_69725::Struct<A>>` here
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`A: std::clone::Clone`
|
||||
|
|
|
|||
|
|
@ -3,6 +3,14 @@ error[E0599]: no method named `clone` found for enum `libc::c_void` in the curre
|
|||
|
|
||||
LL | let _z = (*y).clone();
|
||||
| ^^^^^ method not found in `libc::c_void`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<libc::c_void>` here
|
||||
| the method is available for `std::rc::Rc<libc::c_void>` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@ LL | struct Foo {
|
|||
...
|
||||
LL | let _y = x.clone();
|
||||
| ^^^^^ method not found in `Foo`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<Foo>` here
|
||||
| the method is available for `std::rc::Rc<Foo>` here
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered
|
|||
|
|
||||
LL | match Some(Some(North)) {
|
||||
| ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/option.rs:LL:COL
|
||||
|
|
||||
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| ----
|
||||
| |
|
||||
| not covered
|
||||
| not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not co
|
|||
|
|
||||
LL | match private::DATA {
|
||||
| ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/option.rs:LL:COL
|
||||
|
|
||||
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| ---- not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ error[E0004]: non-exhaustive patterns: `Some(_)` not covered
|
|||
|
|
||||
LL | match Some(10) {
|
||||
| ^^^^^^^^ pattern `Some(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/option.rs:LL:COL
|
||||
|
|
||||
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| ---- not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
|||
|
|
||||
LL | let Ok(x) = res;
|
||||
| ^^^^^ pattern `Err(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/result.rs:LL:COL
|
||||
|
|
||||
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
|
||||
| --- not covered
|
||||
|
|
||||
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object
|
|||
|
|
||||
LL | fn bar(_x: Foo) {}
|
||||
| ^^^ the trait `issue_3907::Foo` cannot be made into an object
|
||||
|
|
||||
::: $DIR/auxiliary/issue-3907.rs:2:8
|
||||
|
|
||||
= note: the trait cannot be made into an object because associated function `bar` has no `self` parameter
|
||||
LL | fn bar();
|
||||
| --- the trait cannot be made into an object because associated function `bar` has no `self` parameter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covere
|
|||
|
|
||||
LL | match x {}
|
||||
| ^ patterns `Tuple(_)` and `Struct { .. }` not covered
|
||||
|
|
||||
::: $DIR/auxiliary/uninhabited.rs:17:23
|
||||
|
|
||||
LL | #[non_exhaustive] Tuple(!),
|
||||
| ----- not covered
|
||||
LL | #[non_exhaustive] Struct { x: ! }
|
||||
| ------ not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covere
|
|||
|
|
||||
LL | match x {}
|
||||
| ^ patterns `Tuple(_)` and `Struct { .. }` not covered
|
||||
|
|
||||
::: $DIR/auxiliary/uninhabited.rs:17:23
|
||||
|
|
||||
LL | #[non_exhaustive] Tuple(!),
|
||||
| ----- not covered
|
||||
LL | #[non_exhaustive] Struct { x: ! }
|
||||
| ------ not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered
|
|||
|
|
||||
LL | let _ = match x {
|
||||
| ^ pattern `Err(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/result.rs:LL:COL
|
||||
|
|
||||
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
|
||||
| --- not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
@ -46,6 +51,11 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered
|
|||
|
|
||||
LL | let _ = match x {
|
||||
| ^ pattern `Err(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/result.rs:LL:COL
|
||||
|
|
||||
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
|
||||
| --- not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
|
|
@ -54,6 +64,11 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
|||
|
|
||||
LL | let Ok(x) = x;
|
||||
| ^^^^^ pattern `Err(_)` not covered
|
||||
|
|
||||
::: $SRC_DIR/libcore/result.rs:LL:COL
|
||||
|
|
||||
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
|
||||
| --- not covered
|
||||
|
|
||||
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ LL | struct CloneNoCopy;
|
|||
...
|
||||
LL | let w = u.clone();
|
||||
| ^^^^^ method not found in `U5<CloneNoCopy>`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<U5<CloneNoCopy>>` here
|
||||
| the method is available for `std::rc::Rc<U5<CloneNoCopy>>` here
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`CloneNoCopy: std::marker::Copy`
|
||||
|
|
|
|||
|
|
@ -14,6 +14,14 @@ LL | let _z = y.clone();
|
|||
|
|
||||
LL | pub struct Box<T: ?Sized>(Unique<T>);
|
||||
| ------------------------------------- doesn't satisfy `std::boxed::Box<dyn Foo>: std::clone::Clone`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<std::boxed::Box<dyn Foo>>` here
|
||||
| the method is available for `std::rc::Rc<std::boxed::Box<dyn Foo>>` here
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`dyn Foo: std::marker::Sized`
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ LL | let _j = i.clone();
|
|||
|
|
||||
LL | pub struct Box<T: ?Sized>(Unique<T>);
|
||||
| ------------------------------------- doesn't satisfy `std::boxed::Box<R>: std::clone::Clone`
|
||||
|
|
||||
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
||||
|
|
||||
LL | fn clone(&self) -> Self;
|
||||
| -----
|
||||
| |
|
||||
| the method is available for `std::sync::Arc<std::boxed::Box<R>>` here
|
||||
| the method is available for `std::rc::Rc<std::boxed::Box<R>>` here
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`R: std::clone::Clone`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue