Fix rebase
This commit is contained in:
parent
139d109241
commit
38025e0dca
5 changed files with 18 additions and 16 deletions
|
|
@ -126,7 +126,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
parent_prefix, use_tree, nested);
|
||||
|
||||
let mut prefix_iter = parent_prefix.iter().cloned()
|
||||
.chain(use_tree.prefix.segments.iter().map(|seg| seg.ident)).peekable();
|
||||
.chain(use_tree.prefix.segments.iter().map(|seg| seg.into())).peekable();
|
||||
|
||||
// On 2015 edition imports are resolved as crate-relative by default,
|
||||
// so prefixes are prepended with crate root segment if necessary.
|
||||
|
|
@ -134,8 +134,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
// appears, so imports in braced groups can have roots prepended independently.
|
||||
let is_glob = if let ast::UseTreeKind::Glob = use_tree.kind { true } else { false };
|
||||
let crate_root = if !self.session.rust_2018() &&
|
||||
prefix_iter.peek().map_or(is_glob, |ident| !ident.is_path_segment_keyword()) {
|
||||
Some(Ident::new(keywords::CrateRoot.name(), use_tree.prefix.span.shrink_to_lo()))
|
||||
prefix_iter.peek().map_or(is_glob, |seg| !seg.ident.is_path_segment_keyword()) {
|
||||
Some(Segment::from_ident(Ident::new(
|
||||
keywords::CrateRoot.name(), use_tree.prefix.span.shrink_to_lo()
|
||||
)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
use {CrateLint, PathResult, Segment};
|
||||
use macros::ParentScope;
|
||||
|
||||
use syntax::ast::Ident;
|
||||
use syntax::symbol::keywords;
|
||||
use syntax_pos::Span;
|
||||
|
||||
|
|
@ -31,12 +30,12 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
|
|||
match (path.get(0), path.get(1)) {
|
||||
// `{{root}}::ident::...` on both editions.
|
||||
// On 2015 `{{root}}` is usually added implicitly.
|
||||
(Some(fst), Some(snd)) if fst.name == keywords::CrateRoot.name() &&
|
||||
!snd.is_path_segment_keyword() => {}
|
||||
(Some(fst), Some(snd)) if fst.ident.name == keywords::CrateRoot.name() &&
|
||||
!snd.ident.is_path_segment_keyword() => {}
|
||||
// `ident::...` on 2018
|
||||
(Some(fst), _) if self.session.rust_2018() && !fst.is_path_segment_keyword() => {
|
||||
(Some(fst), _) if self.session.rust_2018() && !fst.ident.is_path_segment_keyword() => {
|
||||
// Insert a placeholder that's later replaced by `self`/`super`/etc.
|
||||
path.insert(0, keywords::Invalid.ident());
|
||||
path.insert(0, Segment::from_ident(keywords::Invalid.ident()));
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1747,8 +1747,8 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
|||
let segments = &path.segments;
|
||||
let path = Segment::from_path(&path);
|
||||
// FIXME (Manishearth): Intra doc links won't get warned of epoch changes
|
||||
match self.resolve_path_without_parent_scope(&path, Some(namespace), true, span,
|
||||
CrateLint::No) {
|
||||
let def = match self.resolve_path_without_parent_scope(&path, Some(namespace), true,
|
||||
span, CrateLint::No) {
|
||||
PathResult::Module(ModuleOrUniformRoot::Module(module)) =>
|
||||
module.def().unwrap(),
|
||||
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 =>
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
use {AmbiguityError, AmbiguityKind, AmbiguityErrorMisc};
|
||||
use {CrateLint, Resolver, ResolutionError, Weak};
|
||||
use {CrateLint, Resolver, ResolutionError, Segment, Weak};
|
||||
use {Module, ModuleKind, NameBinding, NameBindingKind, PathResult, ToNameBinding};
|
||||
use {is_known_tool, names_to_string, resolve_error};
|
||||
use {is_known_tool, resolve_error};
|
||||
use ModuleOrUniformRoot;
|
||||
use Namespace::{self, *};
|
||||
use build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport};
|
||||
|
|
@ -946,7 +946,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
pub fn finalize_current_module_macro_resolutions(&mut self) {
|
||||
let module = self.current_module;
|
||||
|
||||
let check_consistency = |this: &mut Self, path: &[Ident], span,
|
||||
let check_consistency = |this: &mut Self, path: &[Segment], span,
|
||||
kind: MacroKind, initial_def, def| {
|
||||
if let Some(initial_def) = initial_def {
|
||||
if def != initial_def && def != Def::Err && this.ambiguity_errors.is_empty() {
|
||||
|
|
@ -965,7 +965,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
// less informative error if the privacy error is reported elsewhere.
|
||||
if this.privacy_errors.is_empty() {
|
||||
let msg = format!("cannot determine resolution for the {} `{}`",
|
||||
kind.descr(), names_to_string(path));
|
||||
kind.descr(), Segment::names_to_string(path));
|
||||
let msg_note = "import resolution is stuck, try simplifying macro imports";
|
||||
this.session.struct_span_err(span, &msg).note(msg_note).emit();
|
||||
}
|
||||
|
|
@ -1007,7 +1007,8 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
initial_binding.def_ignoring_ambiguity()
|
||||
});
|
||||
let def = binding.def_ignoring_ambiguity();
|
||||
check_consistency(self, &[ident], ident.span, kind, initial_def, def);
|
||||
let seg = Segment::from_ident(ident);
|
||||
check_consistency(self, &[seg], ident.span, kind, initial_def, def);
|
||||
}
|
||||
Err(..) => {
|
||||
assert!(initial_binding.is_none());
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ error[E0432]: unresolved import `non_existent`
|
|||
--> $DIR/issue-55457.rs:2:5
|
||||
|
|
||||
LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent`
|
||||
| ^^^^^^^^^^^^ Maybe a missing `extern crate non_existent;`?
|
||||
| ^^^^^^^^^^^^ maybe a missing `extern crate non_existent;`?
|
||||
|
||||
error: cannot determine resolution for the derive macro `NonExistent`
|
||||
--> $DIR/issue-55457.rs:5:10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue