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

Invalid error (E0425) reported #27433

Closed
GuillaumeGomez opened this issue Jul 31, 2015 · 6 comments
Closed

Invalid error (E0425) reported #27433

GuillaumeGomez opened this issue Jul 31, 2015 · 6 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@GuillaumeGomez
Copy link
Member

In the following code:

fn main() {
    let foo = 42u32;
    const FOO : u32 = foo;
}

We have the following errors:

<anon>:3:23: 3:26 error: attempt to use a non-constant value in a constant [E0435]
<anon>:3     const FOO : u32 = foo;
                               ^~~
<anon>:3:23: 3:26 error: unresolved name `foo` [E0425]
<anon>:3     const FOO : u32 = foo;

The first one is "normal", however, the E0425 might mislead developer's understanding on this error.

cc @eddyb

@eddyb
Copy link
Member

eddyb commented Jul 31, 2015

IMO the second error is fine, because the local foo variable is not in scope for the FOO constant item.
The first one could be a note instead of an error and rephrased, perhaps.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Aug 4, 2015
@brson
Copy link
Contributor

brson commented Jan 26, 2017

Current output:

fn main() {
    let foo = 42u32;
    const FOO : u32 = foo;
}

Seems fixed cc @GuillaumeGomez

@brson brson added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jan 26, 2017
@brson
Copy link
Contributor

brson commented Jan 26, 2017

Just add test.

@GuillaumeGomez
Copy link
Member Author

@brson: Do you have the PR which fixed this issue by any chance? (so I can add the test accordingly to it if still needed)

@brson
Copy link
Contributor

brson commented Jan 27, 2017

@GuillaumeGomez no I do not. I just noticed that the op is working.

JanZerebecki added a commit to JanZerebecki/rust that referenced this issue Feb 8, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 9, 2017
Keruspe added a commit to Keruspe/rust that referenced this issue Feb 9, 2017
* 'master' of git://github.com/rust-lang/rust: (70 commits)
  sanitizer-dylib: only run where std for x86_64-linux is available
  travis: Fix build order of dist-x86-linux
  fix the sanitizer-dylib test on non x86_64 linux hosts
  dist-x86-linux: install newer kernel headers
  enable sanitizers on build job that tests x86_64 linux
  enable sanitizers on x86_64-linux releases
  use helper function in the rebuild logic of the rustc_*san crates
  build/test the sanitizers only when --enable-sanitizers is used
  sanitizer support
  Add missing urls on join_paths
  Add test for rust-lang#27433
  Add more examples, get everything passing at last.
  Remove some leftover makefiles.
  Add more test for rustdoc --test
  Rename manifest_version to manifest-version
  reference: clarify #[cfg] section
  Bump stable release date
  rustbuild: Clean build/dist on `make clean`
  Add missing urls for current_dir
  review nits
  ...
@steveklabnik steveklabnik removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@estebank
Copy link
Contributor

estebank commented Mar 13, 2017

@brson test merged, this issue can be closed.

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 E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

5 participants