Closed
Description
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
eddyb commentedon Jul 31, 2015
IMO the second error is fine, because the local
foo
variable is not in scope for theFOO
constant item.The first one could be a note instead of an error and rephrased, perhaps.
brson commentedon Jan 26, 2017
Current output:
Seems fixed cc @GuillaumeGomez
brson commentedon Jan 26, 2017
Just add test.
GuillaumeGomez commentedon 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 commentedon Jan 27, 2017
@GuillaumeGomez no I do not. I just noticed that the op is working.
Add test for rust-lang#27433
Rollup merge of rust-lang#39653 - JanZerebecki:test-issue-27433, r=al…
Merge branch 'master' of git://github.com/rust-lang/rust
estebank commentedon Mar 13, 2017
@brson test merged, this issue can be closed.