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

impl [Trait for] value {} gives impl coherence/resolve errors, rather than indicating that the impl head is not a type #18119

Closed
huonw opened this issue Oct 17, 2014 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@huonw
Copy link
Member

huonw commented Oct 17, 2014

const X: u8 = 1;
static Y: u8 = 1;
fn foo() {}

impl X {}
impl Y {}
impl foo {}

fn main() {}
<anon>:5:6: 5:7 error: inherent implementations are not allowed for types not defined in the current module.
<anon>:5 impl X {}
              ^
<anon>:6:6: 6:7 error: inherent implementations are not allowed for types not defined in the current module.
<anon>:6 impl Y {}
              ^
<anon>:7:6: 7:9 error: inherent implementations are not allowed for types not defined in the current module.
<anon>:7 impl foo {}
              ^~~
const X: uint = 1;
impl Eq for X {}

fn main() {}
<anon>:9:13: 9:14 error: use of undeclared type name `X`
<anon>:9 impl Eq for X {}
                     ^

These would all preferably indicate that the impl "type" is not actually a type.

@huonw huonw added I-papercut A-diagnostics Area: Messages for errors, warnings, and lints labels Oct 17, 2014
@frewsxcv
Copy link
Member

I think this is fixed

/tmp $ rustc hi.rs
hi.rs:5:6: 5:7 error: use of undeclared type name `X`
hi.rs:5 impl X {}
             ^
hi.rs:6:6: 6:7 error: use of undeclared type name `Y`
hi.rs:6 impl Y {}
             ^
hi.rs:7:6: 7:9 error: use of undeclared type name `foo`
hi.rs:7 impl foo {}
             ^~~
error: aborting due to 3 previous errors
/tmp $ rustc -vV
rustc 1.0.0-nightly (3e4be02b8 2015-03-13) (built 2015-03-13)
binary: rustc
commit-hash: 3e4be02b80a3dd27bce20870958fe0aef7e7336d
commit-date: 2015-03-13
build-date: 2015-03-13
host: x86_64-apple-darwin
release: 1.0.0-nightly

nham pushed a commit to nham/rust that referenced this issue Jun 25, 2015
bors added a commit that referenced this issue Jun 25, 2015
Fixes #24357.

Also adds a (totally separate) regression test, which

Closes #18119
lnicola pushed a commit to lnicola/rust that referenced this issue Sep 25, 2024
fix: Fix printing of constants greater than `i128::MAX`

Fixes rust-lang#18116.
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

2 participants