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

change an instance of span_bug() to struct_span_err() to avoid ICE #69014

Merged
merged 1 commit into from
Feb 11, 2020
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
5 changes: 4 additions & 1 deletion src/librustc_parse/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ impl<'a> Parser<'a> {
let path = match bounds.remove(0) {
GenericBound::Trait(pt, ..) => pt.trait_ref.path,
GenericBound::Outlives(..) => {
self.span_bug(ty.span, "unexpected lifetime bound")
return Err(self.struct_span_err(
ty.span,
"expected trait bound, not lifetime bound",
));
}
};
self.parse_remaining_bounds(Vec::new(), path, lo, true)
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/parser/issue-68890.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enum e{A((?'a a+?+l))}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A slightly simpler reproducer btw, type X = (?'a ?+l);.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll update this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, yours is sufficiently minimal. ;)

//~^ ERROR `?` may only modify trait bounds, not lifetime bounds
//~| ERROR expected one of `)`, `+`, or `,`
//~| ERROR expected trait bound, not lifetime bound
20 changes: 20 additions & 0 deletions src/test/ui/parser/issue-68890.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: `?` may only modify trait bounds, not lifetime bounds
--> $DIR/issue-68890.rs:1:11
|
LL | enum e{A((?'a a+?+l))}
| ^

error: expected one of `)`, `+`, or `,`, found `a`
--> $DIR/issue-68890.rs:1:15
|
LL | enum e{A((?'a a+?+l))}
| ^ expected one of `)`, `+`, or `,`

error: expected trait bound, not lifetime bound
--> $DIR/issue-68890.rs:1:11
|
LL | enum e{A((?'a a+?+l))}
| ^^^

error: aborting due to 3 previous errors