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

Possible parse error / possible unused_parens false positive (explicit return UFCS) #37765

Closed
withoutboats opened this issue Nov 14, 2016 · 1 comment · Fixed by #37772
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@withoutboats
Copy link
Contributor

This does not compile, because the open < is parsed as a comparison operator. Possibly, this is a bug, and it should be parsed as it is intended - opening a type scope. But I don't know.

pub fn stringify<T: ToString>(arg: T) -> String {
    return <T as ToString>::to_string(&arg);
}

If the current parse is correct, adding parens should not produce an unused_parens error, because these parens are necessary to make it parse as intended. However, it does:

pub fn stringify<T: ToString>(arg: T) -> String {
    return (<T as ToString>::to_string(&arg));
}
@withoutboats withoutboats changed the title Possible parse error / possible unused_parens false positive Possible parse error / possible unused_parens false positive (explicit return UFCS) Nov 14, 2016
@petrochenkov
Copy link
Contributor

@withoutboats

This does not compile

It does on nightly!
Fixed by #37290

@sfackler sfackler added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Nov 14, 2016
durka added a commit to durka/rust that referenced this issue Nov 14, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 17, 2016
add test for rust-lang#37765

Adds a test for rust-lang#37765, a path parsing fix which removes the need for a parenthesis workaround.

Closes rust-lang#37765.
cc rust-lang#37290 @withoutboats
r? @petrochenkov
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 17, 2016
add test for rust-lang#37765

Adds a test for rust-lang#37765, a path parsing fix which removes the need for a parenthesis workaround.

Closes rust-lang#37765.
cc rust-lang#37290 @withoutboats
r? @petrochenkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants