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

Comments

Projects
None yet
5 participants
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jul 31, 2015

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

This comment has been minimized.

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.

@brson

This comment has been minimized.

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-needstest label Jan 26, 2017

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Jan 26, 2017

Just add test.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jan 26, 2017

@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

This comment has been minimized.

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

Merge branch 'master' of git://github.com/rust-lang/rust
* '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 label Mar 9, 2017

@estebank

This comment has been minimized.

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
You can’t perform that action at this time.