@@ -225,13 +225,15 @@ enum VisResolutionError<'a> {
225
225
ModuleOnly ( Span ) ,
226
226
}
227
227
228
- // A minimal representation of a path segment. We use this in resolve because
229
- // we synthesize 'path segments' which don't have the rest of an AST or HIR
230
- // `PathSegment`.
228
+ /// A minimal representation of a path segment. We use this in resolve because we synthesize 'path
229
+ /// segments' which don't have the rest of an AST or HIR `PathSegment`.
231
230
#[ derive( Clone , Copy , Debug ) ]
232
231
pub struct Segment {
233
232
ident : Ident ,
234
233
id : Option < NodeId > ,
234
+ /// Signals whether this `PathSegment` has generic arguments. Used to avoid providing
235
+ /// nonsensical suggestions.
236
+ has_args : bool ,
235
237
}
236
238
237
239
impl Segment {
@@ -240,7 +242,7 @@ impl Segment {
240
242
}
241
243
242
244
fn from_ident ( ident : Ident ) -> Segment {
243
- Segment { ident, id : None }
245
+ Segment { ident, id : None , has_args : false }
244
246
}
245
247
246
248
fn names_to_string ( segments : & [ Segment ] ) -> String {
@@ -250,7 +252,7 @@ impl Segment {
250
252
251
253
impl < ' a > From < & ' a ast:: PathSegment > for Segment {
252
254
fn from ( seg : & ' a ast:: PathSegment ) -> Segment {
253
- Segment { ident : seg. ident , id : Some ( seg. id ) }
255
+ Segment { ident : seg. ident , id : Some ( seg. id ) , has_args : seg . args . is_some ( ) }
254
256
}
255
257
}
256
258
@@ -2017,7 +2019,7 @@ impl<'a> Resolver<'a> {
2017
2019
path, opt_ns, record_used, path_span, crate_lint,
2018
2020
) ;
2019
2021
2020
- for ( i, & Segment { ident, id } ) in path. iter ( ) . enumerate ( ) {
2022
+ for ( i, & Segment { ident, id, has_args : _ } ) in path. iter ( ) . enumerate ( ) {
2021
2023
debug ! ( "resolve_path ident {} {:?} {:?}" , i, ident, id) ;
2022
2024
let record_segment_res = |this : & mut Self , res| {
2023
2025
if record_used {
0 commit comments