mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Fix tuple struct field spans
This commit is contained in:
parent
e5f80f2a4f
commit
85f57389bf
@ -5741,7 +5741,7 @@ impl<'a> Parser<'a> {
|
||||
let vis = p.parse_visibility(true)?;
|
||||
let ty = p.parse_ty()?;
|
||||
Ok(StructField {
|
||||
span: lo.to(p.span),
|
||||
span: lo.to(ty.span),
|
||||
vis,
|
||||
ident: None,
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
|
@ -5,7 +5,7 @@ LL | enum Bar {
|
||||
| ^^^^^^^^ recursive type has infinite size
|
||||
...
|
||||
LL | BarSome(Bar)
|
||||
| ---- recursive without indirection
|
||||
| --- recursive without indirection
|
||||
|
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
|
||||
|
||||
|
@ -4,7 +4,7 @@ error[E0072]: recursive type `Expr` has infinite size
|
||||
LL | enum Expr { //~ ERROR E0072
|
||||
| ^^^^^^^^^ recursive type has infinite size
|
||||
LL | Plus(Expr, Expr),
|
||||
| ----- ----- recursive without indirection
|
||||
| ---- ---- recursive without indirection
|
||||
| |
|
||||
| recursive without indirection
|
||||
|
|
||||
|
@ -20,14 +20,14 @@ enum Foo<'a, T> {
|
||||
|
||||
// Type U needs to outlive lifetime 'b
|
||||
struct Bar<'b, U> {
|
||||
field2: &'b U //~ ERROR 23:5: 23:18: the parameter type `U` may not live long enough [E0309]
|
||||
field2: &'b U //~ ERROR the parameter type `U` may not live long enough [E0309]
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Type K needs to outlive lifetime 'c.
|
||||
enum Ying<'c, K> {
|
||||
One(&'c Yang<K>) //~ ERROR 30:9: 30:21: the parameter type `K` may not live long enough [E0309]
|
||||
One(&'c Yang<K>) //~ ERROR the parameter type `K` may not live long enough [E0309]
|
||||
}
|
||||
|
||||
struct Yang<V> {
|
||||
|
@ -3,13 +3,13 @@ error[E0309]: the parameter type `U` may not live long enough
|
||||
|
|
||||
LL | struct Bar<'b, U> {
|
||||
| - help: consider adding an explicit lifetime bound `U: 'b`...
|
||||
LL | field2: &'b U //~ ERROR 23:5: 23:18: the parameter type `U` may not live long enough [E0309]
|
||||
LL | field2: &'b U //~ ERROR the parameter type `U` may not live long enough [E0309]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...so that the reference type `&'b U` does not outlive the data it points at
|
||||
--> $DIR/enum.rs:23:5
|
||||
|
|
||||
LL | field2: &'b U //~ ERROR 23:5: 23:18: the parameter type `U` may not live long enough [E0309]
|
||||
LL | field2: &'b U //~ ERROR the parameter type `U` may not live long enough [E0309]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0309]: the parameter type `K` may not live long enough
|
||||
@ -17,14 +17,14 @@ error[E0309]: the parameter type `K` may not live long enough
|
||||
|
|
||||
LL | enum Ying<'c, K> {
|
||||
| - help: consider adding an explicit lifetime bound `K: 'c`...
|
||||
LL | One(&'c Yang<K>) //~ ERROR 30:9: 30:21: the parameter type `K` may not live long enough [E0309]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | One(&'c Yang<K>) //~ ERROR the parameter type `K` may not live long enough [E0309]
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: ...so that the reference type `&'c Yang<K>` does not outlive the data it points at
|
||||
--> $DIR/enum.rs:30:9
|
||||
|
|
||||
LL | One(&'c Yang<K>) //~ ERROR 30:9: 30:21: the parameter type `K` may not live long enough [E0309]
|
||||
| ^^^^^^^^^^^^
|
||||
LL | One(&'c Yang<K>) //~ ERROR the parameter type `K` may not live long enough [E0309]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -32,7 +32,7 @@ LL | #[derive(Copy)] //~ ERROR may not be implemented for this type
|
||||
| ^^^^
|
||||
LL | enum EFoo2<'a> {
|
||||
LL | Bar(&'a mut bool),
|
||||
| ------------- this field does not implement `Copy`
|
||||
| ------------ this field does not implement `Copy`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -22,7 +22,7 @@ error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied
|
||||
--> $DIR/union-sized-field.rs:23:11
|
||||
|
|
||||
LL | Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
|
||||
| ^^ `T` does not have a constant size known at compile-time
|
||||
| ^ `T` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `T`
|
||||
= help: consider adding a `where T: std::marker::Sized` bound
|
||||
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `W: std::marker::Sized` is not satisfied
|
||||
--> $DIR/unsized-enum2.rs:33:8
|
||||
|
|
||||
LL | VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied
|
||||
| ^^ `W` does not have a constant size known at compile-time
|
||||
| ^ `W` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `W`
|
||||
= help: consider adding a `where W: std::marker::Sized` bound
|
||||
@ -22,7 +22,7 @@ error[E0277]: the trait bound `Y: std::marker::Sized` is not satisfied
|
||||
--> $DIR/unsized-enum2.rs:35:15
|
||||
|
|
||||
LL | VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied
|
||||
| ^^ `Y` does not have a constant size known at compile-time
|
||||
| ^ `Y` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Y`
|
||||
= help: consider adding a `where Y: std::marker::Sized` bound
|
||||
@ -42,7 +42,7 @@ error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied
|
||||
--> $DIR/unsized-enum2.rs:39:8
|
||||
|
|
||||
LL | VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied
|
||||
| ^^^^^ `[u8]` does not have a constant size known at compile-time
|
||||
| ^^^^ `[u8]` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
@ -60,7 +60,7 @@ error[E0277]: the trait bound `[f32]: std::marker::Sized` is not satisfied
|
||||
--> $DIR/unsized-enum2.rs:41:15
|
||||
|
|
||||
LL | VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied
|
||||
| ^^^^^^ `[f32]` does not have a constant size known at compile-time
|
||||
| ^^^^^ `[f32]` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[f32]`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
@ -78,7 +78,7 @@ error[E0277]: the trait bound `Foo + 'static: std::marker::Sized` is not satisfi
|
||||
--> $DIR/unsized-enum2.rs:51:8
|
||||
|
|
||||
LL | VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied
|
||||
| ^^^^ `Foo + 'static` does not have a constant size known at compile-time
|
||||
| ^^^ `Foo + 'static` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Foo + 'static`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
@ -96,7 +96,7 @@ error[E0277]: the trait bound `FooBar + 'static: std::marker::Sized` is not sati
|
||||
--> $DIR/unsized-enum2.rs:53:15
|
||||
|
|
||||
LL | VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied
|
||||
| ^^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time
|
||||
| ^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
@ -114,7 +114,7 @@ error[E0277]: the trait bound `[i8]: std::marker::Sized` is not satisfied
|
||||
--> $DIR/unsized-enum2.rs:57:8
|
||||
|
|
||||
LL | VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[i8]`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
@ -132,7 +132,7 @@ error[E0277]: the trait bound `[f64]: std::marker::Sized` is not satisfied
|
||||
--> $DIR/unsized-enum2.rs:60:15
|
||||
|
|
||||
LL | VS(isize, <&'static [f64] as Deref>::Target),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[f64]`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
@ -150,7 +150,7 @@ error[E0277]: the trait bound `PathHelper1 + 'static: std::marker::Sized` is not
|
||||
--> $DIR/unsized-enum2.rs:45:8
|
||||
|
|
||||
LL | VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied
|
||||
| ^^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time
|
||||
| ^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static`
|
||||
= note: required because it appears within the type `Path1`
|
||||
@ -170,7 +170,7 @@ error[E0277]: the trait bound `PathHelper3 + 'static: std::marker::Sized` is not
|
||||
--> $DIR/unsized-enum2.rs:47:15
|
||||
|
|
||||
LL | VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied
|
||||
| ^^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time
|
||||
| ^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time
|
||||
|
|
||||
= help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static`
|
||||
= note: required because it appears within the type `Path3`
|
||||
|
Loading…
Reference in New Issue
Block a user