@@ -768,15 +768,13 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
768768 & mut self ,
769769 path : & [ Segment ] ,
770770 opt_ns : Option < Namespace > , // `None` indicates a module path in import
771- record_used : bool ,
772771 path_span : Span ,
773772 crate_lint : CrateLint ,
774773 ) -> PathResult < ' a > {
775774 self . r . resolve_path_with_ribs (
776775 path,
777776 opt_ns,
778777 & self . parent_scope ,
779- record_used,
780778 path_span,
781779 crate_lint,
782780 Some ( & self . ribs ) ,
@@ -1253,18 +1251,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
12531251 PathSource :: Trait ( AliasPossibility :: No ) ,
12541252 CrateLint :: SimplePath ( trait_ref. ref_id ) ,
12551253 ) ;
1256- let res = res. base_res ( ) ;
1257- if res != Res :: Err {
1258- if let PathResult :: Module ( ModuleOrUniformRoot :: Module ( module) ) = self . resolve_path (
1259- & path,
1260- Some ( TypeNS ) ,
1261- true ,
1262- trait_ref. path . span ,
1263- CrateLint :: SimplePath ( trait_ref. ref_id ) ,
1264- ) {
1265- new_id = Some ( res. def_id ( ) ) ;
1266- new_val = Some ( ( module, trait_ref. clone ( ) ) ) ;
1267- }
1254+ if let Some ( def_id) = res. base_res ( ) . opt_def_id ( ) {
1255+ new_id = Some ( def_id) ;
1256+ new_val = Some ( ( self . r . expect_module ( def_id) , trait_ref. clone ( ) ) ) ;
12681257 }
12691258 }
12701259 let original_trait_ref = replace ( & mut self . current_trait_ref , new_val) ;
@@ -2026,6 +2015,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
20262015 None
20272016 } ;
20282017
2018+ assert_ne ! ( crate_lint, CrateLint :: No ) ;
20292019 let partial_res = match self . resolve_qpath_anywhere (
20302020 id,
20312021 qself,
@@ -2060,7 +2050,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
20602050 std_path. push ( Segment :: from_ident ( Ident :: with_dummy_span ( sym:: std) ) ) ;
20612051 std_path. extend ( path) ;
20622052 if let PathResult :: Module ( _) | PathResult :: NonModule ( _) =
2063- self . resolve_path ( & std_path, Some ( ns) , false , span, CrateLint :: No )
2053+ self . resolve_path ( & std_path, Some ( ns) , span, CrateLint :: No )
20642054 {
20652055 // Check if we wrote `str::from_utf8` instead of `std::str::from_utf8`
20662056 let item_span =
@@ -2228,7 +2218,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
22282218 ) ) ) ;
22292219 }
22302220
2231- let result = match self . resolve_path ( & path, Some ( ns) , true , span, crate_lint) {
2221+ let result = match self . resolve_path ( & path, Some ( ns) , span, crate_lint) {
22322222 PathResult :: NonModule ( path_res) => path_res,
22332223 PathResult :: Module ( ModuleOrUniformRoot :: Module ( module) ) if !module. is_normal ( ) => {
22342224 PartialRes :: new ( module. res ( ) . unwrap ( ) )
@@ -2268,13 +2258,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
22682258 && path[ 0 ] . ident . name != kw:: DollarCrate
22692259 {
22702260 let unqualified_result = {
2271- match self . resolve_path (
2272- & [ * path. last ( ) . unwrap ( ) ] ,
2273- Some ( ns) ,
2274- false ,
2275- span,
2276- CrateLint :: No ,
2277- ) {
2261+ match self . resolve_path ( & [ * path. last ( ) . unwrap ( ) ] , Some ( ns) , span, CrateLint :: No ) {
22782262 PathResult :: NonModule ( path_res) => path_res. base_res ( ) ,
22792263 PathResult :: Module ( ModuleOrUniformRoot :: Module ( module) ) => {
22802264 module. res ( ) . unwrap ( )
0 commit comments