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

Add a check for uninferred type parameter #19979

Merged
merged 1 commit into from
Dec 22, 2014
Merged

Conversation

Munksgaard
Copy link
Contributor

This fixes #19978. The bug was introduced by 570325d, where if the type
of an Fn has not been inferred (strs[0] is "_") we slice from 1 to 0.

@alexcrichton
Copy link
Member

Instead of special casing _ it looks like this sub-slice needs to be a little more robust, could this just check for ending with ,) and have two different branches?

@Munksgaard
Copy link
Contributor Author

Sure. Something like this? Is it even possible to have strs[0] == "(foo)" ?

if strs[0].ends_with(",)") {
    strs[0][1 .. strs[0].len() - 2] // Remove '(' and ',)'
} else {
    strs[0]
}

@alexcrichton
Copy link
Member

Yeah that should be fine.

This fixes rust-lang#19978. The bug was introduced by 570325d, where if the type
of an Fn has not been inferred (strs[0] is "_") we slice from 1 to
0. We now explicitly check if `strs[0]` is a single element tuple.
bors added a commit that referenced this pull request Dec 19, 2014
Add a check for uninferred type parameter

Reviewed-by: alexcrichton
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 21, 2014
This fixes rust-lang#19978. The bug was introduced by 570325d, where if the type
of an Fn has not been inferred (strs[0] is "_") we slice from 1 to 0.
@bors bors merged commit 3bb91aa into rust-lang:master Dec 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE in rustc::util::ppaux when trying to represent a TraitRef
4 participants