Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tuple struct field spans #50590

Merged
merged 1 commit into from
May 11, 2018
Merged
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
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issue-3008-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issue-32326.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/rfc-2093-infer-outlives/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/rfc-2093-infer-outlives/enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ 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
--> $DIR/enum.rs:30:9
|
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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/span/E0204.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/union/union-sized-field.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/test/ui/unsized-enum2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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`
Expand All @@ -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`
Expand Down