File tree 3 files changed +24
-5
lines changed
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> {
2410
2410
2411
2411
match binding {
2412
2412
Ok ( binding) => {
2413
+ let def = binding. def ( ) ;
2414
+ let maybe_assoc = opt_ns != Some ( MacroNS ) && PathSource :: Type . is_expected ( def) ;
2413
2415
if let Some ( next_module) = binding. module ( ) {
2414
2416
module = Some ( next_module) ;
2415
- } else if binding . def ( ) == Def :: Err {
2417
+ } else if def == Def :: Err {
2416
2418
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 ) {
2418
2420
return PathResult :: NonModule ( PathResolution {
2419
- base_def : binding . def ( ) ,
2421
+ base_def : def,
2420
2422
depth : path. len ( ) - i - 1 ,
2421
2423
} ) ;
2422
2424
} 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() {
55
55
<u8 as E :: N >:: NN ; //~ ERROR unresolved method or associated constant `E::N::NN`
56
56
<u8 as A :: N >:: NN ; //~ ERROR unresolved method or associated constant `A::N::NN`
57
57
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 `
59
59
<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 `
61
61
62
62
let _: <u8 as Dr >:: Z ; //~ ERROR expected associated type, found method `Dr::Z`
63
63
<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