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

Error when forgetting a :: when specializing a generic is confusing #1187

Closed
jdm opened this issue Nov 18, 2011 · 10 comments
Closed

Error when forgetting a :: when specializing a generic is confusing #1187

jdm opened this issue Nov 18, 2011 · 10 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@jdm
Copy link
Contributor

jdm commented Nov 18, 2011

If there's no way to fix this, so be it, but it would be nice to have a heuristic that could help the user figure out what's going on.

../src/comp/middle/debuginfo.rs:61:44: 61:52 error: unresolved name: ValueRef
../src/comp/middle/debuginfo.rs:61     unsafe::reinterpret_cast(std::ptr::null<ValueRef>())
                                                                               ^~~~~~~~
@jdm
Copy link
Contributor Author

jdm commented Nov 19, 2011

N.B. the confusion here is that std::ptr::null<ValueRef>() is parsed as (std::ptr::null) < (ValueRef) > (), and there's no value named ValueRef.

@ghost ghost assigned marijnh Apr 12, 2012
@catamorphism
Copy link
Contributor

Confirmed that HEAD still exhibits the same (confusing) behavior.

@catamorphism
Copy link
Contributor

Still just as confusing, as of 86b8bf3

@catamorphism
Copy link
Contributor

This is still just as confusing as ever. Nominating for milestone 5, production-ready -- I think it's really important to fix this, as it confuses new users.

@graydon
Copy link
Contributor

graydon commented Jun 13, 2013

yeah, this is a special-case warning, should look at unresolved name when occurring within the RHS of a binary less-than expr and check for a type name, if matching, issue special-case warning.

@graydon
Copy link
Contributor

graydon commented Jun 13, 2013

accepted for production-ready milestone

@huonw
Copy link
Member

huonw commented Sep 16, 2013

Triage: still just as confusing as of 4ecb0a3.

@catamorphism
Copy link
Contributor

Not 1.0

@flaper87
Copy link
Contributor

flaper87 commented Mar 3, 2014

Visiting for triage. Nothing to add

@steveklabnik
Copy link
Member

Today, with this example:

fn main() {
    std::mem::size_of<i32>();
}

I get this error:

hello.rs:2:26: 2:27 error: Chained comparison operators require parentheses
hello.rs:2     std::mem::size_of<i32>();
                                    ^
hello.rs:2:26: 2:27 help: Use ::< instead of < if you meant to specify type arguments.
hello.rs:2     std::mem::size_of<i32>();
                                    ^

Seems good! I don't know when this changed, but it has.

bjorn3 added a commit to bjorn3/rust that referenced this issue Aug 6, 2021
Preparations for building as part of rustc
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
rust-lang#1187)

This ensures that results are consistent across windows/linux tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

7 participants