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

What is this warning? #32214

Closed
nagisa opened this issue Mar 12, 2016 · 5 comments
Closed

What is this warning? #32214

nagisa opened this issue Mar 12, 2016 · 5 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@nagisa
Copy link
Member

nagisa commented Mar 12, 2016

src/librustc_mir/pretty.rs:20:36: 20:37 warning: whoops, no =?
src/librustc_mir/pretty.rs:20                                   w: &mut W) -> io::Result<()> {
                                                                 ^
@nagisa nagisa added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 12, 2016
@jonas-schievink
Copy link
Contributor

@nagisa
Copy link
Member Author

nagisa commented Mar 12, 2016

The code which caused this was similar to

pub fn write_mir_pretty<'a, W, I>(iter: &Iterator<Item=(&'a NodeId, &'a Mir<'a>), w: &mut W) -> io::Result<()>

note the missing > in iterator parameter list.

The warning with signature on one line:

src/librustc_mir/pretty.rs:19:84: 19:85 warning: whoops, no =?
src/librustc_mir/pretty.rs:19 pub fn write_mir_pretty<'a, W, I>(iter: &Iterator<Item=(&'a NodeId, &'a Mir<'a>), w: &mut W) -> io::Result<()>
                                                                                                                 ^

@jonas-schievink
Copy link
Contributor

This also causes the warning:

fn f<T:Iterator<Item=(), w>() {}
<anon>:1:27: 1:28 warning: whoops, no =?
<anon>:1 fn f<T:Iterator<Item=(), w>() {}
                                   ^
<anon>:1:27: 1:28 error: expected type, found `>`
<anon>:1 fn f<T:Iterator<Item=(), w>() {}
                                   ^

@nagisa
Copy link
Member Author

nagisa commented Mar 12, 2016

@durka this is a parser and it has no/should not have notion of any such things.

I propose “error: expected =, found ...”, personally.

@nrc
Copy link
Member

nrc commented Mar 14, 2016

I'm a bit surprised that we bother to warn at all. Either it's an error and we should give an error (with a better message). Or we should not emit anything and rely on the error being caught later on (perhaps with a more informative error message).

In either case, we should explain why there is an error here - because you can't have unbound type variables after bound ones.

Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2016
parser: change warning into an error on `T<A=B, C>`

part of rust-lang#32214

This seems to be the obvious fix, and the error message is consistent with all the other parser errors ("expected x, found y").
@bors bors closed this as completed in 98d991f May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants