File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -2410,13 +2410,15 @@ impl<'a> Resolver<'a> {
24102410
24112411 match binding {
24122412 Ok ( binding) => {
2413+ let def = binding. def ( ) ;
2414+ let maybe_assoc = opt_ns != Some ( MacroNS ) && PathSource :: Type . is_expected ( def) ;
24132415 if let Some ( next_module) = binding. module ( ) {
24142416 module = Some ( next_module) ;
2415- } else if binding . def ( ) == Def :: Err {
2417+ } else if def == Def :: Err {
24162418 return PathResult :: NonModule ( err_path_resolution ( ) ) ;
2417- } else if opt_ns. is_some ( ) && ! ( opt_ns == Some ( MacroNS ) && !is_last ) {
2419+ } else if opt_ns. is_some ( ) && ( is_last || maybe_assoc ) {
24182420 return PathResult :: NonModule ( PathResolution {
2419- base_def : binding . def ( ) ,
2421+ base_def : def,
24202422 depth : path. len ( ) - i - 1 ,
24212423 } ) ;
24222424 } else {
Original file line number Diff line number Diff line change 1+ // Copyright 2016 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+ enum E { V }
12+ use E :: V ;
13+
14+ fn main ( ) {
15+ E :: V :: associated_item; //~ ERROR failed to resolve. Not a module `V`
16+ V :: associated_item; //~ ERROR failed to resolve. Not a module `V`
17+ }
Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ fn main() {
5555 <u8 as E :: N >:: NN ; //~ ERROR unresolved method or associated constant `E::N::NN`
5656 <u8 as A :: N >:: NN ; //~ ERROR unresolved method or associated constant `A::N::NN`
5757 let _: <u8 as Tr :: Y >:: NN ; //~ ERROR unresolved associated type `Tr::Y::NN`
58- let _: <u8 as E :: Y >:: NN ; //~ ERROR unresolved associated type `E::Y::NN `
58+ let _: <u8 as E :: Y >:: NN ; //~ ERROR failed to resolve. Not a module `Y `
5959 <u8 as Tr :: Y >:: NN ; //~ ERROR unresolved method or associated constant `Tr::Y::NN`
60- <u8 as E :: Y >:: NN ; //~ ERROR unresolved method or associated constant `E::Y::NN `
60+ <u8 as E :: Y >:: NN ; //~ ERROR failed to resolve. Not a module `Y `
6161
6262 let _: <u8 as Dr >:: Z ; //~ ERROR expected associated type, found method `Dr::Z`
6363 <u8 as Dr >:: X ; //~ ERROR expected method or associated constant, found associated type `Dr::X`
You can’t perform that action at this time.
0 commit comments