about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-11-18 14:41:06 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-11-18 14:41:06 +0300
commit38025e0dca8c2f049884eedc58792c4e321ed27c (patch)
tree263d1b8279178dbb225250157e9a50b8f583cf07
parent139d10924112b7cb1b681e1e30af3384f6da89e5 (diff)
downloadrust-38025e0dca8c2f049884eedc58792c4e321ed27c.tar.gz
rust-38025e0dca8c2f049884eedc58792c4e321ed27c.zip
Fix rebase
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs8
-rw-r--r--src/librustc_resolve/error_reporting.rs9
-rw-r--r--src/librustc_resolve/lib.rs4
-rw-r--r--src/librustc_resolve/macros.rs11
-rw-r--r--src/test/ui/imports/issue-55457.stderr2
5 files changed, 18 insertions, 16 deletions
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index bbbeb369844..72fe7355e4c 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -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
         };
diff --git a/src/librustc_resolve/error_reporting.rs b/src/librustc_resolve/error_reporting.rs
index 509040ff267..263d23d133e 100644
--- a/src/librustc_resolve/error_reporting.rs
+++ b/src/librustc_resolve/error_reporting.rs
@@ -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,
         }
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index a9044b90b00..7b2d1d4a3d5 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -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 =>
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 0ea0ff16347..921f7568b52 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -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());
diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr
index 363dec06237..4ee0332d04b 100644
--- a/src/test/ui/imports/issue-55457.stderr
+++ b/src/test/ui/imports/issue-55457.stderr
@@ -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