File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -2084,7 +2084,9 @@ impl<'a> Resolver<'a> {
20842084 ValueNS ,
20852085 impl_item. span ,
20862086 |n, s| ResolutionError :: ConstNotMemberOfTrait ( n, s) ) ;
2087- visit:: walk_impl_item ( this, impl_item) ;
2087+ this. with_constant_rib ( |this|
2088+ visit:: walk_impl_item ( this, impl_item)
2089+ ) ;
20882090 }
20892091 ImplItemKind :: Method ( ref sig, _) => {
20902092 // If this is a trait impl, ensure the method
Original file line number Diff line number Diff line change 1+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ let n = 0 ;
13+
14+ struct Foo ;
15+ impl Foo {
16+ const N : usize = n;
17+ //~^ ERROR attempt to use a non-constant value
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments