more reviewer changes
This commit is contained in:
parent
63ac2aae51
commit
6dd5bb18d7
3 changed files with 8 additions and 16 deletions
|
@ -147,7 +147,6 @@ pub trait Resolver {
|
||||||
fn resolve_hir_path(
|
fn resolve_hir_path(
|
||||||
&mut self,
|
&mut self,
|
||||||
path: &ast::Path,
|
path: &ast::Path,
|
||||||
args: Option<P<hir::GenericArgs>>,
|
|
||||||
is_value: bool,
|
is_value: bool,
|
||||||
) -> hir::Path;
|
) -> hir::Path;
|
||||||
|
|
||||||
|
@ -168,7 +167,6 @@ pub trait Resolver {
|
||||||
span: Span,
|
span: Span,
|
||||||
crate_root: Option<&str>,
|
crate_root: Option<&str>,
|
||||||
components: &[&str],
|
components: &[&str],
|
||||||
args: Option<P<hir::GenericArgs>>,
|
|
||||||
is_value: bool,
|
is_value: bool,
|
||||||
) -> hir::Path;
|
) -> hir::Path;
|
||||||
}
|
}
|
||||||
|
@ -4856,7 +4854,9 @@ impl<'a> LoweringContext<'a> {
|
||||||
is_value: bool
|
is_value: bool
|
||||||
) -> hir::Path {
|
) -> hir::Path {
|
||||||
let mut path = self.resolver
|
let mut path = self.resolver
|
||||||
.resolve_str_path(span, self.crate_root, components, params, is_value);
|
.resolve_str_path(span, self.crate_root, components, is_value);
|
||||||
|
path.segments.last_mut().unwrap().args = params;
|
||||||
|
|
||||||
|
|
||||||
for seg in path.segments.iter_mut() {
|
for seg in path.segments.iter_mut() {
|
||||||
if let Some(id) = seg.id {
|
if let Some(id) = seg.id {
|
||||||
|
|
|
@ -1574,10 +1574,9 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
|
||||||
fn resolve_hir_path(
|
fn resolve_hir_path(
|
||||||
&mut self,
|
&mut self,
|
||||||
path: &ast::Path,
|
path: &ast::Path,
|
||||||
args: Option<P<hir::GenericArgs>>,
|
|
||||||
is_value: bool,
|
is_value: bool,
|
||||||
) -> hir::Path {
|
) -> hir::Path {
|
||||||
self.resolve_hir_path_cb(path, args, is_value,
|
self.resolve_hir_path_cb(path, is_value,
|
||||||
|resolver, span, error| resolve_error(resolver, span, error))
|
|resolver, span, error| resolve_error(resolver, span, error))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1586,7 +1585,6 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
|
||||||
span: Span,
|
span: Span,
|
||||||
crate_root: Option<&str>,
|
crate_root: Option<&str>,
|
||||||
components: &[&str],
|
components: &[&str],
|
||||||
args: Option<P<hir::GenericArgs>>,
|
|
||||||
is_value: bool
|
is_value: bool
|
||||||
) -> hir::Path {
|
) -> hir::Path {
|
||||||
let segments = iter::once(keywords::CrateRoot.ident())
|
let segments = iter::once(keywords::CrateRoot.ident())
|
||||||
|
@ -1602,7 +1600,7 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
|
||||||
segments,
|
segments,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.resolve_hir_path(&path, args, is_value)
|
self.resolve_hir_path(&path, is_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_resolution(&mut self, id: NodeId) -> Option<PathResolution> {
|
fn get_resolution(&mut self, id: NodeId) -> Option<PathResolution> {
|
||||||
|
@ -1648,7 +1646,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let path = self.resolve_hir_path_cb(&path, None, is_value, |_, _, _| errored = true);
|
let path = self.resolve_hir_path_cb(&path, is_value, |_, _, _| errored = true);
|
||||||
if errored || path.def == Def::Err {
|
if errored || path.def == Def::Err {
|
||||||
Err(())
|
Err(())
|
||||||
} else {
|
} else {
|
||||||
|
@ -1660,7 +1658,6 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||||
fn resolve_hir_path_cb<F>(
|
fn resolve_hir_path_cb<F>(
|
||||||
&mut self,
|
&mut self,
|
||||||
path: &ast::Path,
|
path: &ast::Path,
|
||||||
args: Option<P<hir::GenericArgs>>,
|
|
||||||
is_value: bool,
|
is_value: bool,
|
||||||
error_callback: F,
|
error_callback: F,
|
||||||
) -> hir::Path
|
) -> hir::Path
|
||||||
|
@ -1697,12 +1694,11 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut segments: Vec<_> = segments.iter().map(|seg| {
|
let segments: Vec<_> = segments.iter().map(|seg| {
|
||||||
let mut hir_seg = hir::PathSegment::from_ident(seg.ident);
|
let mut hir_seg = hir::PathSegment::from_ident(seg.ident);
|
||||||
hir_seg.def = Some(self.def_map.get(&seg.id).map_or(Def::Err, |p| p.base_def()));
|
hir_seg.def = Some(self.def_map.get(&seg.id).map_or(Def::Err, |p| p.base_def()));
|
||||||
hir_seg
|
hir_seg
|
||||||
}).collect();
|
}).collect();
|
||||||
segments.last_mut().unwrap().args = args;
|
|
||||||
hir::Path {
|
hir::Path {
|
||||||
span,
|
span,
|
||||||
def,
|
def,
|
||||||
|
|
|
@ -145,11 +145,7 @@ impl PathSegment {
|
||||||
PathSegment { ident, id: DUMMY_NODE_ID, args: None }
|
PathSegment { ident, id: DUMMY_NODE_ID, args: None }
|
||||||
}
|
}
|
||||||
pub fn crate_root(span: Span) -> Self {
|
pub fn crate_root(span: Span) -> Self {
|
||||||
PathSegment {
|
PathSegment::from_ident(Ident::new(keywords::CrateRoot.name(), span))
|
||||||
ident: Ident::new(keywords::CrateRoot.name(), span),
|
|
||||||
id: DUMMY_NODE_ID,
|
|
||||||
args: None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue