Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jun 17, 2020
1 parent af45d8a commit 8d1a380
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/librustc_resolve/build_reduced_graph.rs
Expand Up @@ -485,7 +485,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
module_path.push(Segment {
ident: Ident { name: kw::PathRoot, span: source.ident.span },
id: Some(self.r.next_node_id()),
has_args: false,
has_generic_args: false,
});
source.ident.name = crate_name;
}
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_resolve/late/diagnostics.rs
Expand Up @@ -920,7 +920,9 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
path: &[Segment],
) -> Option<(Span, &'static str, String, Applicability)> {
let (ident, span) = match path {
[segment] if !segment.has_args => (segment.ident.to_string(), segment.ident.span),
[segment] if !segment.has_generic_args => {
(segment.ident.to_string(), segment.ident.span)
}
_ => return None,
};
let mut iter = ident.chars().map(|c| c.is_uppercase());
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_resolve/lib.rs
Expand Up @@ -233,7 +233,7 @@ pub struct Segment {
id: Option<NodeId>,
/// Signals whether this `PathSegment` has generic arguments. Used to avoid providing
/// nonsensical suggestions.
has_args: bool,
has_generic_args: bool,
}

impl Segment {
Expand All @@ -242,7 +242,7 @@ impl Segment {
}

fn from_ident(ident: Ident) -> Segment {
Segment { ident, id: None, has_args: false }
Segment { ident, id: None, has_generic_args: false }
}

fn names_to_string(segments: &[Segment]) -> String {
Expand All @@ -252,7 +252,7 @@ impl Segment {

impl<'a> From<&'a ast::PathSegment> for Segment {
fn from(seg: &'a ast::PathSegment) -> Segment {
Segment { ident: seg.ident, id: Some(seg.id), has_args: seg.args.is_some() }
Segment { ident: seg.ident, id: Some(seg.id), has_generic_args: seg.args.is_some() }
}
}

Expand Down Expand Up @@ -2019,7 +2019,7 @@ impl<'a> Resolver<'a> {
path, opt_ns, record_used, path_span, crate_lint,
);

for (i, &Segment { ident, id, has_args: _ }) in path.iter().enumerate() {
for (i, &Segment { ident, id, has_generic_args: _ }) in path.iter().enumerate() {
debug!("resolve_path ident {} {:?} {:?}", i, ident, id);
let record_segment_res = |this: &mut Self, res| {
if record_used {
Expand Down

0 comments on commit 8d1a380

Please sign in to comment.