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

rustc error for missing struct construction args could be improved #8495

Closed
pnkfelix opened this issue Aug 13, 2013 · 2 comments
Closed

rustc error for missing struct construction args could be improved #8495

pnkfelix opened this issue Aug 13, 2013 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@pnkfelix
Copy link
Member

Code:

struct S { now_req: bool }
trait T { }
impl T for S {}
fn main() {
    let x = @S as @T;
    println("Hello World");
}

rustc output:

/tmp/mt.rs:5:13: 5:14 error: unresolved name `S`.
/tmp/mt.rs:5     let x = @S as @T;
                          ^
error: aborting due to previous error

We can do better (in terms of looking S up in the struct namespace and informing the user that they need to provide the { ... } portion).

@sanxiyn
Copy link
Member

sanxiyn commented Oct 30, 2013

Now you get (after #6702 is fixed):

error: `S` is a structure name, but this expression uses it like a function name
note: Did you mean to write: `S { /* fields */ }`?

This looks great, except "uses it like a function name" is confusing, since there is no call here. I think we just need to reword the message.

@alexcrichton
Copy link
Member

Closing, I believe this can be satisfactorily considered solved since #6702 landed.

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 24, 2022
Don't lint `ptr_arg` on `&mut Cow<_>`

fixes: rust-lang#8495

changelog: Don't lint `ptr_arg` on `&mut Cow<_>`
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