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

found value name used as a type with box/enum #18195

Closed
blastrock opened this issue Oct 20, 2014 · 1 comment
Closed

found value name used as a type with box/enum #18195

blastrock opened this issue Oct 20, 2014 · 1 comment

Comments

@blastrock
Copy link

Hi,

I found a very strange bug. The following code won't compile:

type Entities = Box<Entity+'static>;

trait Entity {
}

enum Shape {
    Box(f64, f64), // <--- this line breaks compilation
}

fn main() {
}

The error is:

a.rs:1:17: 1:36 error: found value name used as a type: DefVariant(DefId { krate: 0, node: 13 }, DefId { krate: 0, node: 14 }, false)
a.rs:1 type Entities = Box<Entity+'static>;
                       ^~~~~~~~~~~~~~~~~~~

But if you comment the line I marked, it will compile without problem. Tested on master today http://is.gd/Si0mUC

@blastrock
Copy link
Author

Okay I got it ><
It was stupid of me, sorry.
The error could have been more explicit as to where these ast nodes come from. Anyway, I'll close this.

lnicola pushed a commit to lnicola/rust that referenced this issue Oct 8, 2024
…mzqv, r=Veykril

internal: remove `Default` from OpQueue

`@Wilfred` and I were talking about `OpQueue` and we identified one symptom of its (relative) weirdness is that `last_op_result` returns a `T::default()`; not `Option<&T>`, which means it's not possible to distinguish between "the `OpQueue` hasn't run yet" and "the OpQueue ran, but didn't produce a result". This branch fixes that.
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

No branches or pull requests

1 participant