From 368ac73c11662dbb860db178dc170768078b282d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 22 Dec 2019 18:33:14 +0100 Subject: [PATCH 01/17] no longer promote non-pattern const functions --- src/libcore/time.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libcore/time.rs b/src/libcore/time.rs index c1d405239f96f..2ece2150e6bed 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -172,7 +172,6 @@ impl Duration { /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] - #[rustc_promotable] #[rustc_const_stable(feature = "duration_consts", since = "1.32.0")] pub const fn from_millis(millis: u64) -> Duration { Duration { @@ -195,7 +194,6 @@ impl Duration { /// ``` #[stable(feature = "duration_from_micros", since = "1.27.0")] #[inline] - #[rustc_promotable] #[rustc_const_stable(feature = "duration_consts", since = "1.32.0")] pub const fn from_micros(micros: u64) -> Duration { Duration { @@ -218,7 +216,6 @@ impl Duration { /// ``` #[stable(feature = "duration_extras", since = "1.27.0")] #[inline] - #[rustc_promotable] #[rustc_const_stable(feature = "duration_consts", since = "1.32.0")] pub const fn from_nanos(nanos: u64) -> Duration { Duration { From 8d189ed2f1db856adc9745099d078d46fe54a087 Mon Sep 17 00:00:00 2001 From: Janusz Marcinkiewicz Date: Sat, 30 Nov 2019 18:59:51 +0100 Subject: [PATCH 02/17] Suggest calling method when first argument is `self` --- src/doc/rustc-guide | 2 +- src/librustc_resolve/build_reduced_graph.rs | 10 +++---- src/librustc_resolve/late.rs | 2 +- src/librustc_resolve/late/diagnostics.rs | 31 +++++++++++++++++++++ src/test/ui/self/suggest-self-2.rs | 22 +++++++++++++++ src/test/ui/self/suggest-self-2.stderr | 28 +++++++++++++++++++ 6 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 src/test/ui/self/suggest-self-2.rs create mode 100644 src/test/ui/self/suggest-self-2.stderr diff --git a/src/doc/rustc-guide b/src/doc/rustc-guide index 7c56708aab798..934380b7cfcea 160000 --- a/src/doc/rustc-guide +++ b/src/doc/rustc-guide @@ -1 +1 @@ -Subproject commit 7c56708aab7986ca390221e8e8902f7de7f9b076 +Subproject commit 934380b7cfceaaa4e1b9bb0de4a372f32725520b diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index fed4202d96103..c356a7e31b177 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -759,8 +759,8 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { // These items live in both the type and value namespaces. ItemKind::Struct(ref vdata, _) => { // Define a name in the type namespace. - let def_id = self.r.definitions.local_def_id(item.id); - let res = Res::Def(DefKind::Struct, def_id); + let item_def_id = self.r.definitions.local_def_id(item.id); + let res = Res::Def(DefKind::Struct, item_def_id); self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion)); // Record field names for error reporting. @@ -798,12 +798,12 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { } ItemKind::Union(ref vdata, _) => { - let def_id = self.r.definitions.local_def_id(item.id); - let res = Res::Def(DefKind::Union, def_id); + let item_def_id = self.r.definitions.local_def_id(item.id); + let res = Res::Def(DefKind::Union, item_def_id); self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion)); // Record field names for error reporting. - self.insert_field_names_local(def_id, vdata); + self.insert_field_names_local(item_def_id, vdata); } ItemKind::Trait(..) => { diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 898ab6ae32211..dd1bef0c297a9 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -345,7 +345,7 @@ struct DiagnosticMetadata { /// The current self item if inside an ADT (used for better errors). current_self_item: Option, - /// The current enclosing funciton (used for better errors). + /// The current enclosing function (used for better errors). current_function: Option, /// A list of labels as of yet unused. Labels will be removed from this map when diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 6fb5c2f2de31f..e40c6fa708888 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -259,6 +259,37 @@ impl<'a> LateResolutionVisitor<'a, '_> { } return (err, candidates); } + + // Check if the first argument is `self` and suggest calling a method. + let mut has_self_arg = false; + if let PathSource::Expr(parent) = source { + match &parent.map(|p| &p.kind) { + Some(ExprKind::Call(_, args)) if args.len() > 0 => { + let mut expr_kind = &args.first().unwrap().kind; + loop { + match expr_kind { + ExprKind::Path(_, arg_name) if arg_name.segments.len() == 1 => { + has_self_arg = arg_name.segments[0].ident.name == kw::SelfLower; + break; + }, + ExprKind::AddrOf(_, _, expr) => { expr_kind = &expr.kind; } + _ => break, + } + } + } + _ => (), + } + }; + + if has_self_arg { + err.span_suggestion( + span, + &"try calling method instead of passing `self` as parameter", + format!("self.{}", path_str), + Applicability::MachineApplicable, + ); + return (err, candidates); + } } // Try Levenshtein algorithm. diff --git a/src/test/ui/self/suggest-self-2.rs b/src/test/ui/self/suggest-self-2.rs new file mode 100644 index 0000000000000..1926ebe4b8317 --- /dev/null +++ b/src/test/ui/self/suggest-self-2.rs @@ -0,0 +1,22 @@ +struct Foo {} + +impl Foo { + fn foo(&self) { + bar(self); + //~^ ERROR cannot find function `bar` in this scope + //~| HELP try calling method instead of passing `self` as parameter + + + bar(&self); + //~^ ERROR cannot find function `bar` in this scope + //~| HELP try calling method instead of passing `self` as parameter + + bar(); + //~^ ERROR cannot find function `bar` in this scope + + self.bar(); + //~^ ERROR no method named `bar` found for type + } +} + +fn main() {} diff --git a/src/test/ui/self/suggest-self-2.stderr b/src/test/ui/self/suggest-self-2.stderr new file mode 100644 index 0000000000000..84dbaa9637898 --- /dev/null +++ b/src/test/ui/self/suggest-self-2.stderr @@ -0,0 +1,28 @@ +error[E0425]: cannot find function `bar` in this scope + --> $DIR/suggest-self-2.rs:5:9 + | +LL | bar(self); + | ^^^ help: try calling method instead of passing `self` as parameter: `self.bar` + +error[E0425]: cannot find function `bar` in this scope + --> $DIR/suggest-self-2.rs:10:9 + | +LL | bar(&self); + | ^^^ help: try calling method instead of passing `self` as parameter: `self.bar` + +error[E0425]: cannot find function `bar` in this scope + --> $DIR/suggest-self-2.rs:14:9 + | +LL | bar(); + | ^^^ not found in this scope + +error[E0599]: no method named `bar` found for type `&Foo` in the current scope + --> $DIR/suggest-self-2.rs:17:14 + | +LL | self.bar(); + | ^^^ method not found in `&Foo` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0425, E0599. +For more information about an error, try `rustc --explain E0425`. From 8e5b2c80d3f30c9d83a8e921e78e6c10e54c8319 Mon Sep 17 00:00:00 2001 From: Janusz Marcinkiewicz Date: Mon, 9 Dec 2019 16:05:45 +0100 Subject: [PATCH 03/17] Add more detailed suggestion --- src/doc/rustc-guide | 2 +- src/librustc_resolve/build_reduced_graph.rs | 10 +++++----- src/librustc_resolve/late/diagnostics.rs | 6 +++--- src/test/ui/self/suggest-self-2.rs | 9 ++++++--- src/test/ui/self/suggest-self-2.stderr | 20 +++++++++++++------- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/doc/rustc-guide b/src/doc/rustc-guide index 934380b7cfcea..7c56708aab798 160000 --- a/src/doc/rustc-guide +++ b/src/doc/rustc-guide @@ -1 +1 @@ -Subproject commit 934380b7cfceaaa4e1b9bb0de4a372f32725520b +Subproject commit 7c56708aab7986ca390221e8e8902f7de7f9b076 diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index c356a7e31b177..fed4202d96103 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -759,8 +759,8 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { // These items live in both the type and value namespaces. ItemKind::Struct(ref vdata, _) => { // Define a name in the type namespace. - let item_def_id = self.r.definitions.local_def_id(item.id); - let res = Res::Def(DefKind::Struct, item_def_id); + let def_id = self.r.definitions.local_def_id(item.id); + let res = Res::Def(DefKind::Struct, def_id); self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion)); // Record field names for error reporting. @@ -798,12 +798,12 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { } ItemKind::Union(ref vdata, _) => { - let item_def_id = self.r.definitions.local_def_id(item.id); - let res = Res::Def(DefKind::Union, item_def_id); + let def_id = self.r.definitions.local_def_id(item.id); + let res = Res::Def(DefKind::Union, def_id); self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion)); // Record field names for error reporting. - self.insert_field_names_local(item_def_id, vdata); + self.insert_field_names_local(def_id, vdata); } ItemKind::Trait(..) => { diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index e40c6fa708888..cc6fbf840a454 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -265,14 +265,14 @@ impl<'a> LateResolutionVisitor<'a, '_> { if let PathSource::Expr(parent) = source { match &parent.map(|p| &p.kind) { Some(ExprKind::Call(_, args)) if args.len() > 0 => { - let mut expr_kind = &args.first().unwrap().kind; + let mut expr_kind = &args[0].kind; loop { match expr_kind { ExprKind::Path(_, arg_name) if arg_name.segments.len() == 1 => { has_self_arg = arg_name.segments[0].ident.name == kw::SelfLower; break; }, - ExprKind::AddrOf(_, _, expr) => { expr_kind = &expr.kind; } + ExprKind::AddrOf(_, _, expr) => expr_kind = &expr.kind, _ => break, } } @@ -284,7 +284,7 @@ impl<'a> LateResolutionVisitor<'a, '_> { if has_self_arg { err.span_suggestion( span, - &"try calling method instead of passing `self` as parameter", + &format!("try calling `{}` as a method", ident), format!("self.{}", path_str), Applicability::MachineApplicable, ); diff --git a/src/test/ui/self/suggest-self-2.rs b/src/test/ui/self/suggest-self-2.rs index 1926ebe4b8317..d6bf543352701 100644 --- a/src/test/ui/self/suggest-self-2.rs +++ b/src/test/ui/self/suggest-self-2.rs @@ -4,12 +4,15 @@ impl Foo { fn foo(&self) { bar(self); //~^ ERROR cannot find function `bar` in this scope - //~| HELP try calling method instead of passing `self` as parameter + //~| HELP try calling `bar` as a method + bar(&&self, 102); + //~^ ERROR cannot find function `bar` in this scope + //~| HELP try calling `bar` as a method - bar(&self); + bar(&mut self, 102, &"str"); //~^ ERROR cannot find function `bar` in this scope - //~| HELP try calling method instead of passing `self` as parameter + //~| HELP try calling `bar` as a method bar(); //~^ ERROR cannot find function `bar` in this scope diff --git a/src/test/ui/self/suggest-self-2.stderr b/src/test/ui/self/suggest-self-2.stderr index 84dbaa9637898..ba71498fae656 100644 --- a/src/test/ui/self/suggest-self-2.stderr +++ b/src/test/ui/self/suggest-self-2.stderr @@ -2,27 +2,33 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:5:9 | LL | bar(self); - | ^^^ help: try calling method instead of passing `self` as parameter: `self.bar` + | ^^^ help: try calling `bar` as a method: `self.bar` error[E0425]: cannot find function `bar` in this scope - --> $DIR/suggest-self-2.rs:10:9 + --> $DIR/suggest-self-2.rs:9:9 | -LL | bar(&self); - | ^^^ help: try calling method instead of passing `self` as parameter: `self.bar` +LL | bar(&&self, 102); + | ^^^ help: try calling `bar` as a method: `self.bar` error[E0425]: cannot find function `bar` in this scope - --> $DIR/suggest-self-2.rs:14:9 + --> $DIR/suggest-self-2.rs:13:9 + | +LL | bar(&mut self, 102, &"str"); + | ^^^ help: try calling `bar` as a method: `self.bar` + +error[E0425]: cannot find function `bar` in this scope + --> $DIR/suggest-self-2.rs:17:9 | LL | bar(); | ^^^ not found in this scope error[E0599]: no method named `bar` found for type `&Foo` in the current scope - --> $DIR/suggest-self-2.rs:17:14 + --> $DIR/suggest-self-2.rs:20:14 | LL | self.bar(); | ^^^ method not found in `&Foo` -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0425, E0599. For more information about an error, try `rustc --explain E0425`. From 091853946bc0f3e9138875bfe1952e857e601896 Mon Sep 17 00:00:00 2001 From: Janusz Marcinkiewicz Date: Sat, 21 Dec 2019 19:13:12 +0100 Subject: [PATCH 04/17] Add arguments to suggestion method call --- src/librustc_resolve/late/diagnostics.rs | 17 ++++++++++++++++- src/test/ui/self/suggest-self-2.stderr | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index cc6fbf840a454..43626d87d71d5 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -262,6 +262,7 @@ impl<'a> LateResolutionVisitor<'a, '_> { // Check if the first argument is `self` and suggest calling a method. let mut has_self_arg = false; + let mut args_span = None; if let PathSource::Expr(parent) = source { match &parent.map(|p| &p.kind) { Some(ExprKind::Call(_, args)) if args.len() > 0 => { @@ -270,6 +271,13 @@ impl<'a> LateResolutionVisitor<'a, '_> { match expr_kind { ExprKind::Path(_, arg_name) if arg_name.segments.len() == 1 => { has_self_arg = arg_name.segments[0].ident.name == kw::SelfLower; + if args.len() > 1 { + args_span = Some(Span::new( + args[1].span.lo(), + args.last().unwrap().span.hi(), + parent.unwrap().span.ctxt(), + )); + } break; }, ExprKind::AddrOf(_, _, expr) => expr_kind = &expr.kind, @@ -282,10 +290,17 @@ impl<'a> LateResolutionVisitor<'a, '_> { }; if has_self_arg { + let mut args_snippet: String = String::from(""); + if let Some(args_span) = args_span { + if let Ok(snippet) = self.r.session.source_map().span_to_snippet(args_span) { + args_snippet = snippet; + } + } + err.span_suggestion( span, &format!("try calling `{}` as a method", ident), - format!("self.{}", path_str), + format!("self.{}({})", path_str, args_snippet), Applicability::MachineApplicable, ); return (err, candidates); diff --git a/src/test/ui/self/suggest-self-2.stderr b/src/test/ui/self/suggest-self-2.stderr index ba71498fae656..6148012ac0d92 100644 --- a/src/test/ui/self/suggest-self-2.stderr +++ b/src/test/ui/self/suggest-self-2.stderr @@ -2,19 +2,19 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:5:9 | LL | bar(self); - | ^^^ help: try calling `bar` as a method: `self.bar` + | ^^^ help: try calling `bar` as a method: `self.bar()` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:9:9 | LL | bar(&&self, 102); - | ^^^ help: try calling `bar` as a method: `self.bar` + | ^^^ help: try calling `bar` as a method: `self.bar(102)` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:13:9 | LL | bar(&mut self, 102, &"str"); - | ^^^ help: try calling `bar` as a method: `self.bar` + | ^^^ help: try calling `bar` as a method: `self.bar(102, &"str")` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:17:9 From 7353afdfd9b992a0254b8c23592e91cde792d514 Mon Sep 17 00:00:00 2001 From: Janusz Marcinkiewicz Date: Sun, 22 Dec 2019 22:48:45 +0100 Subject: [PATCH 05/17] Extend suggestion span to whole method call --- src/librustc_resolve/late/diagnostics.rs | 26 ++++++++++++++---------- src/test/ui/self/suggest-self-2.stderr | 12 ++++++++--- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 43626d87d71d5..a1cbcac1a9a76 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -261,8 +261,7 @@ impl<'a> LateResolutionVisitor<'a, '_> { } // Check if the first argument is `self` and suggest calling a method. - let mut has_self_arg = false; - let mut args_span = None; + let mut has_self_arg = None; if let PathSource::Expr(parent) = source { match &parent.map(|p| &p.kind) { Some(ExprKind::Call(_, args)) if args.len() > 0 => { @@ -270,13 +269,18 @@ impl<'a> LateResolutionVisitor<'a, '_> { loop { match expr_kind { ExprKind::Path(_, arg_name) if arg_name.segments.len() == 1 => { - has_self_arg = arg_name.segments[0].ident.name == kw::SelfLower; - if args.len() > 1 { - args_span = Some(Span::new( - args[1].span.lo(), - args.last().unwrap().span.hi(), - parent.unwrap().span.ctxt(), - )); + if arg_name.segments[0].ident.name == kw::SelfLower { + let call_span = parent.unwrap().span; + let args_span = if args.len() > 1 { + Some(Span::new( + args[1].span.lo(), + args.last().unwrap().span.hi(), + call_span.ctxt(), + )) + } else { + None + }; + has_self_arg = Some((call_span, args_span)); } break; }, @@ -289,7 +293,7 @@ impl<'a> LateResolutionVisitor<'a, '_> { } }; - if has_self_arg { + if let Some((call_span, args_span)) = has_self_arg { let mut args_snippet: String = String::from(""); if let Some(args_span) = args_span { if let Ok(snippet) = self.r.session.source_map().span_to_snippet(args_span) { @@ -298,7 +302,7 @@ impl<'a> LateResolutionVisitor<'a, '_> { } err.span_suggestion( - span, + call_span, &format!("try calling `{}` as a method", ident), format!("self.{}({})", path_str, args_snippet), Applicability::MachineApplicable, diff --git a/src/test/ui/self/suggest-self-2.stderr b/src/test/ui/self/suggest-self-2.stderr index 6148012ac0d92..452c31275153a 100644 --- a/src/test/ui/self/suggest-self-2.stderr +++ b/src/test/ui/self/suggest-self-2.stderr @@ -2,19 +2,25 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:5:9 | LL | bar(self); - | ^^^ help: try calling `bar` as a method: `self.bar()` + | ^^^------ + | | + | help: try calling `bar` as a method: `self.bar()` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:9:9 | LL | bar(&&self, 102); - | ^^^ help: try calling `bar` as a method: `self.bar(102)` + | ^^^------------- + | | + | help: try calling `bar` as a method: `self.bar(102)` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:13:9 | LL | bar(&mut self, 102, &"str"); - | ^^^ help: try calling `bar` as a method: `self.bar(102, &"str")` + | ^^^------------------------ + | | + | help: try calling `bar` as a method: `self.bar(102, &"str")` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:17:9 From 2168c0b9791d55361177efa3bb7e79f7b944a423 Mon Sep 17 00:00:00 2001 From: Janusz Marcinkiewicz Date: Mon, 23 Dec 2019 11:56:34 +0100 Subject: [PATCH 06/17] Extract checking for self arg to separate method --- src/librustc_resolve/late/diagnostics.rs | 75 +++++++++++++----------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index a1cbcac1a9a76..904a4125f2f72 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -260,41 +260,9 @@ impl<'a> LateResolutionVisitor<'a, '_> { return (err, candidates); } - // Check if the first argument is `self` and suggest calling a method. - let mut has_self_arg = None; - if let PathSource::Expr(parent) = source { - match &parent.map(|p| &p.kind) { - Some(ExprKind::Call(_, args)) if args.len() > 0 => { - let mut expr_kind = &args[0].kind; - loop { - match expr_kind { - ExprKind::Path(_, arg_name) if arg_name.segments.len() == 1 => { - if arg_name.segments[0].ident.name == kw::SelfLower { - let call_span = parent.unwrap().span; - let args_span = if args.len() > 1 { - Some(Span::new( - args[1].span.lo(), - args.last().unwrap().span.hi(), - call_span.ctxt(), - )) - } else { - None - }; - has_self_arg = Some((call_span, args_span)); - } - break; - }, - ExprKind::AddrOf(_, _, expr) => expr_kind = &expr.kind, - _ => break, - } - } - } - _ => (), - } - }; - - if let Some((call_span, args_span)) = has_self_arg { - let mut args_snippet: String = String::from(""); + // If the first argument in call is `self` suggest calling a method. + if let Some((call_span, args_span)) = self.call_has_self_arg(source) { + let mut args_snippet = String::new(); if let Some(args_span) = args_span { if let Ok(snippet) = self.r.session.source_map().span_to_snippet(args_span) { args_snippet = snippet; @@ -348,6 +316,43 @@ impl<'a> LateResolutionVisitor<'a, '_> { (err, candidates) } + /// Check if the source is call expression and the first argument is `self`. If true, + /// return the span of whole call and the span for all arguments expect the first one (`self`). + fn call_has_self_arg(&self, source: PathSource<'_>) -> Option<(Span, Option)> { + let mut has_self_arg = None; + if let PathSource::Expr(parent) = source { + match &parent.map(|p| &p.kind) { + Some(ExprKind::Call(_, args)) if args.len() > 0 => { + let mut expr_kind = &args[0].kind; + loop { + match expr_kind { + ExprKind::Path(_, arg_name) if arg_name.segments.len() == 1 => { + if arg_name.segments[0].ident.name == kw::SelfLower { + let call_span = parent.unwrap().span; + let tail_args_span = if args.len() > 1 { + Some(Span::new( + args[1].span.lo(), + args.last().unwrap().span.hi(), + call_span.ctxt(), + )) + } else { + None + }; + has_self_arg = Some((call_span, tail_args_span)); + } + break; + } + ExprKind::AddrOf(_, _, expr) => expr_kind = &expr.kind, + _ => break, + } + } + } + _ => (), + } + }; + return has_self_arg; + } + fn followed_by_brace(&self, span: Span) -> (bool, Option<(Span, String)>) { // HACK(estebank): find a better way to figure out that this was a // parser issue where a struct literal is being used on an expression From 7b91ef8837cb5e926418aeb4a675313ba928c877 Mon Sep 17 00:00:00 2001 From: Janusz Marcinkiewicz Date: Mon, 23 Dec 2019 15:55:35 +0100 Subject: [PATCH 07/17] Simplify match expr --- src/librustc_resolve/late/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 904a4125f2f72..e3895e18d668d 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -321,8 +321,8 @@ impl<'a> LateResolutionVisitor<'a, '_> { fn call_has_self_arg(&self, source: PathSource<'_>) -> Option<(Span, Option)> { let mut has_self_arg = None; if let PathSource::Expr(parent) = source { - match &parent.map(|p| &p.kind) { - Some(ExprKind::Call(_, args)) if args.len() > 0 => { + match &parent?.kind { + ExprKind::Call(_, args) if args.len() > 0 => { let mut expr_kind = &args[0].kind; loop { match expr_kind { From cfab634972137e4625d3e7b7fb91b51d3f2d4cd4 Mon Sep 17 00:00:00 2001 From: Michal Terepeta Date: Wed, 1 Jan 2020 12:39:13 +0100 Subject: [PATCH 08/17] Add a test for #37333 The test checks that we reuse the CGU of a crate when the implementation details of an `extern crate` have changed. Signed-off-by: Michal Terepeta --- .../auxiliary/a.rs | 31 +++++++++++++++++++ .../change_implementation_cross_crate/main.rs | 20 ++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/test/incremental/change_implementation_cross_crate/auxiliary/a.rs create mode 100644 src/test/incremental/change_implementation_cross_crate/main.rs diff --git a/src/test/incremental/change_implementation_cross_crate/auxiliary/a.rs b/src/test/incremental/change_implementation_cross_crate/auxiliary/a.rs new file mode 100644 index 0000000000000..7320a97b9979a --- /dev/null +++ b/src/test/incremental/change_implementation_cross_crate/auxiliary/a.rs @@ -0,0 +1,31 @@ +#![allow(warnings)] +#![crate_name = "a"] +#![crate_type = "rlib"] + +#[cfg(rpass1)] +#[inline(never)] +pub fn foo(b: u8) -> u32 { + b as u32 +} + +#[cfg(rpass2)] +#[inline(never)] +pub fn foo(b: u8) -> u32 { + (b + 42) as u32 +} + +pub fn bar(b: u8) -> u32 { + bar_impl(b) as u32 +} + +#[cfg(rpass1)] +#[inline(never)] +fn bar_impl(b: u8) -> u16 { + b as u16 +} + +#[cfg(rpass2)] +#[inline(never)] +fn bar_impl(b: u8) -> u32 { + (b + 42) as u32 +} diff --git a/src/test/incremental/change_implementation_cross_crate/main.rs b/src/test/incremental/change_implementation_cross_crate/main.rs new file mode 100644 index 0000000000000..dee9ebd74a89f --- /dev/null +++ b/src/test/incremental/change_implementation_cross_crate/main.rs @@ -0,0 +1,20 @@ +// Test that we are able to reuse `main` despite the changes in the implementation of `foo` and +// `bar`. + +// revisions: rpass1 rpass2 +// aux-build: a.rs +// compile-flags: -Zquery-dep-graph + +#![feature(rustc_attrs)] +#![crate_type = "bin"] +#![rustc_partition_reused(module = "main", cfg = "rpass2")] + +extern crate a; + +pub fn main() { + let vec: Vec = vec![0, 1, 2, 3]; + for b in vec { + println!("{}", a::foo(b)); + println!("{}", a::bar(b)); + } +} From 23f543162a40d34cd9c3f53de48b58e4088a82c2 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Wed, 1 Jan 2020 23:46:25 +0000 Subject: [PATCH 09/17] Cleanup linkchecker whitelist linkchecker is no longer run on the compiler docs so they can be removed from the whitelist. --- src/tools/linkchecker/main.rs | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 558913d84adaa..fb4611ed1ca4b 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -122,33 +122,22 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti // Unfortunately we're not 100% full of valid links today to we need a few // whitelists to get this past `make check` today. // FIXME(#32129) - if file.ends_with("std/string/struct.String.html") - || file.ends_with("interpret/struct.ImmTy.html") - || file.ends_with("ast/struct.ThinVec.html") - || file.ends_with("util/struct.ThinVec.html") - || file.ends_with("layout/struct.TyLayout.html") - || file.ends_with("humantime/struct.Timestamp.html") - || file.ends_with("log/index.html") - || file.ends_with("ty/struct.Slice.html") - || file.ends_with("ty/enum.Attributes.html") - || file.ends_with("ty/struct.SymbolName.html") - || file.ends_with("io/struct.IoSlice.html") - || file.ends_with("io/struct.IoSliceMut.html") + if file.ends_with("std/io/struct.IoSlice.html") + || file.ends_with("std/string/struct.String.html") { return None; } // FIXME(#32553) - if file.ends_with("string/struct.String.html") { + if file.ends_with("alloc/string/struct.String.html") { return None; } // FIXME(#32130) - if file.ends_with("btree_set/struct.BTreeSet.html") - || file.ends_with("struct.BTreeSet.html") - || file.ends_with("btree_map/struct.BTreeMap.html") - || file.ends_with("hash_map/struct.HashMap.html") - || file.ends_with("hash_set/struct.HashSet.html") - || file.ends_with("sync/struct.Lrc.html") - || file.ends_with("sync/struct.RwLock.html") + if file.ends_with("alloc/collections/btree_map/struct.BTreeMap.html") + || file.ends_with("alloc/collections/btree_set/struct.BTreeSet.html") + || file.ends_with("std/collections/btree_map/struct.BTreeMap.html") + || file.ends_with("std/collections/btree_set/struct.BTreeSet.html") + || file.ends_with("std/collections/hash_map/struct.HashMap.html") + || file.ends_with("std/collections/hash_set/struct.HashSet.html") { return None; } From 75e4783f63fc7a788d8dff47504b29dcd63d97fe Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 1 Jan 2020 19:25:28 +0100 Subject: [PATCH 10/17] Normalize `syntax::source_map` imports. --- src/librustc/hir/map/collector.rs | 2 +- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/print.rs | 2 +- src/librustc/ich/hcx.rs | 2 +- src/librustc/infer/canonical/mod.rs | 2 +- .../infer/error_reporting/need_type_info.rs | 2 +- .../error_reporting/nice_region_error/mod.rs | 2 +- src/librustc/lint/builtin.rs | 2 +- src/librustc/lint/levels.rs | 2 +- src/librustc/lint/mod.rs | 2 +- src/librustc/mir/mono.rs | 2 +- src/librustc/traits/query/dropck_outlives.rs | 2 +- src/librustc/traits/query/outlives_bounds.rs | 2 +- src/librustc/traits/query/type_op/custom.rs | 2 +- src/librustc/ty/context.rs | 2 +- src/librustc/ty/query/on_disk_cache.rs | 2 +- src/librustc/ty/query/plumbing.rs | 2 +- .../deriving/generic/mod.rs | 2 +- .../deriving/generic/ty.rs | 2 +- src/librustc_builtin_macros/global_asm.rs | 2 +- src/librustc_builtin_macros/test.rs | 2 +- src/librustc_builtin_macros/test_harness.rs | 2 +- src/librustc_codegen_llvm/context.rs | 2 +- src/librustc_codegen_ssa/mir/block.rs | 17 ++++++++--------- src/librustc_codegen_ssa/mir/constant.rs | 2 +- src/librustc_codegen_ssa/mir/rvalue.rs | 2 +- src/librustc_expand/base.rs | 2 +- src/librustc_expand/build.rs | 2 +- src/librustc_expand/expand.rs | 4 ++-- src/librustc_expand/parse/lexer/tests.rs | 2 +- src/librustc_expand/parse/tests.rs | 2 +- src/librustc_expand/placeholders.rs | 2 +- src/librustc_expand/tests.rs | 2 +- src/librustc_interface/interface.rs | 2 +- src/librustc_interface/util.rs | 2 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_lint/types.rs | 18 +++++++----------- src/librustc_metadata/native_libs.rs | 2 +- src/librustc_metadata/rmeta/decoder.rs | 2 +- .../rmeta/decoder/cstore_impl.rs | 4 ++-- src/librustc_metadata/rmeta/encoder.rs | 2 +- .../diagnostics/conflict_errors.rs | 2 +- .../borrow_check/diagnostics/var_name.rs | 2 +- src/librustc_mir/const_eval.rs | 3 +-- src/librustc_mir/const_eval/eval_queries.rs | 2 +- src/librustc_mir/const_eval/machine.rs | 2 +- src/librustc_mir/interpret/eval_context.rs | 2 +- src/librustc_mir/interpret/snapshot.rs | 2 +- src/librustc_mir/interpret/terminator.rs | 2 +- src/librustc_parse/parser/generics.rs | 2 +- src/librustc_passes/ast_validation.rs | 2 +- src/librustc_passes/region.rs | 2 +- src/librustc_resolve/build_reduced_graph.rs | 2 +- src/librustc_resolve/diagnostics.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_save_analysis/dump_visitor.rs | 2 +- src/librustc_save_analysis/lib.rs | 2 +- src/librustc_traits/dropck_outlives.rs | 2 +- src/librustc_traits/evaluate_obligation.rs | 2 +- .../implied_outlives_bounds.rs | 2 +- src/librustc_typeck/check/closure.rs | 2 +- src/librustc_typeck/check/expr.rs | 2 +- src/librustc_typeck/check/method/suggest.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 2 +- .../constrained_generic_params.rs | 2 +- src/librustdoc/clean/types.rs | 2 +- src/librustdoc/core.rs | 2 +- src/librustdoc/html/highlight.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/librustdoc/html/render/cache.rs | 2 +- src/librustdoc/html/sources.rs | 2 +- src/librustdoc/markdown.rs | 2 +- .../passes/check_code_block_syntax.rs | 2 +- src/librustdoc/test.rs | 5 +++-- src/librustdoc/visit_ast.rs | 2 +- src/libsyntax/ast.rs | 7 +++---- src/libsyntax/attr/mod.rs | 2 +- src/libsyntax/feature_gate/check.rs | 19 +++++++++---------- src/libsyntax/lib.rs | 3 +-- src/libsyntax/mut_visit.rs | 6 +++--- src/libsyntax/print/pprust.rs | 7 +++---- src/libsyntax/print/pprust/tests.rs | 6 +++--- src/libsyntax/util/comments.rs | 2 +- 83 files changed, 117 insertions(+), 126 deletions(-) diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index c1fe1bec342ff..00026d6969bb5 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -11,10 +11,10 @@ use crate::session::Session; use crate::util::nodemap::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_index::vec::IndexVec; +use rustc_span::source_map::SourceMap; use rustc_span::Span; use std::iter::repeat; use syntax::ast::NodeId; -use syntax::source_map::SourceMap; use crate::ich::StableHashingContext; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 7445f35dd21ad..9ea10d0c51591 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -17,10 +17,10 @@ use crate::util::nodemap::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_index::vec::IndexVec; use rustc_span::hygiene::MacroKind; +use rustc_span::source_map::Spanned; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; use syntax::ast::{self, Name, NodeId}; -use syntax::source_map::Spanned; pub mod blocks; mod collector; diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 7cc57ed7528a3..10b8b5fe39047 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -1,3 +1,4 @@ +use rustc_span::source_map::{SourceMap, Spanned}; use rustc_span::{self, BytePos, FileName}; use rustc_target::spec::abi::Abi; use syntax::ast; @@ -5,7 +6,6 @@ use syntax::print::pp::Breaks::{Consistent, Inconsistent}; use syntax::print::pp::{self, Breaks}; use syntax::print::pprust::{self, Comments, PrintState}; use syntax::sess::ParseSess; -use syntax::source_map::{SourceMap, Spanned}; use syntax::symbol::kw; use syntax::util::parser::{self, AssocOp, Fixity}; diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 305b6058d3466..2c314e6935ffa 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -9,9 +9,9 @@ use crate::ty::{fast_reject, TyCtxt}; use std::cmp::Ord; +use rustc_span::source_map::SourceMap; use rustc_span::{BytePos, SourceFile}; use syntax::ast; -use syntax::source_map::SourceMap; use syntax::symbol::Symbol; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index f6a716a120469..a588d3d028a2c 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -30,9 +30,9 @@ use crate::ty::{self, BoundVar, List, Region, TyCtxt}; use rustc_index::vec::IndexVec; use rustc_macros::HashStable; use rustc_serialize::UseSpecializedDecodable; +use rustc_span::source_map::Span; use smallvec::SmallVec; use std::ops::Index; -use syntax::source_map::Span; mod canonicalizer; diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index a94595b227b2e..41a492751e754 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -6,9 +6,9 @@ use crate::infer::InferCtxt; use crate::ty::print::Print; use crate::ty::{self, DefIdTree, Infer, Ty, TyVar}; use errors::{Applicability, DiagnosticBuilder}; +use rustc_span::source_map::DesugaringKind; use rustc_span::Span; use std::borrow::Cow; -use syntax::source_map::DesugaringKind; use syntax::symbol::kw; use rustc_error_codes::*; diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs index 023d9f89b039c..5da65a3019395 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -4,7 +4,7 @@ use crate::infer::InferCtxt; use crate::ty::{self, TyCtxt}; use crate::util::common::ErrorReported; use errors::DiagnosticBuilder; -use syntax::source_map::Span; +use rustc_span::source_map::Span; mod different_lifetimes; mod find_anon_type; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index fa6e93d867b4e..bdc2b216449cd 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -9,10 +9,10 @@ use crate::middle::stability; use crate::session::Session; use errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc_session::declare_lint; +use rustc_span::source_map::Span; use syntax::ast; use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE}; use syntax::edition::Edition; -use syntax::source_map::Span; use syntax::symbol::Symbol; declare_lint! { diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index edf7df16c87fa..86e6bfb597913 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -9,11 +9,11 @@ use crate::session::Session; use crate::util::nodemap::FxHashMap; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_span::source_map::MultiSpan; use syntax::ast; use syntax::attr; use syntax::feature_gate; use syntax::print::pprust; -use syntax::source_map::MultiSpan; use syntax::symbol::{sym, Symbol}; use rustc_error_codes::*; diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 7e433f50db208..0286a174c681b 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -33,9 +33,9 @@ use crate::ty::TyCtxt; use crate::util::nodemap::NodeMap; use errors::{DiagnosticBuilder, DiagnosticId}; use rustc_span::hygiene::MacroKind; +use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan}; use rustc_span::Span; use syntax::ast; -use syntax::source_map::{DesugaringKind, ExpnKind, MultiSpan}; use syntax::symbol::Symbol; pub use crate::lint::context::{ diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index b13b4fd3b8d37..bf5cc58b118a0 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -8,10 +8,10 @@ use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt use crate::util::nodemap::FxHashMap; use rustc_data_structures::base_n; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_span::source_map::Span; use std::fmt; use std::hash::Hash; use syntax::attr::InlineAttr; -use syntax::source_map::Span; use syntax::symbol::Symbol; /// Describes how a monomorphization will be instantiated in object files. diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 80a82021c9a34..87f7f674dab10 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -3,8 +3,8 @@ use crate::infer::canonical::OriginalQueryValues; use crate::infer::InferOk; use crate::ty::subst::GenericArg; use crate::ty::{self, Ty, TyCtxt}; +use rustc_span::source_map::Span; use std::iter::FromIterator; -use syntax::source_map::Span; use rustc_error_codes::*; diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs index 722bd0bca6a5b..6a0bc167c078e 100644 --- a/src/librustc/traits/query/outlives_bounds.rs +++ b/src/librustc/traits/query/outlives_bounds.rs @@ -4,7 +4,7 @@ use crate::infer::InferCtxt; use crate::traits::query::NoSolution; use crate::traits::{FulfillmentContext, ObligationCause, TraitEngine, TraitEngineExt}; use crate::ty::{self, Ty}; -use syntax::source_map::Span; +use rustc_span::source_map::Span; use crate::ich::StableHashingContext; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/traits/query/type_op/custom.rs b/src/librustc/traits/query/type_op/custom.rs index 3ca6636c1dea6..c1c9030b88805 100644 --- a/src/librustc/traits/query/type_op/custom.rs +++ b/src/librustc/traits/query/type_op/custom.rs @@ -5,8 +5,8 @@ use std::fmt; use crate::infer::canonical::query_response; use crate::infer::canonical::QueryRegionConstraints; use crate::traits::{ObligationCause, TraitEngine, TraitEngineExt}; +use rustc_span::source_map::DUMMY_SP; use std::rc::Rc; -use syntax::source_map::DUMMY_SP; pub struct CustomTypeOp { closure: F, diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d83a720170b03..d1296bb1791e7 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -59,6 +59,7 @@ use rustc_data_structures::stable_hasher::{ use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal}; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; +use rustc_span::source_map::MultiSpan; use rustc_span::Span; use rustc_target::spec::abi; use smallvec::SmallVec; @@ -75,7 +76,6 @@ use std::sync::Arc; use syntax::ast; use syntax::attr; use syntax::expand::allocator::AllocatorKind; -use syntax::source_map::MultiSpan; use syntax::symbol::{kw, sym, Symbol}; pub struct AllArenas { diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index a432f43d13303..c29c68d2148af 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -21,10 +21,10 @@ use rustc_serialize::{ UseSpecializedDecodable, UseSpecializedEncodable, }; use rustc_span::hygiene::{ExpnId, SyntaxContext}; +use rustc_span::source_map::{SourceMap, StableSourceFileId}; use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP}; use std::mem; use syntax::ast::{Ident, NodeId}; -use syntax::source_map::{SourceMap, StableSourceFileId}; const TAG_FILE_FOOTER: u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE; diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 0642de8c744c2..e56955b0e4441 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -20,12 +20,12 @@ use rustc_data_structures::fx::{FxHashMap, FxHasher}; use rustc_data_structures::sharded::Sharded; use rustc_data_structures::sync::{Lock, Lrc}; use rustc_data_structures::thin_vec::ThinVec; +use rustc_span::source_map::DUMMY_SP; use rustc_span::Span; use std::collections::hash_map::Entry; use std::hash::{Hash, Hasher}; use std::mem; use std::ptr; -use syntax::source_map::DUMMY_SP; use rustc_error_codes::*; diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs index da81e52fb6954..44b30118f5abe 100644 --- a/src/librustc_builtin_macros/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -182,13 +182,13 @@ use std::iter; use std::vec; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::source_map::respan; use rustc_span::Span; use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind}; use syntax::ast::{GenericArg, GenericParamKind, VariantData}; use syntax::attr; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::source_map::respan; use syntax::symbol::{kw, sym, Symbol}; use syntax::util::map_in_place::MapInPlace; diff --git a/src/librustc_builtin_macros/deriving/generic/ty.rs b/src/librustc_builtin_macros/deriving/generic/ty.rs index 4597bfe3d1cbb..d2df64cac4869 100644 --- a/src/librustc_builtin_macros/deriving/generic/ty.rs +++ b/src/librustc_builtin_macros/deriving/generic/ty.rs @@ -5,11 +5,11 @@ pub use PtrTy::*; pub use Ty::*; use rustc_expand::base::ExtCtxt; +use rustc_span::source_map::{respan, DUMMY_SP}; use rustc_span::symbol::kw; use rustc_span::Span; use syntax::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind}; use syntax::ptr::P; -use syntax::source_map::{respan, DUMMY_SP}; /// The types of pointers #[derive(Clone)] diff --git a/src/librustc_builtin_macros/global_asm.rs b/src/librustc_builtin_macros/global_asm.rs index f36b9af77247f..2bcd76e669971 100644 --- a/src/librustc_builtin_macros/global_asm.rs +++ b/src/librustc_builtin_macros/global_asm.rs @@ -10,11 +10,11 @@ use errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; +use rustc_span::source_map::respan; use rustc_span::Span; use smallvec::smallvec; use syntax::ast; use syntax::ptr::P; -use syntax::source_map::respan; use syntax::token; use syntax::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs index 280565badfdaf..758f8516e0e8f 100644 --- a/src/librustc_builtin_macros/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -3,11 +3,11 @@ use crate::util::check_builtin_macro_attribute; use rustc_expand::base::*; +use rustc_span::source_map::respan; use rustc_span::Span; use syntax::ast; use syntax::attr; use syntax::print::pprust; -use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; use std::iter; diff --git a/src/librustc_builtin_macros/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs index ea0c2d0709353..fa3a4c2ad2d29 100644 --- a/src/librustc_builtin_macros/test_harness.rs +++ b/src/librustc_builtin_macros/test_harness.rs @@ -5,6 +5,7 @@ use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; use rustc_feature::Features; use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency}; +use rustc_span::source_map::respan; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::PanicStrategy; use smallvec::{smallvec, SmallVec}; @@ -14,7 +15,6 @@ use syntax::entry::{self, EntryPointType}; use syntax::mut_visit::{ExpectOne, *}; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; use std::{iter, mem}; diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 827516f76a164..cfaa0cfdca1ec 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -27,12 +27,12 @@ use rustc_data_structures::small_c_str::SmallCStr; use rustc_target::spec::{HasTargetSpec, Target}; use crate::abi::Abi; +use rustc_span::source_map::{Span, DUMMY_SP}; use std::cell::{Cell, RefCell}; use std::ffi::CStr; use std::iter; use std::str; use std::sync::Arc; -use syntax::source_map::{Span, DUMMY_SP}; use syntax::symbol::Symbol; /// There is one `CodegenCx` per compilation unit. Each one has its own LLVM diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index a89b170c649f6..a1d4c0c820bc6 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -1,27 +1,26 @@ +use super::operand::OperandRef; +use super::operand::OperandValue::{Immediate, Pair, Ref}; +use super::place::PlaceRef; +use super::{FunctionCx, LocalRef}; + use crate::base; use crate::common::{self, IntPredicate}; use crate::meth; +use crate::traits::*; use crate::MemFlags; + use rustc::middle::lang_items; use rustc::mir::interpret::PanicInfo; use rustc::mir::{self, PlaceBase, Static, StaticKind}; use rustc::ty::layout::{self, FnAbiExt, HasTyCtxt, LayoutOf}; use rustc::ty::{self, Instance, Ty, TypeFoldable}; use rustc_index::vec::Idx; +use rustc_span::{source_map::Span, symbol::Symbol}; use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode}; use rustc_target::spec::abi::Abi; -use crate::traits::*; - use std::borrow::Cow; -use syntax::{source_map::Span, symbol::Symbol}; - -use super::operand::OperandRef; -use super::operand::OperandValue::{Immediate, Pair, Ref}; -use super::place::PlaceRef; -use super::{FunctionCx, LocalRef}; - /// Used by `FunctionCx::codegen_terminator` for emitting common patterns /// e.g., creating a basic block, calling a function, etc. struct TerminatorCodegenHelper<'tcx> { diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 2a4329cdb06bf..f508ed90de42d 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -5,7 +5,7 @@ use rustc::mir::interpret::ErrorHandled; use rustc::ty::layout::{self, HasTyCtxt}; use rustc::ty::{self, Ty}; use rustc_index::vec::Idx; -use syntax::source_map::Span; +use rustc_span::source_map::Span; use super::FunctionCx; diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index bc12c1cc0a3a8..3637c72e1eb97 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -13,7 +13,7 @@ use rustc::ty::cast::{CastTy, IntTy}; use rustc::ty::layout::{self, HasTyCtxt, LayoutOf}; use rustc::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt}; use rustc_apfloat::{ieee, Float, Round, Status}; -use syntax::source_map::{Span, DUMMY_SP}; +use rustc_span::source_map::{Span, DUMMY_SP}; use syntax::symbol::sym; use std::{i128, u128}; diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index acf90651080d2..71dc1f356b1a2 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -1,13 +1,13 @@ use crate::expand::{self, AstFragment, Invocation}; use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS}; +use rustc_span::source_map::SourceMap; use syntax::ast::{self, Attribute, Name, NodeId, PatKind}; use syntax::attr::{self, Deprecation, HasAttrs, Stability}; use syntax::edition::Edition; use syntax::mut_visit::{self, MutVisitor}; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::source_map::SourceMap; use syntax::symbol::{kw, sym, Ident, Symbol}; use syntax::token; use syntax::tokenstream::{self, TokenStream}; diff --git a/src/librustc_expand/build.rs b/src/librustc_expand/build.rs index 3375efe41f133..2a01fd8a1ef2d 100644 --- a/src/librustc_expand/build.rs +++ b/src/librustc_expand/build.rs @@ -1,9 +1,9 @@ use crate::base::ExtCtxt; +use rustc_span::source_map::{respan, Spanned}; use syntax::ast::{self, AttrVec, BlockCheckMode, Expr, Ident, PatKind, UnOp}; use syntax::attr; use syntax::ptr::P; -use syntax::source_map::{respan, Spanned}; use syntax::symbol::{kw, sym, Symbol}; use rustc_span::{Pos, Span}; diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index 6ac4456c43e08..79834972102a5 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -10,6 +10,8 @@ use rustc_parse::configure; use rustc_parse::parser::Parser; use rustc_parse::validate_attr; use rustc_parse::DirectoryOwnership; +use rustc_span::source_map::respan; +use rustc_span::{FileName, Span, DUMMY_SP}; use syntax::ast::{self, AttrItem, Block, Ident, LitKind, NodeId, PatKind, Path}; use syntax::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind}; use syntax::attr::{self, is_builtin_attr, HasAttrs}; @@ -18,7 +20,6 @@ use syntax::mut_visit::*; use syntax::print::pprust; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; use syntax::token; use syntax::tokenstream::{TokenStream, TokenTree}; @@ -26,7 +27,6 @@ use syntax::util::map_in_place::MapInPlace; use syntax::visit::{self, Visitor}; use errors::{Applicability, FatalError, PResult}; -use rustc_span::{FileName, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_expand/parse/lexer/tests.rs b/src/librustc_expand/parse/lexer/tests.rs index 521aec335e1a4..835f0b0108ead 100644 --- a/src/librustc_expand/parse/lexer/tests.rs +++ b/src/librustc_expand/parse/lexer/tests.rs @@ -1,9 +1,9 @@ use rustc_data_structures::sync::Lrc; use rustc_parse::lexer::StringReader; +use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::symbol::Symbol; use rustc_span::{BytePos, Span}; use syntax::sess::ParseSess; -use syntax::source_map::{FilePathMapping, SourceMap}; use syntax::token::{self, Token, TokenKind}; use syntax::util::comments::is_doc_comment; use syntax::with_default_globals; diff --git a/src/librustc_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs index de7be2542eeff..d98ccdeaebc58 100644 --- a/src/librustc_expand/parse/tests.rs +++ b/src/librustc_expand/parse/tests.rs @@ -2,12 +2,12 @@ use crate::tests::{matches_codepattern, string_to_stream, with_error_checking_pa use errors::PResult; use rustc_parse::new_parser_from_source_str; +use rustc_span::source_map::FilePathMapping; use rustc_span::{BytePos, FileName, Pos, Span}; use syntax::ast::{self, Name, PatKind}; use syntax::print::pprust::item_to_string; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::source_map::FilePathMapping; use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, Token}; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; diff --git a/src/librustc_expand/placeholders.rs b/src/librustc_expand/placeholders.rs index 231a5a19cb662..8b18a5dc4bbbb 100644 --- a/src/librustc_expand/placeholders.rs +++ b/src/librustc_expand/placeholders.rs @@ -1,10 +1,10 @@ use crate::base::ExtCtxt; use crate::expand::{AstFragment, AstFragmentKind}; +use rustc_span::source_map::{dummy_spanned, DUMMY_SP}; use syntax::ast; use syntax::mut_visit::*; use syntax::ptr::P; -use syntax::source_map::{dummy_spanned, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_expand/tests.rs b/src/librustc_expand/tests.rs index a1ec6d674cc5e..18dc605c9e754 100644 --- a/src/librustc_expand/tests.rs +++ b/src/librustc_expand/tests.rs @@ -1,8 +1,8 @@ use rustc_parse::{new_parser_from_source_str, parser::Parser, source_file_to_stream}; +use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::{BytePos, MultiSpan, Span}; use syntax::ast; use syntax::sess::ParseSess; -use syntax::source_map::{FilePathMapping, SourceMap}; use syntax::tokenstream::TokenStream; use syntax::with_default_globals; diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index 9cfd30eab29ea..c4449945dd19d 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -14,12 +14,12 @@ use rustc_data_structures::OnDrop; use rustc_errors::registry::Registry; use rustc_parse::new_parser_from_source_str; use rustc_span::edition; +use rustc_span::source_map::{FileLoader, FileName, SourceMap}; use std::path::PathBuf; use std::result; use std::sync::{Arc, Mutex}; use syntax::ast::{self, MetaItemKind}; use syntax::sess::ParseSess; -use syntax::source_map::{FileLoader, FileName, SourceMap}; use syntax::token; pub type Result = result::Result; diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 091cf3681fa7c..7571f19e27e4d 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -15,6 +15,7 @@ use rustc_errors::registry::Registry; use rustc_metadata::dynamic_lib::DynamicLibrary; use rustc_resolve::{self, Resolver}; use rustc_span::edition::Edition; +use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMap}; use smallvec::SmallVec; use std::env; use std::io::{self, Write}; @@ -27,7 +28,6 @@ use std::{panic, thread}; use syntax::ast::{AttrVec, BlockCheckMode}; use syntax::mut_visit::{visit_clobber, MutVisitor, *}; use syntax::ptr::P; -use syntax::source_map::{FileLoader, RealFileLoader, SourceMap}; use syntax::symbol::{sym, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; use syntax::{self, ast, attr}; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 6e5a0f549158f..6e13e33a41925 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -37,6 +37,7 @@ use rustc::util::nodemap::FxHashSet; use rustc_feature::Stability; use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType}; +use rustc_span::source_map::Spanned; use rustc_span::{BytePos, Span}; use syntax::ast::{self, Expr}; use syntax::attr::{self, HasAttrs}; @@ -44,7 +45,6 @@ use syntax::edition::Edition; use syntax::errors::{Applicability, DiagnosticBuilder}; use syntax::print::pprust::{self, expr_to_string}; use syntax::ptr::P; -use syntax::source_map::Spanned; use syntax::symbol::{kw, sym, Symbol}; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::visit::FnKind; diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 7983c0e35c8db..67eccda5eb7e8 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -3,28 +3,24 @@ use crate::hir::def_id::DefId; use lint::{LateContext, LintArray, LintContext}; use lint::{LateLintPass, LintPass}; +use rustc::hir; use rustc::hir::{is_range_literal, ExprKind, Node}; +use rustc::mir::interpret::{sign_extend, truncate}; use rustc::ty::layout::{self, IntegerExt, LayoutOf, SizeSkeleton, VariantIdx}; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; -use rustc::{lint, util}; +use rustc::{lint, util::nodemap::FxHashSet}; use rustc_index::vec::Idx; -use util::nodemap::FxHashSet; - -use std::cmp; -use std::{f32, f64, i16, i32, i64, i8, u16, u32, u64, u8}; - +use rustc_span::source_map; use rustc_span::symbol::sym; use rustc_span::Span; use rustc_target::spec::abi::Abi; use syntax::errors::Applicability; -use syntax::{ast, attr, source_map}; - -use rustc::hir; - -use rustc::mir::interpret::{sign_extend, truncate}; +use syntax::{ast, attr}; use log::debug; +use std::cmp; +use std::{f32, f64, i16, i32, i64, i8, u16, u32, u64, u8}; declare_lint! { UNUSED_COMPARISONS, diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 06240994da3a8..5f9f2f6cf82a4 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -4,10 +4,10 @@ use rustc::middle::cstore::{self, NativeLibrary}; use rustc::session::Session; use rustc::ty::TyCtxt; use rustc::util::nodemap::FxHashSet; +use rustc_span::source_map::Span; use rustc_target::spec::abi::Abi; use syntax::attr; use syntax::feature_gate::feature_err; -use syntax::source_map::Span; use syntax::symbol::{kw, sym, Symbol}; use syntax::{span_err, struct_span_err}; diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index 8984eeccbf778..2e133bdbf8898 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -36,11 +36,11 @@ use proc_macro::bridge::client::ProcMacro; use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive}; use rustc_serialize::{opaque, Decodable, Decoder, SpecializedDecoder}; +use rustc_span::source_map::{self, respan, Spanned}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{self, hygiene::MacroKind, BytePos, Pos, Span, DUMMY_SP}; use syntax::ast::{self, Ident}; use syntax::attr; -use syntax::source_map::{self, respan, Spanned}; pub use cstore_impl::{provide, provide_extern}; diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index 804e40c31ecef..7e569f34e8ee7 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -26,13 +26,13 @@ use smallvec::SmallVec; use std::any::Any; use std::sync::Arc; +use rustc_span::source_map; +use rustc_span::source_map::Spanned; use rustc_span::{FileName, Span}; use syntax::ast; use syntax::attr; use syntax::expand::allocator::AllocatorKind; use syntax::ptr::P; -use syntax::source_map; -use syntax::source_map::Spanned; use syntax::symbol::Symbol; use syntax::tokenstream::DelimSpan; diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 681358a178a37..7b30c0b0af067 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -25,6 +25,7 @@ use rustc_data_structures::sync::Lrc; use rustc_serialize::{opaque, Encodable, Encoder, SpecializedEncoder}; use log::{debug, trace}; +use rustc_span::source_map::Spanned; use rustc_span::{self, FileName, SourceFile, Span}; use std::hash::Hash; use std::num::NonZeroUsize; @@ -33,7 +34,6 @@ use std::u32; use syntax::ast; use syntax::attr; use syntax::expand::is_proc_macro_attr; -use syntax::source_map::Spanned; use syntax::symbol::{kw, sym, Ident, Symbol}; use rustc::hir::intravisit; diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index 5eca32ce00c8b..61d69f8bd9d7d 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -11,8 +11,8 @@ use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_index::vec::Idx; +use rustc_span::source_map::DesugaringKind; use rustc_span::Span; -use syntax::source_map::DesugaringKind; use crate::dataflow::drop_flag_effects; use crate::dataflow::indexes::{MoveOutIndex, MovePathIndex}; diff --git a/src/librustc_mir/borrow_check/diagnostics/var_name.rs b/src/librustc_mir/borrow_check/diagnostics/var_name.rs index d9bfcaf57f5fc..9e3d2a7d5f63c 100644 --- a/src/librustc_mir/borrow_check/diagnostics/var_name.rs +++ b/src/librustc_mir/borrow_check/diagnostics/var_name.rs @@ -3,8 +3,8 @@ use crate::borrow_check::{nll::ToRegionVid, region_infer::RegionInferenceContext use rustc::mir::{Body, Local}; use rustc::ty::{RegionVid, TyCtxt}; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; -use syntax::source_map::Span; impl<'tcx> RegionInferenceContext<'tcx> { crate fn get_var_name_and_span_for_region( diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 63e63f304d213..ac04ae285884b 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -3,8 +3,7 @@ use rustc::mir; use rustc::ty::layout::VariantIdx; use rustc::ty::{self, TyCtxt}; - -use syntax::{source_map::DUMMY_SP, symbol::Symbol}; +use rustc_span::{source_map::DUMMY_SP, symbol::Symbol}; use crate::interpret::{intern_const_alloc_recursive, ConstValue, InterpCx}; diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index 6c4b69d9d767e..d55620f657ba9 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -10,8 +10,8 @@ use rustc::mir; use rustc::mir::interpret::{ConstEvalErr, ErrorHandled}; use rustc::traits::Reveal; use rustc::ty::{self, layout, layout::LayoutOf, subst::Subst, TyCtxt}; +use rustc_span::source_map::Span; use std::convert::TryInto; -use syntax::source_map::Span; pub fn note_on_undefined_behavior_error() -> &'static str { "The rules on what exactly is undefined behavior aren't clear, \ diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs index a76153c19ec67..d4556919652ec 100644 --- a/src/librustc_mir/const_eval/machine.rs +++ b/src/librustc_mir/const_eval/machine.rs @@ -8,7 +8,7 @@ use std::hash::Hash; use rustc_data_structures::fx::FxHashMap; -use syntax::source_map::Span; +use rustc_span::source_map::Span; use crate::interpret::{ self, snapshot, AllocId, Allocation, AssertMessage, GlobalId, ImmTy, InterpCx, InterpResult, diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 766ef6ab6feac..5c5159749a3c5 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -17,7 +17,7 @@ use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_index::vec::IndexVec; use rustc_macros::HashStable; -use syntax::source_map::{self, Span, DUMMY_SP}; +use rustc_span::source_map::{self, Span, DUMMY_SP}; use super::{ Immediate, MPlaceTy, Machine, MemPlace, Memory, OpTy, Operand, Place, PlaceTy, diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 1500b5fef2bdf..6790baf31ccb2 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -19,8 +19,8 @@ use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_index::vec::IndexVec; use rustc_macros::HashStable; +use rustc_span::source_map::Span; use syntax::ast::Mutability; -use syntax::source_map::Span; use super::eval_context::{LocalState, StackPopCleanup}; use super::{Frame, Immediate, LocalValue, MemPlace, Memory, Operand, Place, ScalarMaybeUndef}; diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index 1cc22c03a05f9..e4af30370552f 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -3,8 +3,8 @@ use std::borrow::Cow; use rustc::ty::layout::{self, LayoutOf, TyLayout}; use rustc::ty::Instance; use rustc::{mir, ty}; +use rustc_span::source_map::Span; use rustc_target::spec::abi::Abi; -use syntax::source_map::Span; use super::{ FnVal, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, PlaceTy, StackPopCleanup, diff --git a/src/librustc_parse/parser/generics.rs b/src/librustc_parse/parser/generics.rs index c0cc9deafb818..1b816e2b90da9 100644 --- a/src/librustc_parse/parser/generics.rs +++ b/src/librustc_parse/parser/generics.rs @@ -1,9 +1,9 @@ use super::Parser; use rustc_errors::PResult; +use rustc_span::source_map::DUMMY_SP; use rustc_span::symbol::{kw, sym}; use syntax::ast::{self, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause}; -use syntax::source_map::DUMMY_SP; use syntax::token; impl<'a> Parser<'a> { diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index a0d5467893de0..59657cca1c6e3 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -11,13 +11,13 @@ use rustc::lint; use rustc::session::Session; use rustc_data_structures::fx::FxHashMap; use rustc_parse::validate_attr; +use rustc_span::source_map::Spanned; use rustc_span::Span; use std::mem; use syntax::ast::*; use syntax::attr; use syntax::expand::is_proc_macro_attr; use syntax::print::pprust; -use syntax::source_map::Spanned; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{span_err, struct_span_err, walk_list}; diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index 1004e639b6ef7..685e48e0f3558 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -17,8 +17,8 @@ use rustc::ty::TyCtxt; use rustc::util::nodemap::FxHashSet; use rustc_index::vec::Idx; +use rustc_span::source_map; use rustc_span::Span; -use syntax::source_map; use std::mem; diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 911de5d2174e6..66cb5b3c6531a 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -32,12 +32,12 @@ use errors::Applicability; use rustc_expand::base::SyntaxExtension; use rustc_expand::expand::AstFragment; use rustc_span::hygiene::{ExpnId, MacroKind}; +use rustc_span::source_map::{respan, Spanned}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; use syntax::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; use syntax::ast::{Ident, Name}; use syntax::attr; -use syntax::source_map::{respan, Spanned}; use syntax::span_err; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 2553ac6208c57..38b9f1ca22ad1 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -11,10 +11,10 @@ use rustc::ty::{self, DefIdTree}; use rustc::util::nodemap::FxHashSet; use rustc_feature::BUILTIN_ATTRIBUTES; use rustc_span::hygiene::MacroKind; +use rustc_span::source_map::SourceMap; use rustc_span::{BytePos, MultiSpan, Span}; use syntax::ast::{self, Ident, Path}; use syntax::print::pprust; -use syntax::source_map::SourceMap; use syntax::struct_span_err; use syntax::symbol::{kw, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index b1be98834795a..5c7f9cb6934ca 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -39,13 +39,13 @@ use rustc_metadata::creader::{CStore, CrateLoader}; use errors::{Applicability, DiagnosticBuilder}; use rustc_expand::base::SyntaxExtension; use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency}; +use rustc_span::source_map::Spanned; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy}; use syntax::ast::{Crate, CRATE_NODE_ID}; use syntax::ast::{ItemKind, Path}; use syntax::attr; use syntax::print::pprust; -use syntax::source_map::Spanned; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{struct_span_err, unwrap_or}; diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index e898b8acfbefc..a61030afa19db 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -23,11 +23,11 @@ use rustc_data_structures::fx::FxHashSet; use std::env; use std::path::Path; +use rustc_span::source_map::{respan, DUMMY_SP}; use rustc_span::*; use syntax::ast::{self, Attribute, NodeId, PatKind}; use syntax::print::pprust::{bounds_to_string, generic_params_to_string, ty_to_string}; use syntax::ptr::P; -use syntax::source_map::{respan, DUMMY_SP}; use syntax::token; use syntax::visit::{self, Visitor}; use syntax::walk_list; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index bebe5309b4465..1f72d1dd847b9 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -26,11 +26,11 @@ use std::fs::File; use std::io::BufWriter; use std::path::{Path, PathBuf}; +use rustc_span::source_map::Spanned; use rustc_span::*; use syntax::ast::{self, Attribute, NodeId, PatKind, DUMMY_NODE_ID}; use syntax::print::pprust; use syntax::print::pprust::{param_to_string, ty_to_string}; -use syntax::source_map::Spanned; use syntax::util::comments::strip_doc_comment_decoration; use syntax::visit::{self, Visitor}; diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 39557c22ce80b..46021f8b3991b 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -8,7 +8,7 @@ use rustc::ty::query::Providers; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt}; use rustc::util::nodemap::FxHashSet; -use syntax::source_map::{Span, DUMMY_SP}; +use rustc_span::source_map::{Span, DUMMY_SP}; crate fn provide(p: &mut Providers<'_>) { *p = Providers { dropck_outlives, adt_dtorck_constraint, ..*p }; diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs index e8d90136ecc91..3ad1b223a8433 100644 --- a/src/librustc_traits/evaluate_obligation.rs +++ b/src/librustc_traits/evaluate_obligation.rs @@ -4,7 +4,7 @@ use rustc::traits::{ }; use rustc::ty::query::Providers; use rustc::ty::{ParamEnvAnd, TyCtxt}; -use syntax::source_map::DUMMY_SP; +use rustc_span::source_map::DUMMY_SP; crate fn provide(p: &mut Providers<'_>) { *p = Providers { evaluate_obligation, ..*p }; diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index f2c4505496f8a..a58ec5bab5e98 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -12,8 +12,8 @@ use rustc::ty::outlives::Component; use rustc::ty::query::Providers; use rustc::ty::wf; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; +use rustc_span::source_map::DUMMY_SP; use smallvec::{smallvec, SmallVec}; -use syntax::source_map::DUMMY_SP; crate fn provide(p: &mut Providers<'_>) { *p = Providers { implied_outlives_bounds, ..*p }; diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index a94a6929450e6..8bff95cd49740 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -14,10 +14,10 @@ use rustc::traits::Obligation; use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, GenericParamDefKind, Ty}; +use rustc_span::source_map::Span; use rustc_target::spec::abi::Abi; use std::cmp; use std::iter; -use syntax::source_map::Span; /// What signature do we *expect* the closure to have from context? #[derive(Debug)] diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 9ac047faa52fc..8f3b95a882f83 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -32,8 +32,8 @@ use rustc::ty::Ty; use rustc::ty::TypeFoldable; use rustc::ty::{AdtKind, Visibility}; use rustc_span::hygiene::DesugaringKind; +use rustc_span::source_map::Span; use syntax::ast; -use syntax::source_map::Span; use syntax::symbol::{kw, sym, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 7c5671f0f5024..40ea27df4ffe2 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -14,9 +14,9 @@ use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::Obligation; use rustc::ty::print::with_crate_prefix; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; -use rustc_span::{FileName, Span}; +use rustc_span::{source_map, FileName, Span}; +use syntax::ast; use syntax::util::lev_distance; -use syntax::{ast, source_map}; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 86f92ce9b8923..2487859582c33 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -119,12 +119,12 @@ use rustc::ty::{ }; use rustc_index::vec::Idx; use rustc_span::hygiene::DesugaringKind; +use rustc_span::source_map::{original_sp, DUMMY_SP}; use rustc_span::{self, BytePos, MultiSpan, Span}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::attr; use syntax::feature_gate::feature_err; -use syntax::source_map::{original_sp, DUMMY_SP}; use syntax::symbol::{kw, sym, Ident}; use syntax::util::parser::ExprPrecedence; diff --git a/src/librustc_typeck/constrained_generic_params.rs b/src/librustc_typeck/constrained_generic_params.rs index 97a0c226e4d5b..706174041deac 100644 --- a/src/librustc_typeck/constrained_generic_params.rs +++ b/src/librustc_typeck/constrained_generic_params.rs @@ -1,7 +1,7 @@ use rustc::ty::fold::{TypeFoldable, TypeVisitor}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::FxHashSet; -use syntax::source_map::Span; +use rustc_span::source_map::Span; #[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct Parameter(pub u32); diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 0c4323a62f568..6dd89dbd7f1ce 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -17,12 +17,12 @@ use rustc::ty::layout::VariantIdx; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_index::vec::IndexVec; use rustc_span::hygiene::MacroKind; +use rustc_span::source_map::DUMMY_SP; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{self, FileName}; use rustc_target::spec::abi::Abi; use syntax::ast::{self, AttrStyle, Ident}; use syntax::attr; -use syntax::source_map::DUMMY_SP; use syntax::util::comments::strip_doc_comment_decoration; use crate::clean::cfg::Cfg; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index bd19eeecf7726..cac3480f28d86 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -17,10 +17,10 @@ use rustc_resolve as resolve; use errors::emitter::{Emitter, EmitterWriter}; use errors::json::JsonEmitter; +use rustc_span::source_map; use rustc_span::DUMMY_SP; use syntax::ast::CRATE_NODE_ID; use syntax::attr; -use syntax::source_map; use syntax::symbol::sym; use rustc_data_structures::sync::{self, Lrc}; diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index d8786a5e10e25..bf8a8fcd3a354 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -12,9 +12,9 @@ use std::io; use std::io::prelude::*; use rustc_parse::lexer; +use rustc_span::source_map::SourceMap; use rustc_span::{FileName, Span}; use syntax::sess::ParseSess; -use syntax::source_map::SourceMap; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 2c41e91b01b6a..32d42b9c7347d 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -51,12 +51,12 @@ use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::flock; use rustc_feature::UnstableFeatures; use rustc_span::hygiene::MacroKind; +use rustc_span::source_map::FileName; use serde::ser::SerializeSeq; use serde::{Serialize, Serializer}; use syntax::ast; use syntax::edition::Edition; use syntax::print::pprust; -use syntax::source_map::FileName; use syntax::symbol::{sym, Symbol}; use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy}; diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index d30c9a3d33352..04e7c3a616130 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -3,10 +3,10 @@ use crate::fold::DocFolder; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::middle::privacy::AccessLevels; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_span::source_map::FileName; use std::collections::BTreeMap; use std::mem; use std::path::{Path, PathBuf}; -use syntax::source_map::FileName; use syntax::symbol::sym; use serde::Serialize; diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 717fc7fbabd05..79e7d3d783b80 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -5,10 +5,10 @@ use crate::html::format::Buffer; use crate::html::highlight; use crate::html::layout; use crate::html::render::{Error, SharedContext, BASIC_KEYWORDS}; +use rustc_span::source_map::FileName; use std::ffi::OsStr; use std::fs; use std::path::{Component, Path, PathBuf}; -use syntax::source_map::FileName; crate fn render( dst: &Path, diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 35424ffbe0cda..95edff4ba8099 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -4,8 +4,8 @@ use std::path::PathBuf; use errors; use rustc_feature::UnstableFeatures; +use rustc_span::source_map::DUMMY_SP; use syntax::edition::Edition; -use syntax::source_map::DUMMY_SP; use testing; use crate::config::{Options, RenderOptions}; diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index 2b320b610473f..b568d034d8934 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -1,8 +1,8 @@ use errors::Applicability; use rustc_parse::lexer::StringReader as Lexer; +use rustc_span::source_map::FilePathMapping; use rustc_span::{FileName, InnerSpan}; use syntax::sess::ParseSess; -use syntax::source_map::FilePathMapping; use syntax::token; use crate::clean; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 0066d36d55f11..312c6dad822aa 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -5,6 +5,7 @@ use rustc::util::common::ErrorReported; use rustc_data_structures::sync::Lrc; use rustc_feature::UnstableFeatures; use rustc_interface::interface; +use rustc_span::source_map::SourceMap; use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP}; use rustc_target::spec::TargetTriple; use std::env; @@ -15,7 +16,6 @@ use std::process::{self, Command, Stdio}; use std::str; use syntax::ast; use syntax::edition::Edition; -use syntax::source_map::SourceMap; use syntax::symbol::sym; use syntax::with_globals; use tempfile::Builder as TempFileBuilder; @@ -402,10 +402,11 @@ pub fn make_test( // Uses libsyntax to parse the doctest and find if there's a main fn and the extern // crate already is included. let (already_has_main, already_has_extern_crate, found_macro) = with_globals(edition, || { - use crate::syntax::{sess::ParseSess, source_map::FilePathMapping}; use errors::emitter::EmitterWriter; use errors::Handler; use rustc_parse::maybe_new_parser_from_source_str; + use rustc_span::source_map::FilePathMapping; + use syntax::sess::ParseSess; let filename = FileName::anon_source_code(s); let source = crates + &everything_else; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 4722539fd8481..c7a1739bb9130 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -8,9 +8,9 @@ use rustc::middle::privacy::AccessLevel; use rustc::ty::TyCtxt; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_span::hygiene::MacroKind; +use rustc_span::source_map::Spanned; use rustc_span::{self, Span}; use syntax::ast; -use syntax::source_map::Spanned; use syntax::symbol::sym; use std::mem; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7bf7ea0a424ef..47070261385a2 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -25,19 +25,18 @@ pub use UnsafeSource::*; pub use rustc_span::symbol::{Ident, Symbol as Name}; use crate::ptr::P; -use crate::source_map::{dummy_spanned, respan, Spanned}; use crate::token::{self, DelimToken}; use crate::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use rustc_span::symbol::{kw, sym, Symbol}; -use rustc_span::{Span, DUMMY_SP}; - use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::thin_vec::ThinVec; use rustc_index::vec::Idx; use rustc_macros::HashStable_Generic; use rustc_serialize::{self, Decoder, Encoder}; +use rustc_span::source_map::{dummy_spanned, respan, Spanned}; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::{Span, DUMMY_SP}; use std::fmt; use std::iter; diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 3102aa5dd28e0..e0040d42aaf7a 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -14,13 +14,13 @@ use crate::ast::{Expr, GenericParam, Item, Lit, LitKind, Local, Stmt, StmtKind}; use crate::ast::{MacArgs, MacDelimiter, MetaItem, MetaItemKind, NestedMetaItem}; use crate::mut_visit::visit_clobber; use crate::ptr::P; -use crate::source_map::{BytePos, Spanned}; use crate::symbol::{sym, Symbol}; use crate::token::{self, Token}; use crate::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use crate::GLOBALS; use log::debug; +use rustc_span::source_map::{BytePos, Spanned}; use rustc_span::Span; use std::iter; diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index e5635eaf1e915..41cde019fe0fd 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -1,25 +1,24 @@ -use rustc_feature::{find_feature_issue, GateIssue}; -use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; -use rustc_feature::{Feature, Features, State as FeatureState, UnstableFeatures}; -use rustc_feature::{ - ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, -}; - use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId}; use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; use crate::attr; use crate::edition::{Edition, ALL_EDITIONS}; use crate::sess::ParseSess; -use crate::source_map::Spanned; use crate::symbol::{sym, Symbol}; use crate::visit::{self, FnKind, Visitor}; use errors::{Applicability, DiagnosticBuilder, Handler}; -use log::debug; use rustc_data_structures::fx::FxHashMap; +use rustc_error_codes::*; +use rustc_feature::{find_feature_issue, GateIssue}; +use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; +use rustc_feature::{Feature, Features, State as FeatureState, UnstableFeatures}; +use rustc_feature::{ + ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, +}; +use rustc_span::source_map::Spanned; use rustc_span::{MultiSpan, Span, DUMMY_SP}; -use rustc_error_codes::*; +use log::debug; macro_rules! gate_feature_fn { ($cx: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr, $level: expr) => {{ diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index b537f16ffcd9a..40d86f5fb75d0 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -86,9 +86,8 @@ pub mod util { pub mod ast; pub mod attr; -pub mod expand; -pub use rustc_span::source_map; pub mod entry; +pub mod expand; pub mod feature_gate { mod check; pub use check::{check_attribute, check_crate, feature_err, feature_err_issue, get_features}; diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 965a6fcf23b12..1413f1566d043 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -9,15 +9,15 @@ use crate::ast::*; use crate::ptr::P; -use crate::source_map::{respan, Spanned}; use crate::token::{self, Token}; use crate::tokenstream::*; use crate::util::map_in_place::MapInPlace; +use rustc_data_structures::sync::Lrc; +use rustc_span::source_map::{respan, Spanned}; use rustc_span::Span; -use smallvec::{smallvec, Array, SmallVec}; -use rustc_data_structures::sync::Lrc; +use smallvec::{smallvec, Array, SmallVec}; use std::ops::DerefMut; use std::{panic, process, ptr}; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index eaad3a180005b..90037324e56b9 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -6,7 +6,6 @@ use crate::print::pp::Breaks::{Consistent, Inconsistent}; use crate::print::pp::{self, Breaks}; use crate::ptr::P; use crate::sess::ParseSess; -use crate::source_map::{self, SourceMap, Spanned}; use crate::symbol::{kw, sym}; use crate::token::{self, BinOpToken, DelimToken, Nonterminal, Token, TokenKind}; use crate::tokenstream::{self, TokenStream, TokenTree}; @@ -14,8 +13,8 @@ use crate::util::classify; use crate::util::comments; use crate::util::parser::{self, AssocOp, Fixity}; -use rustc_span::{self, BytePos}; -use rustc_span::{FileName, Span}; +use rustc_span::source_map::{dummy_spanned, SourceMap, Spanned}; +use rustc_span::{BytePos, FileName, Span}; use std::borrow::Cow; @@ -2709,7 +2708,7 @@ impl<'a> State<'a> { ast::FnHeader { unsafety, ext, ..ast::FnHeader::default() }, name, &generics, - &source_map::dummy_spanned(ast::VisibilityKind::Inherited), + &dummy_spanned(ast::VisibilityKind::Inherited), ); self.end(); } diff --git a/src/libsyntax/print/pprust/tests.rs b/src/libsyntax/print/pprust/tests.rs index 07657e3061e4c..3091e3155805b 100644 --- a/src/libsyntax/print/pprust/tests.rs +++ b/src/libsyntax/print/pprust/tests.rs @@ -1,9 +1,9 @@ use super::*; use crate::ast; -use crate::source_map; use crate::with_default_globals; use rustc_span; +use rustc_span::source_map::{dummy_spanned, respan}; fn fun_to_string( decl: &ast::FnDecl, @@ -18,7 +18,7 @@ fn fun_to_string( header, Some(name), generics, - &source_map::dummy_spanned(ast::VisibilityKind::Inherited), + &dummy_spanned(ast::VisibilityKind::Inherited), ); s.end(); // Close the head box. s.end(); // Close the outer box. @@ -53,7 +53,7 @@ fn test_variant_to_string() { let var = ast::Variant { ident, - vis: source_map::respan(rustc_span::DUMMY_SP, ast::VisibilityKind::Inherited), + vis: respan(rustc_span::DUMMY_SP, ast::VisibilityKind::Inherited), attrs: Vec::new(), id: ast::DUMMY_NODE_ID, data: ast::VariantData::Unit(ast::DUMMY_NODE_ID), diff --git a/src/libsyntax/util/comments.rs b/src/libsyntax/util/comments.rs index 7f22355bd1d17..c385b498ced72 100644 --- a/src/libsyntax/util/comments.rs +++ b/src/libsyntax/util/comments.rs @@ -2,8 +2,8 @@ pub use CommentStyle::*; use crate::ast; use crate::sess::ParseSess; -use crate::source_map::SourceMap; +use rustc_span::source_map::SourceMap; use rustc_span::{BytePos, CharPos, FileName, Pos}; use std::usize; From 4ff12ce4c14d348dfe53d1f74ab53c878f4fb4f8 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 1 Jan 2020 19:30:57 +0100 Subject: [PATCH 11/17] Normalize `syntax::symbol` imports. --- src/librustc/arena.rs | 4 ++-- src/librustc/hir/check_attr.rs | 7 ++++--- src/librustc/hir/print.rs | 2 +- src/librustc/ich/hcx.rs | 2 +- src/librustc/ich/mod.rs | 2 +- src/librustc/infer/error_reporting/need_type_info.rs | 2 +- src/librustc/infer/type_variable.rs | 2 +- src/librustc/infer/unify_key.rs | 2 +- src/librustc/lint/builtin.rs | 2 +- src/librustc/lint/internal.rs | 2 +- src/librustc/lint/levels.rs | 2 +- src/librustc/lint/mod.rs | 2 +- src/librustc/middle/cstore.rs | 2 +- src/librustc/middle/lang_items.rs | 2 +- src/librustc/middle/mod.rs | 2 +- src/librustc/middle/recursion_limit.rs | 2 +- src/librustc/middle/stability.rs | 2 +- src/librustc/middle/weak_lang_items.rs | 2 +- src/librustc/mir/interpret/error.rs | 2 +- src/librustc/mir/mod.rs | 2 +- src/librustc/mir/mono.rs | 2 +- src/librustc/traits/coherence.rs | 2 +- src/librustc/traits/error_reporting.rs | 2 +- src/librustc/traits/object_safety.rs | 2 +- src/librustc/traits/on_unimplemented.rs | 2 +- src/librustc/traits/project.rs | 2 +- src/librustc/traits/select.rs | 2 +- src/librustc/traits/structural_impls.rs | 2 +- src/librustc/ty/context.rs | 2 +- src/librustc/ty/print/pretty.rs | 2 +- src/librustc/ty/query/mod.rs | 2 +- src/librustc/ty/query/values.rs | 2 +- src/librustc/ty/sty.rs | 2 +- src/librustc/ty/wf.rs | 2 +- src/librustc/util/common.rs | 2 +- src/librustc_builtin_macros/asm.rs | 2 +- src/librustc_builtin_macros/assert.rs | 2 +- src/librustc_builtin_macros/concat.rs | 2 +- src/librustc_builtin_macros/deriving/clone.rs | 2 +- src/librustc_builtin_macros/deriving/cmp/eq.rs | 2 +- src/librustc_builtin_macros/deriving/cmp/ord.rs | 2 +- src/librustc_builtin_macros/deriving/cmp/partial_eq.rs | 2 +- src/librustc_builtin_macros/deriving/cmp/partial_ord.rs | 2 +- src/librustc_builtin_macros/deriving/debug.rs | 2 +- src/librustc_builtin_macros/deriving/decodable.rs | 2 +- src/librustc_builtin_macros/deriving/default.rs | 2 +- src/librustc_builtin_macros/deriving/encodable.rs | 2 +- src/librustc_builtin_macros/deriving/generic/mod.rs | 2 +- src/librustc_builtin_macros/deriving/hash.rs | 2 +- src/librustc_builtin_macros/deriving/mod.rs | 2 +- src/librustc_builtin_macros/env.rs | 2 +- src/librustc_builtin_macros/format.rs | 2 +- src/librustc_builtin_macros/global_allocator.rs | 2 +- src/librustc_builtin_macros/lib.rs | 2 +- src/librustc_builtin_macros/proc_macro_harness.rs | 2 +- src/librustc_builtin_macros/source_util.rs | 2 +- src/librustc_builtin_macros/standard_library_imports.rs | 2 +- src/librustc_builtin_macros/test.rs | 2 +- src/librustc_builtin_macros/test_harness.rs | 2 +- src/librustc_builtin_macros/trace_macros.rs | 2 +- src/librustc_codegen_llvm/back/archive.rs | 2 +- src/librustc_codegen_llvm/common.rs | 2 +- src/librustc_codegen_llvm/consts.rs | 2 +- src/librustc_codegen_llvm/context.rs | 2 +- src/librustc_codegen_llvm/debuginfo/gdb.rs | 2 +- src/librustc_codegen_llvm/debuginfo/metadata.rs | 2 +- src/librustc_codegen_llvm/debuginfo/mod.rs | 2 +- src/librustc_codegen_llvm/llvm_util.rs | 2 +- src/librustc_codegen_ssa/back/archive.rs | 2 +- src/librustc_codegen_ssa/back/command.rs | 2 +- src/librustc_codegen_ssa/back/link.rs | 2 +- src/librustc_codegen_ssa/back/linker.rs | 2 +- src/librustc_codegen_ssa/mir/debuginfo.rs | 2 +- src/librustc_codegen_ssa/mir/rvalue.rs | 2 +- src/librustc_codegen_utils/codegen_backend.rs | 2 +- src/librustc_codegen_utils/lib.rs | 2 +- src/librustc_codegen_utils/link.rs | 2 +- src/librustc_codegen_utils/symbol_names_test.rs | 2 +- src/librustc_expand/base.rs | 2 +- src/librustc_expand/build.rs | 2 +- src/librustc_expand/expand.rs | 2 +- src/librustc_expand/mbe/macro_check.rs | 2 +- src/librustc_expand/mbe/macro_parser.rs | 2 +- src/librustc_expand/mbe/macro_rules.rs | 2 +- src/librustc_expand/mbe/quoted.rs | 2 +- src/librustc_expand/parse/tests.rs | 2 +- src/librustc_expand/proc_macro.rs | 2 +- src/librustc_incremental/assert_dep_graph.rs | 4 +++- src/librustc_incremental/assert_module_sources.rs | 2 +- src/librustc_incremental/persist/dirty_clean.rs | 2 +- src/librustc_interface/passes.rs | 2 +- src/librustc_interface/proc_macro_decls.rs | 2 +- src/librustc_interface/tests.rs | 2 +- src/librustc_interface/util.rs | 2 +- src/librustc_lint/array_into_iter.rs | 3 ++- src/librustc_lint/builtin.rs | 2 +- src/librustc_lint/nonstandard_style.rs | 2 +- src/librustc_lint/unused.rs | 4 ++-- src/librustc_metadata/creader.rs | 2 +- src/librustc_metadata/link_args.rs | 2 +- src/librustc_metadata/locator.rs | 2 +- src/librustc_metadata/native_libs.rs | 2 +- src/librustc_metadata/rmeta/decoder/cstore_impl.rs | 2 +- src/librustc_metadata/rmeta/encoder.rs | 2 +- src/librustc_metadata/rmeta/mod.rs | 2 +- src/librustc_mir/borrow_check/diagnostics/region_errors.rs | 2 +- src/librustc_mir/borrow_check/diagnostics/region_name.rs | 2 +- src/librustc_mir/borrow_check/nll.rs | 2 +- src/librustc_mir/build/mod.rs | 2 +- src/librustc_mir/dataflow/generic.rs | 2 +- src/librustc_mir/dataflow/mod.rs | 2 +- src/librustc_mir/hair/cx/mod.rs | 2 +- src/librustc_mir/interpret/cast.rs | 2 +- src/librustc_mir/monomorphize/partitioning.rs | 2 +- src/librustc_mir/transform/check_consts/ops.rs | 2 +- src/librustc_mir/transform/check_consts/validation.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 2 +- src/librustc_mir/transform/promote_consts.rs | 2 +- src/librustc_mir/transform/qualify_min_const_fn.rs | 2 +- src/librustc_mir/transform/rustc_peek.rs | 2 +- src/librustc_passes/ast_validation.rs | 2 +- src/librustc_passes/dead.rs | 2 +- src/librustc_passes/diagnostic_items.rs | 2 +- src/librustc_passes/entry.rs | 2 +- src/librustc_passes/layout_test.rs | 2 +- src/librustc_passes/lib_features.rs | 2 +- src/librustc_passes/liveness.rs | 2 +- src/librustc_passes/stability.rs | 2 +- src/librustc_plugin_impl/build.rs | 2 +- src/librustc_plugin_impl/load.rs | 2 +- src/librustc_privacy/lib.rs | 2 +- src/librustc_resolve/build_reduced_graph.rs | 2 +- src/librustc_resolve/def_collector.rs | 2 +- src/librustc_resolve/diagnostics.rs | 2 +- src/librustc_resolve/imports.rs | 2 +- src/librustc_resolve/late.rs | 2 +- src/librustc_resolve/late/diagnostics.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_resolve/lifetimes.rs | 2 +- src/librustc_traits/lowering/mod.rs | 2 +- src/librustc_typeck/astconv.rs | 2 +- src/librustc_typeck/check/coercion.rs | 2 +- src/librustc_typeck/check/expr.rs | 2 +- src/librustc_typeck/check/intrinsic.rs | 2 +- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/check/wfcheck.rs | 2 +- src/librustc_typeck/check/writeback.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- src/librustc_typeck/outlives/mod.rs | 2 +- src/librustc_typeck/outlives/test.rs | 2 +- src/librustc_typeck/variance/test.rs | 2 +- src/librustdoc/clean/cfg.rs | 2 +- src/librustdoc/clean/cfg/tests.rs | 2 +- src/librustdoc/clean/inline.rs | 2 +- src/librustdoc/core.rs | 2 +- src/librustdoc/html/highlight.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/librustdoc/html/render/cache.rs | 2 +- src/librustdoc/passes/calculate_doc_coverage.rs | 2 +- src/librustdoc/passes/collect_intra_doc_links.rs | 2 +- src/librustdoc/passes/collect_trait_impls.rs | 2 +- src/librustdoc/passes/strip_hidden.rs | 2 +- src/librustdoc/test.rs | 2 +- src/librustdoc/visit_ast.rs | 2 +- src/librustdoc/visit_lib.rs | 2 +- src/libsyntax/attr/mod.rs | 4 ++-- src/libsyntax/entry.rs | 2 +- src/libsyntax/feature_gate/check.rs | 2 +- src/libsyntax/lib.rs | 1 - src/libsyntax/print/pprust.rs | 2 +- src/libsyntax/token.rs | 7 +++---- src/libsyntax/util/lev_distance.rs | 4 +++- src/libsyntax/util/literal.rs | 4 ++-- src/libsyntax/util/parser.rs | 2 +- 174 files changed, 187 insertions(+), 183 deletions(-) diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs index f551d9e31a658..c576c5af31e6a 100644 --- a/src/librustc/arena.rs +++ b/src/librustc/arena.rs @@ -94,7 +94,7 @@ macro_rules! arena_types { > >, [few] diagnostic_items: rustc_data_structures::fx::FxHashMap< - syntax::symbol::Symbol, + rustc_span::symbol::Symbol, rustc::hir::def_id::DefId, >, [few] resolve_lifetimes: rustc::middle::resolve_lifetime::ResolveLifetimes, @@ -105,7 +105,7 @@ macro_rules! arena_types { [few] privacy_access_levels: rustc::middle::privacy::AccessLevels, [few] target_features_whitelist: rustc_data_structures::fx::FxHashMap< String, - Option + Option >, [few] wasm_import_module_map: rustc_data_structures::fx::FxHashMap< rustc::hir::def_id::DefId, diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 2b201cfe0a962..a7d7dddf580da 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -12,11 +12,12 @@ use crate::lint::builtin::UNUSED_ATTRIBUTES; use crate::ty::query::Providers; use crate::ty::TyCtxt; +use rustc_error_codes::*; +use rustc_span::symbol::sym; use rustc_span::Span; -use std::fmt::{self, Display}; -use syntax::{attr, symbol::sym}; +use syntax::attr; -use rustc_error_codes::*; +use std::fmt::{self, Display}; #[derive(Copy, Clone, PartialEq)] pub(crate) enum MethodKind { diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 10b8b5fe39047..c457fc657a15b 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -1,4 +1,5 @@ use rustc_span::source_map::{SourceMap, Spanned}; +use rustc_span::symbol::kw; use rustc_span::{self, BytePos, FileName}; use rustc_target::spec::abi::Abi; use syntax::ast; @@ -6,7 +7,6 @@ use syntax::print::pp::Breaks::{Consistent, Inconsistent}; use syntax::print::pp::{self, Breaks}; use syntax::print::pprust::{self, Comments, PrintState}; use syntax::sess::ParseSess; -use syntax::symbol::kw; use syntax::util::parser::{self, AssocOp, Fixity}; use crate::hir; diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 2c314e6935ffa..44230fa0a44dc 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -10,9 +10,9 @@ use crate::ty::{fast_reject, TyCtxt}; use std::cmp::Ord; use rustc_span::source_map::SourceMap; +use rustc_span::symbol::Symbol; use rustc_span::{BytePos, SourceFile}; use syntax::ast; -use syntax::symbol::Symbol; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index f07e8f38734a7..2c4618dcd42cf 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -4,8 +4,8 @@ pub use self::hcx::{ hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider, }; crate use rustc_data_structures::fingerprint::Fingerprint; +use rustc_span::symbol::{sym, Symbol}; pub use rustc_span::CachingSourceMapView; -use syntax::symbol::{sym, Symbol}; mod hcx; diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index 41a492751e754..889b7b4db3305 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -7,9 +7,9 @@ use crate::ty::print::Print; use crate::ty::{self, DefIdTree, Infer, Ty, TyVar}; use errors::{Applicability, DiagnosticBuilder}; use rustc_span::source_map::DesugaringKind; +use rustc_span::symbol::kw; use rustc_span::Span; use std::borrow::Cow; -use syntax::symbol::kw; use rustc_error_codes::*; diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index 43ded26b42217..27bcb63fe15fe 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -1,7 +1,7 @@ use crate::hir::def_id::DefId; use crate::ty::{self, Ty, TyVid}; +use rustc_span::symbol::Symbol; use rustc_span::Span; -use syntax::symbol::Symbol; use rustc_data_structures::snapshot_vec as sv; use rustc_data_structures::unify as ut; diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index cc05f4ee7a5c3..c5ec0ba73e49d 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -1,8 +1,8 @@ use crate::ty::{self, FloatVarValue, InferConst, IntVarValue, Ty, TyCtxt}; use rustc_data_structures::unify::InPlace; use rustc_data_structures::unify::{EqUnifyValue, NoError, UnificationTable, UnifyKey, UnifyValue}; +use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; -use syntax::symbol::Symbol; use std::cell::RefMut; use std::cmp; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index bdc2b216449cd..aab0db4e4e34f 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -10,10 +10,10 @@ use crate::session::Session; use errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc_session::declare_lint; use rustc_span::source_map::Span; +use rustc_span::symbol::Symbol; use syntax::ast; use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE}; use syntax::edition::Edition; -use syntax::symbol::Symbol; declare_lint! { pub EXCEEDING_BITSHIFTS, diff --git a/src/librustc/lint/internal.rs b/src/librustc/lint/internal.rs index bd75eda1879b1..f7dfbab92e613 100644 --- a/src/librustc/lint/internal.rs +++ b/src/librustc/lint/internal.rs @@ -8,8 +8,8 @@ use crate::lint::{ use errors::Applicability; use rustc_data_structures::fx::FxHashMap; use rustc_session::declare_tool_lint; +use rustc_span::symbol::{sym, Symbol}; use syntax::ast::{Ident, Item, ItemKind}; -use syntax::symbol::{sym, Symbol}; declare_tool_lint! { pub rustc::DEFAULT_HASH_TYPES, diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index 86e6bfb597913..87847cdf8c78d 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -10,11 +10,11 @@ use crate::util::nodemap::FxHashMap; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_span::source_map::MultiSpan; +use rustc_span::symbol::{sym, Symbol}; use syntax::ast; use syntax::attr; use syntax::feature_gate; use syntax::print::pprust; -use syntax::symbol::{sym, Symbol}; use rustc_error_codes::*; diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 0286a174c681b..9769835a67439 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -34,9 +34,9 @@ use crate::util::nodemap::NodeMap; use errors::{DiagnosticBuilder, DiagnosticId}; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan}; +use rustc_span::symbol::Symbol; use rustc_span::Span; use syntax::ast; -use syntax::symbol::Symbol; pub use crate::lint::context::{ check_ast_crate, check_crate, late_lint_mod, BufferedEarlyLint, CheckLintNameResult, diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 93c8ad7707076..be7603f258a19 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -12,13 +12,13 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; use rustc_macros::HashStable; +use rustc_span::symbol::Symbol; use rustc_span::Span; use rustc_target::spec::Target; use std::any::Any; use std::path::{Path, PathBuf}; use syntax::ast; use syntax::expand::allocator::AllocatorKind; -use syntax::symbol::Symbol; pub use self::NativeLibraryKind::*; pub use rustc_session::utils::NativeLibraryKind; diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index c07b65acff218..98e48ca0e4d94 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -19,9 +19,9 @@ use crate::util::nodemap::FxHashMap; use crate::hir; use crate::hir::itemlikevisit::ItemLikeVisitor; use rustc_macros::HashStable; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast; -use syntax::symbol::{sym, Symbol}; use rustc_error_codes::*; diff --git a/src/librustc/middle/mod.rs b/src/librustc/middle/mod.rs index 030bcf3bf4231..96b14eae8ea0e 100644 --- a/src/librustc/middle/mod.rs +++ b/src/librustc/middle/mod.rs @@ -5,7 +5,7 @@ pub mod free_region; pub mod lang_items; pub mod lib_features { use rustc_data_structures::fx::{FxHashMap, FxHashSet}; - use syntax::symbol::Symbol; + use rustc_span::symbol::Symbol; #[derive(HashStable)] pub struct LibFeatures { diff --git a/src/librustc/middle/recursion_limit.rs b/src/librustc/middle/recursion_limit.rs index 8f19494d388df..b33cde8e2af20 100644 --- a/src/librustc/middle/recursion_limit.rs +++ b/src/librustc/middle/recursion_limit.rs @@ -6,8 +6,8 @@ // just peeks and looks for that attribute. use crate::session::Session; +use rustc_span::symbol::{sym, Symbol}; use syntax::ast; -use syntax::symbol::{sym, Symbol}; use rustc_data_structures::sync::Once; diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 5ef4942ac3ba9..a6a49864a9564 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -13,12 +13,12 @@ use crate::ty::{self, TyCtxt}; use crate::util::nodemap::{FxHashMap, FxHashSet}; use errors::DiagnosticBuilder; use rustc_feature::GateIssue; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span}; use syntax::ast::CRATE_NODE_ID; use syntax::attr::{self, ConstStability, Deprecation, RustcDeprecation, Stability}; use syntax::errors::Applicability; use syntax::feature_gate::feature_err_issue; -use syntax::symbol::{sym, Symbol}; use std::num::NonZeroU32; diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 011c9fc27e05e..bdf34e8d76540 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -9,10 +9,10 @@ use crate::hir::intravisit; use crate::hir::intravisit::{NestedVisitorMap, Visitor}; use crate::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use rustc_target::spec::PanicStrategy; use syntax::ast; -use syntax::symbol::{sym, Symbol}; use rustc_error_codes::*; diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 2308da5d610e8..dddc3cf9f5b70 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -11,10 +11,10 @@ use backtrace::Backtrace; use errors::DiagnosticBuilder; use hir::GeneratorKind; use rustc_macros::HashStable; +use rustc_span::symbol::Symbol; use rustc_span::{Pos, Span}; use rustc_target::spec::abi::Abi; use std::{any::Any, env, fmt}; -use syntax::symbol::Symbol; use rustc_error_codes::*; diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index bb1afdd877f82..a293fd128bdb0 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -27,6 +27,7 @@ use rustc_index::bit_set::BitMatrix; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; use rustc_serialize::{Decodable, Encodable}; +use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; use smallvec::SmallVec; use std::borrow::Cow; @@ -36,7 +37,6 @@ use std::slice; use std::{iter, mem, option, u32}; pub use syntax::ast::Mutability; use syntax::ast::Name; -use syntax::symbol::Symbol; pub use crate::mir::cache::{BodyAndCache, ReadOnlyBodyAndCache}; pub use crate::mir::interpret::AssertMessage; diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index bf5cc58b118a0..bec98221e5af3 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -9,10 +9,10 @@ use crate::util::nodemap::FxHashMap; use rustc_data_structures::base_n; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_span::source_map::Span; +use rustc_span::symbol::Symbol; use std::fmt; use std::hash::Hash; use syntax::attr::InlineAttr; -use syntax::symbol::Symbol; /// Describes how a monomorphization will be instantiated in object files. #[derive(PartialEq)] diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 9be18f45de654..16bf69f9ad04c 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -12,8 +12,8 @@ use crate::traits::{self, Normalized, Obligation, ObligationCause, SelectionCont use crate::ty::fold::TypeFoldable; use crate::ty::subst::Subst; use crate::ty::{self, Ty, TyCtxt}; +use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; -use syntax::symbol::sym; /// Whether we do the orphan check relative to this crate or /// to some remote crate. diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 8a5a92fcfa6d9..dbc872a51bfbe 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -26,10 +26,10 @@ use crate::util::nodemap::{FxHashMap, FxHashSet}; use errors::{pluralize, Applicability, DiagnosticBuilder, Style}; use rustc::hir::def_id::LOCAL_CRATE; use rustc_span::source_map::SourceMap; +use rustc_span::symbol::{kw, sym}; use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP}; use std::fmt; use syntax::ast; -use syntax::symbol::{kw, sym}; use rustc_error_codes::*; diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 97f75056f80a2..30ffdc23d9893 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -16,11 +16,11 @@ use crate::lint; use crate::traits::{self, Obligation, ObligationCause}; use crate::ty::subst::{InternalSubsts, Subst}; use crate::ty::{self, Predicate, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; use std::borrow::Cow; use std::iter::{self}; use syntax::ast::{self}; -use syntax::symbol::Symbol; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum ObjectSafetyViolation { diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index 5d90018e80a38..9097cbf0c221a 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -5,10 +5,10 @@ use crate::ty::{self, GenericParamDefKind, TyCtxt}; use crate::util::common::ErrorReported; use crate::util::nodemap::FxHashMap; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{MetaItem, NestedMetaItem}; use syntax::attr; -use syntax::symbol::{kw, sym, Symbol}; use rustc_error_codes::*; diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index c604bf59cbd79..a0a5ca04a8e25 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -21,9 +21,9 @@ use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt}; use crate::util::common::FN_OUTPUT_NAME; use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap}; use rustc_macros::HashStable; +use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; use syntax::ast::Ident; -use syntax::symbol::sym; /// Depending on the stage of compilation, we want projection to be /// more or less conservative. diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index f11fcc4ebae4e..7e412eb03038a 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -42,6 +42,7 @@ use crate::hir; use crate::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lock; use rustc_index::bit_set::GrowableBitSet; +use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; use std::cell::{Cell, RefCell}; use std::cmp; @@ -49,7 +50,6 @@ use std::fmt::{self, Display}; use std::iter; use std::rc::Rc; use syntax::attr; -use syntax::symbol::sym; pub struct SelectionContext<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index c439f20d64002..58204a460d7df 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -3,8 +3,8 @@ use crate::traits::project::Normalized; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::ty::{self, Lift, Ty, TyCtxt}; use chalk_engine; +use rustc_span::symbol::Symbol; use smallvec::SmallVec; -use syntax::symbol::Symbol; use std::collections::{BTreeMap, BTreeSet}; use std::fmt; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d1296bb1791e7..c26d68de181b6 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -60,6 +60,7 @@ use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal}; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; use rustc_span::source_map::MultiSpan; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use rustc_target::spec::abi; use smallvec::SmallVec; @@ -76,7 +77,6 @@ use std::sync::Arc; use syntax::ast; use syntax::attr; use syntax::expand::allocator::AllocatorKind; -use syntax::symbol::{kw, sym, Symbol}; pub struct AllArenas { pub interner: SyncDroplessArena, diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 9bd7701da1feb..8dafe407ed9c2 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -11,10 +11,10 @@ use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable}; use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::Float; +use rustc_span::symbol::{kw, Symbol}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::attr::{SignedInt, UnsignedInt}; -use syntax::symbol::{kw, Symbol}; use std::cell::Cell; use std::collections::BTreeMap; diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 9a555ecf091c7..1907e6c82c62a 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -47,6 +47,7 @@ use rustc_data_structures::sync::Lrc; use rustc_index::vec::IndexVec; use rustc_target::spec::PanicStrategy; +use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; use std::any::type_name; use std::borrow::Cow; @@ -54,7 +55,6 @@ use std::ops::Deref; use std::sync::Arc; use syntax::ast; use syntax::attr; -use syntax::symbol::Symbol; #[macro_use] mod plumbing; diff --git a/src/librustc/ty/query/values.rs b/src/librustc/ty/query/values.rs index 65298ed65d197..900a91fe5cf59 100644 --- a/src/librustc/ty/query/values.rs +++ b/src/librustc/ty/query/values.rs @@ -1,7 +1,7 @@ use crate::ty::util::NeedsDrop; use crate::ty::{self, AdtSizedConstraint, Ty, TyCtxt}; -use syntax::symbol::Symbol; +use rustc_span::symbol::Symbol; pub(super) trait Value<'tcx>: Sized { fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self; diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index c17fff29810d4..346622530bd5a 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -20,6 +20,7 @@ use crate::util::captures::Captures; use polonius_engine::Atom; use rustc_index::vec::Idx; use rustc_macros::HashStable; +use rustc_span::symbol::{kw, Symbol}; use rustc_target::spec::abi; use smallvec::SmallVec; use std::borrow::Cow; @@ -27,7 +28,6 @@ use std::cmp::Ordering; use std::marker::PhantomData; use std::ops::Range; use syntax::ast::{self, Ident}; -use syntax::symbol::{kw, Symbol}; #[derive( Clone, diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 1440813f47aab..4969e7211cecd 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -5,9 +5,9 @@ use crate::middle::lang_items; use crate::traits::{self, AssocTypeBoundData}; use crate::ty::subst::SubstsRef; use crate::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; use std::iter::once; -use syntax::symbol::{kw, Ident}; /// Returns the set of obligations needed to make `ty` well-formed. /// If `ty` contains unresolved inference variables, this may include diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 581f1c0ab6a2d..011b70c04d51b 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -7,7 +7,7 @@ use std::fmt::Debug; use std::time::{Duration, Instant}; use crate::session::Session; -use syntax::symbol::{sym, Symbol}; +use rustc_span::symbol::{sym, Symbol}; #[cfg(test)] mod tests; diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs index 71d6d058d90be..a136a07a40cbe 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -5,10 +5,10 @@ use State::*; use errors::{DiagnosticBuilder, PResult}; use rustc_expand::base::*; use rustc_parse::parser::Parser; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, AsmDialect}; use syntax::ptr::P; -use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, Token}; use syntax::tokenstream::{self, TokenStream}; use syntax::{span_err, struct_span_err}; diff --git a/src/librustc_builtin_macros/assert.rs b/src/librustc_builtin_macros/assert.rs index c32263a6a0f9c..9043db4742bf7 100644 --- a/src/librustc_builtin_macros/assert.rs +++ b/src/librustc_builtin_macros/assert.rs @@ -2,11 +2,11 @@ use errors::{Applicability, DiagnosticBuilder}; use rustc_expand::base::*; use rustc_parse::parser::Parser; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, *}; use syntax::print::pprust; use syntax::ptr::P; -use syntax::symbol::{sym, Symbol}; use syntax::token::{self, TokenKind}; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; diff --git a/src/librustc_builtin_macros/concat.rs b/src/librustc_builtin_macros/concat.rs index c768402b479f8..ed65611da61e1 100644 --- a/src/librustc_builtin_macros/concat.rs +++ b/src/librustc_builtin_macros/concat.rs @@ -1,6 +1,6 @@ use rustc_expand::base::{self, DummyResult}; +use rustc_span::symbol::Symbol; use syntax::ast; -use syntax::symbol::Symbol; use syntax::tokenstream::TokenStream; use std::string::String; diff --git a/src/librustc_builtin_macros/deriving/clone.rs b/src/librustc_builtin_macros/deriving/clone.rs index 0b79ee13132b9..0df5ef3c9d882 100644 --- a/src/librustc_builtin_macros/deriving/clone.rs +++ b/src/librustc_builtin_macros/deriving/clone.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; use syntax::ptr::P; -use syntax::symbol::{kw, sym, Symbol}; pub fn expand_deriving_clone( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/eq.rs b/src/librustc_builtin_macros/deriving/cmp/eq.rs index 72c3be2365444..cb8933c14756f 100644 --- a/src/librustc_builtin_macros/deriving/cmp/eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/eq.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, Expr, GenericArg, Ident, MetaItem}; use syntax::ptr::P; -use syntax::symbol::{sym, Symbol}; pub fn expand_deriving_eq( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/ord.rs b/src/librustc_builtin_macros/deriving/cmp/ord.rs index c16f80159503a..fa43098380671 100644 --- a/src/librustc_builtin_macros/deriving/cmp/ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/ord.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast::{self, Expr, MetaItem}; use syntax::ptr::P; -use syntax::symbol::sym; pub fn expand_deriving_ord( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs index daf518242d5af..dc2912895a8e1 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::{path_local, path_std}; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast::{BinOpKind, Expr, MetaItem}; use syntax::ptr::P; -use syntax::symbol::sym; pub fn expand_deriving_partial_eq( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs index 5313b829ca8f6..a54d8c56f758d 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs @@ -5,10 +5,10 @@ use crate::deriving::generic::*; use crate::deriving::{path_local, path_std, pathvec_std}; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, BinOpKind, Expr, MetaItem}; use syntax::ptr::P; -use syntax::symbol::{sym, Symbol}; pub fn expand_deriving_partial_ord( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/debug.rs b/src/librustc_builtin_macros/deriving/debug.rs index e9c5c7ff9cc6f..f68fddee71be5 100644 --- a/src/librustc_builtin_macros/deriving/debug.rs +++ b/src/librustc_builtin_macros/deriving/debug.rs @@ -3,11 +3,11 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Ident}; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; -use syntax::symbol::sym; pub fn expand_deriving_debug( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/decodable.rs b/src/librustc_builtin_macros/deriving/decodable.rs index 8706535cd3f70..3b20ebbbab45b 100644 --- a/src/librustc_builtin_macros/deriving/decodable.rs +++ b/src/librustc_builtin_macros/deriving/decodable.rs @@ -5,11 +5,11 @@ use crate::deriving::generic::*; use crate::deriving::pathvec_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::Symbol; use rustc_span::Span; use syntax::ast; use syntax::ast::{Expr, MetaItem, Mutability}; use syntax::ptr::P; -use syntax::symbol::Symbol; pub fn expand_deriving_rustc_decodable( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/default.rs b/src/librustc_builtin_macros/deriving/default.rs index 43185f924e79c..f40d6d7e424d6 100644 --- a/src/librustc_builtin_macros/deriving/default.rs +++ b/src/librustc_builtin_macros/deriving/default.rs @@ -3,11 +3,11 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt}; +use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; use syntax::span_err; -use syntax::symbol::{kw, sym}; use rustc_error_codes::*; diff --git a/src/librustc_builtin_macros/deriving/encodable.rs b/src/librustc_builtin_macros/deriving/encodable.rs index 496e5e3058d1c..b330f00939fca 100644 --- a/src/librustc_builtin_macros/deriving/encodable.rs +++ b/src/librustc_builtin_macros/deriving/encodable.rs @@ -90,10 +90,10 @@ use crate::deriving::generic::*; use crate::deriving::pathvec_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::Symbol; use rustc_span::Span; use syntax::ast::{Expr, ExprKind, MetaItem, Mutability}; use syntax::ptr::P; -use syntax::symbol::Symbol; pub fn expand_deriving_rustc_encodable( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs index 44b30118f5abe..7092483843f70 100644 --- a/src/librustc_builtin_macros/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -183,13 +183,13 @@ use std::vec; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::source_map::respan; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind}; use syntax::ast::{GenericArg, GenericParamKind, VariantData}; use syntax::attr; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym, Symbol}; use syntax::util::map_in_place::MapInPlace; use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty}; diff --git a/src/librustc_builtin_macros/deriving/hash.rs b/src/librustc_builtin_macros/deriving/hash.rs index bb83c0449c70f..e620711aa2bd4 100644 --- a/src/librustc_builtin_macros/deriving/hash.rs +++ b/src/librustc_builtin_macros/deriving/hash.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::{self, path_std, pathvec_std}; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast::{Expr, MetaItem, Mutability}; use syntax::ptr::P; -use syntax::symbol::sym; pub fn expand_deriving_hash( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/mod.rs b/src/librustc_builtin_macros/deriving/mod.rs index 6f1b3adfb46cf..4d83a6635ab17 100644 --- a/src/librustc_builtin_macros/deriving/mod.rs +++ b/src/librustc_builtin_macros/deriving/mod.rs @@ -1,10 +1,10 @@ //! The compiler code necessary to implement the `#[derive]` extensions. use rustc_expand::base::{Annotatable, ExtCtxt, MultiItemModifier}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, ItemKind, MetaItem}; use syntax::ptr::P; -use syntax::symbol::{sym, Symbol}; macro path_local($x:ident) { generic::ty::Path::new_local(stringify!($x)) diff --git a/src/librustc_builtin_macros/env.rs b/src/librustc_builtin_macros/env.rs index 17489295ff69c..896bb8ca05392 100644 --- a/src/librustc_builtin_macros/env.rs +++ b/src/librustc_builtin_macros/env.rs @@ -4,9 +4,9 @@ // use rustc_expand::base::{self, *}; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, GenericArg, Ident}; -use syntax::symbol::{kw, sym, Symbol}; use syntax::tokenstream::TokenStream; use std::env; diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs index 6e7853c85adab..e2662faab6cb5 100644 --- a/src/librustc_builtin_macros/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -8,10 +8,10 @@ use errors::Applicability; use errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span}; use syntax::ast; use syntax::ptr::P; -use syntax::symbol::{sym, Symbol}; use syntax::token; use syntax::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/global_allocator.rs b/src/librustc_builtin_macros/global_allocator.rs index 58e1c0fc2b1c9..957d34b7d8983 100644 --- a/src/librustc_builtin_macros/global_allocator.rs +++ b/src/librustc_builtin_macros/global_allocator.rs @@ -1,12 +1,12 @@ use crate::util::check_builtin_macro_attribute; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Ident, Param}; use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafety}; use syntax::expand::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS}; use syntax::ptr::P; -use syntax::symbol::{kw, sym, Symbol}; pub fn expand( ecx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/lib.rs b/src/librustc_builtin_macros/lib.rs index e9709d981fed4..066e3a26445a6 100644 --- a/src/librustc_builtin_macros/lib.rs +++ b/src/librustc_builtin_macros/lib.rs @@ -15,9 +15,9 @@ use crate::deriving::*; use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::BangProcMacro; +use rustc_span::symbol::sym; use syntax::ast::Ident; use syntax::edition::Edition; -use syntax::symbol::sym; mod asm; mod assert; diff --git a/src/librustc_builtin_macros/proc_macro_harness.rs b/src/librustc_builtin_macros/proc_macro_harness.rs index f2e3414588bba..44968d6df9693 100644 --- a/src/librustc_builtin_macros/proc_macro_harness.rs +++ b/src/librustc_builtin_macros/proc_macro_harness.rs @@ -3,6 +3,7 @@ use std::mem; use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; use rustc_span::hygiene::AstPass; +use rustc_span::symbol::{kw, sym}; use rustc_span::{Span, DUMMY_SP}; use smallvec::smallvec; use syntax::ast::{self, Ident}; @@ -11,7 +12,6 @@ use syntax::expand::is_proc_macro_attr; use syntax::print::pprust; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; struct ProcMacroDerive { diff --git a/src/librustc_builtin_macros/source_util.rs b/src/librustc_builtin_macros/source_util.rs index e24f49909ced2..19a766de1f47f 100644 --- a/src/librustc_builtin_macros/source_util.rs +++ b/src/librustc_builtin_macros/source_util.rs @@ -1,11 +1,11 @@ use rustc_expand::base::{self, *}; use rustc_expand::panictry; use rustc_parse::{self, new_sub_parser_from_file, parser::Parser, DirectoryOwnership}; +use rustc_span::symbol::Symbol; use syntax::ast; use syntax::early_buffered_lints::INCOMPLETE_INCLUDE; use syntax::print::pprust; use syntax::ptr::P; -use syntax::symbol::Symbol; use syntax::token; use syntax::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/standard_library_imports.rs b/src/librustc_builtin_macros/standard_library_imports.rs index e7f6c59e88970..b56a2f5254a17 100644 --- a/src/librustc_builtin_macros/standard_library_imports.rs +++ b/src/librustc_builtin_macros/standard_library_imports.rs @@ -1,11 +1,11 @@ use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::ExpansionConfig; use rustc_span::hygiene::AstPass; +use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::DUMMY_SP; use syntax::edition::Edition; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym, Ident, Symbol}; use syntax::{ast, attr}; pub fn inject( diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs index 758f8516e0e8f..0eee212108e85 100644 --- a/src/librustc_builtin_macros/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -4,11 +4,11 @@ use crate::util::check_builtin_macro_attribute; use rustc_expand::base::*; use rustc_span::source_map::respan; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast; use syntax::attr; use syntax::print::pprust; -use syntax::symbol::{sym, Symbol}; use std::iter; diff --git a/src/librustc_builtin_macros/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs index fa3a4c2ad2d29..eddf492720336 100644 --- a/src/librustc_builtin_macros/test_harness.rs +++ b/src/librustc_builtin_macros/test_harness.rs @@ -6,6 +6,7 @@ use rustc_expand::expand::{AstFragment, ExpansionConfig}; use rustc_feature::Features; use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency}; use rustc_span::source_map::respan; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::PanicStrategy; use smallvec::{smallvec, SmallVec}; @@ -15,7 +16,6 @@ use syntax::entry::{self, EntryPointType}; use syntax::mut_visit::{ExpectOne, *}; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{sym, Symbol}; use std::{iter, mem}; diff --git a/src/librustc_builtin_macros/trace_macros.rs b/src/librustc_builtin_macros/trace_macros.rs index 577a1d690c1f9..c0b373f1370c1 100644 --- a/src/librustc_builtin_macros/trace_macros.rs +++ b/src/librustc_builtin_macros/trace_macros.rs @@ -1,6 +1,6 @@ use rustc_expand::base::{self, ExtCtxt}; +use rustc_span::symbol::kw; use rustc_span::Span; -use syntax::symbol::kw; use syntax::tokenstream::{TokenStream, TokenTree}; pub fn expand_trace_macros( diff --git a/src/librustc_codegen_llvm/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs index d4652070c7c6e..455b7086212ba 100644 --- a/src/librustc_codegen_llvm/back/archive.rs +++ b/src/librustc_codegen_llvm/back/archive.rs @@ -12,7 +12,7 @@ use crate::llvm::{self, ArchiveKind}; use rustc::session::Session; use rustc_codegen_ssa::back::archive::{find_library, ArchiveBuilder}; use rustc_codegen_ssa::{looks_like_rust_object_file, METADATA_FILENAME, RLIB_BYTECODE_EXTENSION}; -use syntax::symbol::Symbol; +use rustc_span::symbol::Symbol; struct ArchiveConfig<'a> { pub sess: &'a Session, diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 525b3af29f826..76f6eeb3f7907 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -18,8 +18,8 @@ use rustc_codegen_ssa::mir::place::PlaceRef; use libc::{c_char, c_uint}; +use rustc_span::symbol::Symbol; use syntax::ast::Mutability; -use syntax::symbol::Symbol; pub use crate::context::CodegenCx; diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 2f3be077ef5c3..318037b5bd81d 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -14,9 +14,9 @@ use rustc::mir::mono::MonoItem; use rustc::ty::{self, Instance, Ty}; use rustc::{bug, span_bug}; use rustc_codegen_ssa::traits::*; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use rustc_target::abi::HasDataLayout; -use syntax::symbol::{sym, Symbol}; use rustc::ty::layout::{self, Align, LayoutOf, Size}; diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index cfaa0cfdca1ec..c0a5e0089a955 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -28,12 +28,12 @@ use rustc_target::spec::{HasTargetSpec, Target}; use crate::abi::Abi; use rustc_span::source_map::{Span, DUMMY_SP}; +use rustc_span::symbol::Symbol; use std::cell::{Cell, RefCell}; use std::ffi::CStr; use std::iter; use std::str; use std::sync::Arc; -use syntax::symbol::Symbol; /// There is one `CodegenCx` per compilation unit. Each one has its own LLVM /// `llvm::Context` so that several compilation units may be optimized in parallel. diff --git a/src/librustc_codegen_llvm/debuginfo/gdb.rs b/src/librustc_codegen_llvm/debuginfo/gdb.rs index f68b7b2cfb954..eae461a575f7f 100644 --- a/src/librustc_codegen_llvm/debuginfo/gdb.rs +++ b/src/librustc_codegen_llvm/debuginfo/gdb.rs @@ -9,8 +9,8 @@ use rustc::bug; use rustc::session::config::DebugInfo; use rustc_codegen_ssa::traits::*; +use rustc_span::symbol::sym; use syntax::attr; -use syntax::symbol::sym; /// Inserts a side-effect free instruction sequence that makes sure that the /// .debug_gdb_scripts global is referenced, so it isn't removed by the linker. diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index e752103c1d7ae..61ccd7820109a 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -42,10 +42,10 @@ use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_fs_util::path_to_c_string; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::symbol::{Interner, Symbol}; use rustc_span::{self, FileName, Span}; use rustc_target::abi::HasDataLayout; use syntax::ast; -use syntax::symbol::{Interner, Symbol}; use libc::{c_longlong, c_uint}; use std::collections::hash_map::Entry; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 765643113f526..16ae3c9503052 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -37,10 +37,10 @@ use std::ffi::CString; use rustc::ty::layout::{self, HasTyCtxt, LayoutOf, Size}; use rustc_codegen_ssa::traits::*; +use rustc_span::symbol::Symbol; use rustc_span::{self, BytePos, Pos, Span}; use smallvec::SmallVec; use syntax::ast; -use syntax::symbol::Symbol; mod create_scope_map; pub mod gdb; diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index b57ca0d09f9c6..b3c58b2402065 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -6,10 +6,10 @@ use rustc::session::config::PrintRequest; use rustc::session::Session; use rustc_data_structures::fx::FxHashSet; use rustc_feature::UnstableFeatures; +use rustc_span::symbol::sym; use rustc_span::symbol::Symbol; use rustc_target::spec::{MergeFunctions, PanicStrategy}; use std::ffi::CString; -use syntax::symbol::sym; use std::slice; use std::str; diff --git a/src/librustc_codegen_ssa/back/archive.rs b/src/librustc_codegen_ssa/back/archive.rs index 5f222311926ca..a357c350287fb 100644 --- a/src/librustc_codegen_ssa/back/archive.rs +++ b/src/librustc_codegen_ssa/back/archive.rs @@ -1,5 +1,5 @@ use rustc::session::Session; -use syntax::symbol::Symbol; +use rustc_span::symbol::Symbol; use std::io; use std::path::{Path, PathBuf}; diff --git a/src/librustc_codegen_ssa/back/command.rs b/src/librustc_codegen_ssa/back/command.rs index dcc16416e5e87..30b055b313149 100644 --- a/src/librustc_codegen_ssa/back/command.rs +++ b/src/librustc_codegen_ssa/back/command.rs @@ -7,8 +7,8 @@ use std::io; use std::mem; use std::process::{self, Output}; +use rustc_span::symbol::Symbol; use rustc_target::spec::LldFlavor; -use syntax::symbol::Symbol; #[derive(Clone)] pub struct Command { diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index c7a599a5749b7..8cdda5630ea5e 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -11,8 +11,8 @@ use rustc::session::{filesearch, Session}; use rustc::util::common::{time, time_ext}; use rustc_data_structures::fx::FxHashSet; use rustc_fs_util::fix_windows_verbatim_for_gcc; +use rustc_span::symbol::Symbol; use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel}; -use syntax::symbol::Symbol; use super::archive::ArchiveBuilder; use super::command::Command; diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index a3e60f861996a..fb9ba2a1558f3 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -15,8 +15,8 @@ use rustc::session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, O use rustc::session::Session; use rustc::ty::TyCtxt; use rustc_serialize::{json, Encoder}; +use rustc_span::symbol::Symbol; use rustc_target::spec::{LinkerFlavor, LldFlavor}; -use syntax::symbol::Symbol; /// For all the linkers we support, and information they might /// need out of the shared crate context before we get rid of it. diff --git a/src/librustc_codegen_ssa/mir/debuginfo.rs b/src/librustc_codegen_ssa/mir/debuginfo.rs index 5d26b84b2c931..4b4a2f4b26d42 100644 --- a/src/librustc_codegen_ssa/mir/debuginfo.rs +++ b/src/librustc_codegen_ssa/mir/debuginfo.rs @@ -6,8 +6,8 @@ use rustc::ty::layout::{LayoutOf, Size}; use rustc::ty::TyCtxt; use rustc_index::vec::IndexVec; +use rustc_span::symbol::kw; use rustc_span::{BytePos, Span}; -use syntax::symbol::kw; use super::OperandValue; use super::{FunctionCx, LocalRef}; diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 3637c72e1eb97..39cb501b7aa98 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -14,7 +14,7 @@ use rustc::ty::layout::{self, HasTyCtxt, LayoutOf}; use rustc::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt}; use rustc_apfloat::{ieee, Float, Round, Status}; use rustc_span::source_map::{Span, DUMMY_SP}; -use syntax::symbol::sym; +use rustc_span::symbol::sym; use std::{i128, u128}; diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 0737fd6b5ca23..fecb3986e7e08 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -15,7 +15,7 @@ use rustc::session::Session; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc::util::common::ErrorReported; -use syntax::symbol::Symbol; +use rustc_span::symbol::Symbol; pub use rustc_data_structures::sync::MetadataRef; diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index 578aa591b5c98..399db7aafc76f 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -18,7 +18,7 @@ extern crate rustc; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; -use syntax::symbol::sym; +use rustc_span::symbol::sym; pub mod codegen_backend; pub mod link; diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs index d56027f460842..4dab4545b422f 100644 --- a/src/librustc_codegen_utils/link.rs +++ b/src/librustc_codegen_utils/link.rs @@ -1,8 +1,8 @@ use rustc::session::config::{self, Input, OutputFilenames, OutputType}; use rustc::session::Session; +use rustc_span::symbol::sym; use rustc_span::Span; use std::path::{Path, PathBuf}; -use syntax::symbol::sym; use syntax::{ast, attr}; pub fn out_filename( diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 7cb3050576c76..0a76093a9a9fd 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -6,7 +6,7 @@ use rustc::hir; use rustc::ty::{Instance, TyCtxt}; -use syntax::symbol::{sym, Symbol}; +use rustc_span::symbol::{sym, Symbol}; const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; const DEF_PATH: Symbol = sym::rustc_def_path; diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index 71dc1f356b1a2..e53a7c992749f 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -2,13 +2,13 @@ use crate::expand::{self, AstFragment, Invocation}; use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS}; use rustc_span::source_map::SourceMap; +use rustc_span::symbol::{kw, sym, Ident, Symbol}; use syntax::ast::{self, Attribute, Name, NodeId, PatKind}; use syntax::attr::{self, Deprecation, HasAttrs, Stability}; use syntax::edition::Edition; use syntax::mut_visit::{self, MutVisitor}; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym, Ident, Symbol}; use syntax::token; use syntax::tokenstream::{self, TokenStream}; use syntax::visit::Visitor; diff --git a/src/librustc_expand/build.rs b/src/librustc_expand/build.rs index 2a01fd8a1ef2d..799781a89631d 100644 --- a/src/librustc_expand/build.rs +++ b/src/librustc_expand/build.rs @@ -1,10 +1,10 @@ use crate::base::ExtCtxt; use rustc_span::source_map::{respan, Spanned}; +use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast::{self, AttrVec, BlockCheckMode, Expr, Ident, PatKind, UnOp}; use syntax::attr; use syntax::ptr::P; -use syntax::symbol::{kw, sym, Symbol}; use rustc_span::{Pos, Span}; diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index 79834972102a5..6eead11ccb7ba 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -11,6 +11,7 @@ use rustc_parse::parser::Parser; use rustc_parse::validate_attr; use rustc_parse::DirectoryOwnership; use rustc_span::source_map::respan; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{FileName, Span, DUMMY_SP}; use syntax::ast::{self, AttrItem, Block, Ident, LitKind, NodeId, PatKind, Path}; use syntax::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind}; @@ -20,7 +21,6 @@ use syntax::mut_visit::*; use syntax::print::pprust; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{sym, Symbol}; use syntax::token; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::util::map_in_place::MapInPlace; diff --git a/src/librustc_expand/mbe/macro_check.rs b/src/librustc_expand/mbe/macro_check.rs index 819ae02d28233..992764ab6a41d 100644 --- a/src/librustc_expand/mbe/macro_check.rs +++ b/src/librustc_expand/mbe/macro_check.rs @@ -106,10 +106,10 @@ //! bound. use crate::mbe::{KleeneToken, TokenTree}; +use rustc_span::symbol::{kw, sym}; use syntax::ast::NodeId; use syntax::early_buffered_lints::META_VARIABLE_MISUSE; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym}; use syntax::token::{DelimToken, Token, TokenKind}; use rustc_data_structures::fx::FxHashMap; diff --git a/src/librustc_expand/mbe/macro_parser.rs b/src/librustc_expand/mbe/macro_parser.rs index 0585f4f46b9af..c0e34a30c54e9 100644 --- a/src/librustc_expand/mbe/macro_parser.rs +++ b/src/librustc_expand/mbe/macro_parser.rs @@ -78,10 +78,10 @@ use crate::mbe::{self, TokenTree}; use rustc_parse::parser::{FollowedByType, Parser, PathStyle}; use rustc_parse::Directory; +use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast::{Ident, Name}; use syntax::print::pprust; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, DocComment, Nonterminal, Token}; use syntax::tokenstream::TokenStream; diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index 826cb43294a10..3c3f3a44db05c 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -12,13 +12,13 @@ use rustc_feature::Features; use rustc_parse::parser::Parser; use rustc_parse::Directory; use rustc_span::hygiene::Transparency; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast; use syntax::attr::{self, TransparencyError}; use syntax::edition::Edition; use syntax::print::pprust; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, NtTT, Token, TokenKind::*}; use syntax::tokenstream::{DelimSpan, TokenStream}; diff --git a/src/librustc_expand/mbe/quoted.rs b/src/librustc_expand/mbe/quoted.rs index 99026a7a09ea1..4a33c51d57396 100644 --- a/src/librustc_expand/mbe/quoted.rs +++ b/src/librustc_expand/mbe/quoted.rs @@ -1,10 +1,10 @@ use crate::mbe::macro_parser; use crate::mbe::{Delimited, KleeneOp, KleeneToken, SequenceRepetition, TokenTree}; +use rustc_span::symbol::kw; use syntax::ast; use syntax::print::pprust; use syntax::sess::ParseSess; -use syntax::symbol::kw; use syntax::token::{self, Token}; use syntax::tokenstream; diff --git a/src/librustc_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs index d98ccdeaebc58..25cd5dabe57ec 100644 --- a/src/librustc_expand/parse/tests.rs +++ b/src/librustc_expand/parse/tests.rs @@ -3,12 +3,12 @@ use crate::tests::{matches_codepattern, string_to_stream, with_error_checking_pa use errors::PResult; use rustc_parse::new_parser_from_source_str; use rustc_span::source_map::FilePathMapping; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{BytePos, FileName, Pos, Span}; use syntax::ast::{self, Name, PatKind}; use syntax::print::pprust::item_to_string; use syntax::ptr::P; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, Token}; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; use syntax::visit; diff --git a/src/librustc_expand/proc_macro.rs b/src/librustc_expand/proc_macro.rs index 2776bc647337b..25e2bbb34678e 100644 --- a/src/librustc_expand/proc_macro.rs +++ b/src/librustc_expand/proc_macro.rs @@ -1,9 +1,9 @@ use crate::base::{self, *}; use crate::proc_macro_server; +use rustc_span::symbol::sym; use syntax::ast::{self, ItemKind, MetaItemKind, NestedMetaItem}; use syntax::errors::{Applicability, FatalError}; -use syntax::symbol::sym; use syntax::token; use syntax::tokenstream::{self, TokenStream}; diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 19b5f985f13b8..738dfa712311a 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -42,11 +42,13 @@ use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; +use rustc_span::symbol::sym; use rustc_span::Span; +use syntax::ast; + use std::env; use std::fs::{self, File}; use std::io::Write; -use syntax::{ast, symbol::sym}; pub fn assert_dep_graph(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index c08deb6dfd5b5..b6ce12cf90886 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -25,9 +25,9 @@ use rustc::hir::def_id::LOCAL_CRATE; use rustc::mir::mono::CodegenUnitNameBuilder; use rustc::ty::TyCtxt; use rustc_session::cgu_reuse_tracker::*; +use rustc_span::symbol::{sym, Symbol}; use std::collections::BTreeSet; use syntax::ast; -use syntax::symbol::{sym, Symbol}; pub fn assert_module_sources(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 2ce782a98585d..4d08ccebd696f 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -23,11 +23,11 @@ use rustc::hir::{ImplItemKind, ItemKind as HirItem, TraitItemKind}; use rustc::ty::TyCtxt; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashSet; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use std::iter::FromIterator; use std::vec::Vec; use syntax::ast::{self, Attribute, NestedMetaItem}; -use syntax::symbol::{sym, Symbol}; const EXCEPT: Symbol = sym::except; const LABEL: Symbol = sym::label; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 670ca30faf2c5..dcf1763f857b4 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -33,12 +33,12 @@ use rustc_passes::{self, ast_validation, hir_stats, layout_test}; use rustc_plugin_impl as plugin; use rustc_privacy; use rustc_resolve::{Resolver, ResolverArenas}; +use rustc_span::symbol::Symbol; use rustc_span::FileName; use rustc_traits; use rustc_typeck as typeck; use syntax::early_buffered_lints::BufferedEarlyLint; use syntax::mut_visit::MutVisitor; -use syntax::symbol::Symbol; use syntax::util::node_count::NodeCounter; use syntax::{self, ast, visit}; diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 5bf35124a70e2..beb479046a537 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -3,8 +3,8 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::symbol::sym; use syntax::attr; -use syntax::symbol::sym; pub fn find(tcx: TyCtxt<'_>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs index 4ae579cfca26d..182b1e7861b12 100644 --- a/src/librustc_interface/tests.rs +++ b/src/librustc_interface/tests.rs @@ -12,13 +12,13 @@ use rustc::session::search_paths::SearchPath; use rustc::session::{build_session, Session}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig}; +use rustc_span::symbol::sym; use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel}; use std::collections::{BTreeMap, BTreeSet}; use std::iter::FromIterator; use std::path::PathBuf; use syntax; use syntax::edition::{Edition, DEFAULT_EDITION}; -use syntax::symbol::sym; type CfgSpecs = FxHashSet<(String, Option)>; diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 7571f19e27e4d..c15dc2fe704b9 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -16,6 +16,7 @@ use rustc_metadata::dynamic_lib::DynamicLibrary; use rustc_resolve::{self, Resolver}; use rustc_span::edition::Edition; use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMap}; +use rustc_span::symbol::{sym, Symbol}; use smallvec::SmallVec; use std::env; use std::io::{self, Write}; @@ -28,7 +29,6 @@ use std::{panic, thread}; use syntax::ast::{AttrVec, BlockCheckMode}; use syntax::mut_visit::{visit_clobber, MutVisitor, *}; use syntax::ptr::P; -use syntax::symbol::{sym, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; use syntax::{self, ast, attr}; diff --git a/src/librustc_lint/array_into_iter.rs b/src/librustc_lint/array_into_iter.rs index 481ca43aa793a..6beedb08db5ec 100644 --- a/src/librustc_lint/array_into_iter.rs +++ b/src/librustc_lint/array_into_iter.rs @@ -7,7 +7,8 @@ use rustc::{ adjustment::{Adjust, Adjustment}, }, }; -use syntax::{errors::Applicability, symbol::sym}; +use rustc_span::symbol::sym; +use syntax::errors::Applicability; declare_lint! { pub ARRAY_INTO_ITER, diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 6e13e33a41925..f1e3951e14925 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -38,6 +38,7 @@ use rustc_feature::Stability; use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType}; use rustc_span::source_map::Spanned; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{BytePos, Span}; use syntax::ast::{self, Expr}; use syntax::attr::{self, HasAttrs}; @@ -45,7 +46,6 @@ use syntax::edition::Edition; use syntax::errors::{Applicability, DiagnosticBuilder}; use syntax::print::pprust::{self, expr_to_string}; use syntax::ptr::P; -use syntax::symbol::{kw, sym, Symbol}; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::visit::FnKind; diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index 7c5520f86b4ad..a97061c50ae45 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -5,12 +5,12 @@ use rustc::hir::intravisit::FnKind; use rustc::hir::{self, GenericParamKind, PatKind}; use rustc::lint; use rustc::ty; +use rustc_span::symbol::sym; use rustc_span::{symbol::Ident, BytePos, Span}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::attr; use syntax::errors::Applicability; -use syntax::symbol::sym; #[derive(PartialEq)] pub enum MethodLateContext { diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 95f83d9a9d2b3..db2598d321aca 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -10,13 +10,13 @@ use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashMap; use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; +use rustc_span::symbol::Symbol; +use rustc_span::symbol::{kw, sym}; use rustc_span::{BytePos, Span}; use syntax::ast; use syntax::attr; use syntax::errors::{pluralize, Applicability}; use syntax::print::pprust; -use syntax::symbol::Symbol; -use syntax::symbol::{kw, sym}; use syntax::util::parser; use log::debug; diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index adb73d1c5fcc3..02c912ff7407e 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -23,13 +23,13 @@ use std::{cmp, fs}; use log::{debug, info, log_enabled}; use proc_macro::bridge::client::ProcMacro; use rustc_expand::base::SyntaxExtension; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast; use syntax::attr; use syntax::edition::Edition; use syntax::expand::allocator::{global_allocator_spans, AllocatorKind}; use syntax::span_fatal; -use syntax::symbol::{sym, Symbol}; use rustc_error_codes::*; diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index e3f8eab294174..6649cf09a0735 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -1,8 +1,8 @@ use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; +use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; -use syntax::symbol::sym; crate fn collect(tcx: TyCtxt<'_>) -> Vec { let mut collector = Collector { args: Vec::new() }; diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 93b29cf81d752..a9adb6291c74d 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -225,10 +225,10 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; use errors::DiagnosticBuilder; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use rustc_target::spec::{Target, TargetTriple}; use syntax::struct_span_err; -use syntax::symbol::{sym, Symbol}; use syntax::{span_err, span_fatal}; use std::cmp; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 5f9f2f6cf82a4..3228c9f2ff435 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -5,10 +5,10 @@ use rustc::session::Session; use rustc::ty::TyCtxt; use rustc::util::nodemap::FxHashSet; use rustc_span::source_map::Span; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_target::spec::abi::Abi; use syntax::attr; use syntax::feature_gate::feature_err; -use syntax::symbol::{kw, sym, Symbol}; use syntax::{span_err, struct_span_err}; use rustc_error_codes::*; diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index 7e569f34e8ee7..00d5b4321cb7e 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -28,12 +28,12 @@ use std::sync::Arc; use rustc_span::source_map; use rustc_span::source_map::Spanned; +use rustc_span::symbol::Symbol; use rustc_span::{FileName, Span}; use syntax::ast; use syntax::attr; use syntax::expand::allocator::AllocatorKind; use syntax::ptr::P; -use syntax::symbol::Symbol; use syntax::tokenstream::DelimSpan; macro_rules! provide { diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 7b30c0b0af067..6d84bd6f26369 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -26,6 +26,7 @@ use rustc_serialize::{opaque, Encodable, Encoder, SpecializedEncoder}; use log::{debug, trace}; use rustc_span::source_map::Spanned; +use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{self, FileName, SourceFile, Span}; use std::hash::Hash; use std::num::NonZeroUsize; @@ -34,7 +35,6 @@ use std::u32; use syntax::ast; use syntax::attr; use syntax::expand::is_proc_macro_attr; -use syntax::symbol::{kw, sym, Ident, Symbol}; use rustc::hir::intravisit; use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 00142477b2868..66637cf97b5bf 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -15,10 +15,10 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; use rustc_index::vec::IndexVec; use rustc_serialize::opaque::Encoder; +use rustc_span::symbol::Symbol; use rustc_span::{self, Span}; use rustc_target::spec::{PanicStrategy, TargetTriple}; use syntax::edition::Edition; -use syntax::symbol::Symbol; use syntax::{ast, attr}; use std::marker::PhantomData; diff --git a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs index f45246301d33e..4661d64564c3d 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs @@ -9,10 +9,10 @@ use rustc::mir::{Body, ConstraintCategory, Location}; use rustc::ty::{self, RegionVid, Ty}; use rustc_errors::DiagnosticBuilder; use rustc_index::vec::IndexVec; +use rustc_span::symbol::kw; use rustc_span::Span; use std::collections::VecDeque; use syntax::errors::Applicability; -use syntax::symbol::kw; use crate::util::borrowck_errors; diff --git a/src/librustc_mir/borrow_check/diagnostics/region_name.rs b/src/librustc_mir/borrow_check/diagnostics/region_name.rs index 3b8043e8f1bef..d66c38e753ac1 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_name.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_name.rs @@ -7,8 +7,8 @@ use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, RegionVid, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::DiagnosticBuilder; +use rustc_span::symbol::kw; use rustc_span::{symbol::Symbol, Span, DUMMY_SP}; -use syntax::symbol::kw; use crate::borrow_check::{ nll::ToRegionVid, region_infer::RegionInferenceContext, universal_regions::DefiningTy, diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs index 04a53bafe052b..6f223785601fc 100644 --- a/src/librustc_mir/borrow_check/nll.rs +++ b/src/librustc_mir/borrow_check/nll.rs @@ -9,13 +9,13 @@ use rustc::mir::{ use rustc::ty::{self, RegionKind, RegionVid}; use rustc_errors::Diagnostic; use rustc_index::vec::IndexVec; +use rustc_span::symbol::sym; use std::env; use std::fmt::Debug; use std::io; use std::path::PathBuf; use std::rc::Rc; use std::str::FromStr; -use syntax::symbol::sym; use self::mir_util::PassWhere; use polonius_engine::{Algorithm, Output}; diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 322898cc1812b..b265ab6b7becb 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -14,12 +14,12 @@ use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::HirIdMap; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::symbol::kw; use rustc_span::Span; use rustc_target::spec::abi::Abi; use rustc_target::spec::PanicStrategy; use std::u32; use syntax::attr::{self, UnwindAttr}; -use syntax::symbol::kw; use super::lints; diff --git a/src/librustc_mir/dataflow/generic.rs b/src/librustc_mir/dataflow/generic.rs index 7eb6f5cc073df..da2739fd0d6cd 100644 --- a/src/librustc_mir/dataflow/generic.rs +++ b/src/librustc_mir/dataflow/generic.rs @@ -28,7 +28,7 @@ use rustc::ty::{self, TyCtxt}; use rustc_data_structures::work_queue::WorkQueue; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; -use syntax::symbol::sym; +use rustc_span::symbol::sym; use crate::dataflow::BottomValue; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index fe18f6066bf72..e94f263348d8a 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -1,6 +1,6 @@ +use rustc_span::symbol::{sym, Symbol}; use syntax::ast::{self, MetaItem}; use syntax::print::pprust; -use syntax::symbol::{sym, Symbol}; use rustc_data_structures::work_queue::WorkQueue; use rustc_index::bit_set::{BitSet, HybridBitSet}; diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 5c3baaa6ddcd7..e81dc9ba16d83 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -16,9 +16,9 @@ use rustc::ty::subst::Subst; use rustc::ty::subst::{GenericArg, InternalSubsts}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_index::vec::Idx; +use rustc_span::symbol::{sym, Symbol}; use syntax::ast; use syntax::attr; -use syntax::symbol::{sym, Symbol}; #[derive(Clone)] pub struct Cx<'a, 'tcx> { diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 852b7bb4bd654..9461a06690212 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -1,8 +1,8 @@ use rustc::ty::adjustment::PointerCast; use rustc::ty::layout::{self, Size, TyLayout}; use rustc::ty::{self, Ty, TypeAndMut, TypeFoldable}; +use rustc_span::symbol::sym; use syntax::ast::FloatTy; -use syntax::symbol::sym; use rustc::mir::interpret::{InterpResult, PointerArithmetic, Scalar}; use rustc::mir::CastKind; diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index ebacae95b810b..8011de19e78ed 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -107,7 +107,7 @@ use rustc::ty::query::Providers; use rustc::ty::{self, DefIdTree, InstanceDef, TyCtxt}; use rustc::util::common::time; use rustc::util::nodemap::{DefIdSet, FxHashMap, FxHashSet}; -use syntax::symbol::Symbol; +use rustc_span::symbol::Symbol; use crate::monomorphize::collector::InliningMap; use crate::monomorphize::collector::{self, MonoItemCollectionMode}; diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index 37435fbf4d16f..605281326f65a 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -3,9 +3,9 @@ use rustc::hir::def_id::DefId; use rustc::session::config::nightly_options; use rustc::ty::TyCtxt; +use rustc_span::symbol::sym; use rustc_span::{Span, Symbol}; use syntax::feature_gate::feature_err; -use syntax::symbol::sym; use super::{ConstKind, Item}; diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 19cad453e25e6..94b3b51f0b379 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -9,8 +9,8 @@ use rustc::ty::cast::CastTy; use rustc::ty::{self, TyCtxt}; use rustc_error_codes::*; use rustc_index::bit_set::BitSet; +use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::symbol::sym; use std::borrow::Cow; use std::ops::Deref; diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 8b8f1b6f670ef..c637557344178 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -10,7 +10,7 @@ use rustc::ty::cast::CastTy; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; -use syntax::symbol::{sym, Symbol}; +use rustc_span::symbol::{sym, Symbol}; use std::ops::Bound; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 804e6dbb20251..819ed9a51e7bf 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -19,9 +19,9 @@ use rustc::mir::*; use rustc::ty::cast::CastTy; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, List, TyCtxt, TypeFoldable}; +use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::LitKind; -use syntax::symbol::sym; use rustc_index::vec::{Idx, IndexVec}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 7bb1a4e3921bf..3741ca17a1115 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -2,10 +2,10 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::{self, adjustment::PointerCast, Predicate, Ty, TyCtxt}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use std::borrow::Cow; use syntax::attr; -use syntax::symbol::{sym, Symbol}; type McfResult = Result<(), (Span, Cow<'static, str>)>; diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 7066ed906eb4f..394924f5d6a31 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -1,7 +1,7 @@ +use rustc_span::symbol::sym; use rustc_span::Span; use rustc_target::spec::abi::Abi; use syntax::ast; -use syntax::symbol::sym; use crate::transform::{MirPass, MirSource}; use rustc::hir::def_id::DefId; diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 59657cca1c6e3..038c4284f252b 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -12,13 +12,13 @@ use rustc::session::Session; use rustc_data_structures::fx::FxHashMap; use rustc_parse::validate_attr; use rustc_span::source_map::Spanned; +use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use std::mem; use syntax::ast::*; use syntax::attr; use syntax::expand::is_proc_macro_attr; use syntax::print::pprust; -use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{span_err, struct_span_err, walk_list}; diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index fc7f9c9e58c61..22f3533b1e4bc 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -18,7 +18,7 @@ use rustc::util::nodemap::FxHashSet; use rustc_data_structures::fx::FxHashMap; use rustc_span; -use syntax::symbol::sym; +use rustc_span::symbol::sym; use syntax::{ast, attr}; // Any local node that may call something in its body block should be diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index 65138fad43bd8..4e8b5c5f6b653 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -16,8 +16,8 @@ use rustc::util::nodemap::FxHashMap; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; +use rustc_span::symbol::{sym, Symbol}; use syntax::ast; -use syntax::symbol::{sym, Symbol}; struct DiagnosticItemCollector<'tcx> { // items from this crate diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index 3b7728a18d36d..3a7d1780d470d 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -6,10 +6,10 @@ use rustc::session::config::EntryFnType; use rustc::session::{config, Session}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::attr; use syntax::entry::EntryPointType; -use syntax::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index b0651c980481e..02eecc2998bb7 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -11,8 +11,8 @@ use rustc::ty::layout::TyLayout; use rustc::ty::ParamEnv; use rustc::ty::Ty; use rustc::ty::TyCtxt; +use rustc_span::symbol::sym; use syntax::ast::Attribute; -use syntax::symbol::sym; pub fn test_layout(tcx: TyCtxt<'_>) { if tcx.features().rustc_attrs { diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 2f486e3038fb8..0d39ea85b50aa 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -9,9 +9,9 @@ use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::middle::lib_features::LibFeatures; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::symbol::Symbol; use rustc_span::{sym, Span}; use syntax::ast::{Attribute, MetaItem, MetaItemKind}; -use syntax::symbol::Symbol; use rustc_error_codes::*; diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index b32f6420f6685..49664be9c7758 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -109,6 +109,7 @@ use rustc::util::nodemap::{HirIdMap, HirIdSet}; use errors::Applicability; use rustc_data_structures::fx::FxIndexMap; +use rustc_span::symbol::sym; use rustc_span::Span; use std::collections::VecDeque; use std::io; @@ -116,7 +117,6 @@ use std::io::prelude::*; use std::rc::Rc; use std::{fmt, u32}; use syntax::ast; -use syntax::symbol::sym; #[derive(Copy, Clone, PartialEq)] struct Variable(u32); diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index fcbc742b9a00b..686ed6c1345bc 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -12,11 +12,11 @@ use rustc::session::Session; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc::util::nodemap::{FxHashMap, FxHashSet}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast::Attribute; use syntax::attr::{self, Stability}; use syntax::feature_gate::feature_err; -use syntax::symbol::{sym, Symbol}; use std::cmp::Ordering; use std::mem::replace; diff --git a/src/librustc_plugin_impl/build.rs b/src/librustc_plugin_impl/build.rs index caa43b3380275..2424ee5a9df00 100644 --- a/src/librustc_plugin_impl/build.rs +++ b/src/librustc_plugin_impl/build.rs @@ -5,9 +5,9 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::attr; -use syntax::symbol::sym; struct RegistrarFinder { registrars: Vec<(hir::HirId, Span)>, diff --git a/src/librustc_plugin_impl/load.rs b/src/librustc_plugin_impl/load.rs index 3010691dba20d..2215e49ec977a 100644 --- a/src/librustc_plugin_impl/load.rs +++ b/src/librustc_plugin_impl/load.rs @@ -5,6 +5,7 @@ use rustc::middle::cstore::MetadataLoader; use rustc::session::Session; use rustc_metadata::locator; +use rustc_span::symbol::sym; use rustc_span::Span; use std::borrow::ToOwned; use std::env; @@ -12,7 +13,6 @@ use std::mem; use std::path::PathBuf; use syntax::ast::{Crate, Ident}; use syntax::struct_span_err; -use syntax::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 6c3053f016bf0..c4b113d7a935c 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -21,10 +21,10 @@ use rustc::ty::{self, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable}; use rustc::util::nodemap::HirIdSet; use rustc_data_structures::fx::FxHashSet; use rustc_span::hygiene::Transparency; +use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use syntax::ast::Ident; use syntax::attr; -use syntax::symbol::{kw, sym}; use std::marker::PhantomData; use std::{cmp, fmt, mem}; diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 66cb5b3c6531a..5304aced69fbf 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -33,13 +33,13 @@ use rustc_expand::base::SyntaxExtension; use rustc_expand::expand::AstFragment; use rustc_span::hygiene::{ExpnId, MacroKind}; use rustc_span::source_map::{respan, Spanned}; +use rustc_span::symbol::{kw, sym}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; use syntax::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; use syntax::ast::{Ident, Name}; use syntax::attr; use syntax::span_err; -use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; use syntax::visit::{self, Visitor}; diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs index 4662440ec31e1..5aea813c6b86d 100644 --- a/src/librustc_resolve/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -3,9 +3,9 @@ use rustc::hir::def_id::DefIndex; use rustc::hir::map::definitions::*; use rustc_expand::expand::AstFragment; use rustc_span::hygiene::ExpnId; +use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use syntax::ast::*; -use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; use syntax::visit; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 38b9f1ca22ad1..c4538ddc24226 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -12,11 +12,11 @@ use rustc::util::nodemap::FxHashSet; use rustc_feature::BUILTIN_ATTRIBUTES; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::SourceMap; +use rustc_span::symbol::{kw, Symbol}; use rustc_span::{BytePos, MultiSpan, Span}; use syntax::ast::{self, Ident, Path}; use syntax::print::pprust; use syntax::struct_span_err; -use syntax::symbol::{kw, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; use crate::imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver}; diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index c79a97f93f07f..eb2c4f79feff5 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -24,9 +24,9 @@ use rustc::{bug, span_bug}; use rustc_data_structures::ptr_key::PtrKey; use rustc_span::hygiene::ExpnId; +use rustc_span::symbol::kw; use rustc_span::{MultiSpan, Span}; use syntax::ast::{Ident, Name, NodeId}; -use syntax::symbol::kw; use syntax::util::lev_distance::find_best_match_for_name; use syntax::{struct_span_err, unwrap_or}; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index a0d59fa4829e8..796c8e07c93ff 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -18,11 +18,11 @@ use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; use rustc::hir::TraitCandidate; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc::{bug, lint, span_bug}; +use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use smallvec::{smallvec, SmallVec}; use syntax::ast::*; use syntax::ptr::P; -use syntax::symbol::{kw, sym}; use syntax::util::lev_distance::find_best_match_for_name; use syntax::visit::{self, FnKind, Visitor}; use syntax::{unwrap_or, walk_list}; diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 5e59efac53647..2c9263eab9c69 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -13,9 +13,9 @@ use rustc::hir::PrimTy; use rustc::session::config::nightly_options; use rustc::util::nodemap::FxHashSet; use rustc_span::hygiene::MacroKind; +use rustc_span::symbol::kw; use rustc_span::Span; use syntax::ast::{self, Expr, ExprKind, Ident, NodeId, Path, Ty, TyKind}; -use syntax::symbol::kw; use syntax::util::lev_distance::find_best_match_for_name; use rustc_error_codes::*; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 5c7f9cb6934ca..420e3d5c6de7a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -40,13 +40,13 @@ use errors::{Applicability, DiagnosticBuilder}; use rustc_expand::base::SyntaxExtension; use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency}; use rustc_span::source_map::Spanned; +use rustc_span::symbol::{kw, sym}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy}; use syntax::ast::{Crate, CRATE_NODE_ID}; use syntax::ast::{ItemKind, Path}; use syntax::attr; use syntax::print::pprust; -use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{struct_span_err, unwrap_or}; diff --git a/src/librustc_resolve/lifetimes.rs b/src/librustc_resolve/lifetimes.rs index 1f8573e44f1e1..e7d6cd2709d73 100644 --- a/src/librustc_resolve/lifetimes.rs +++ b/src/librustc_resolve/lifetimes.rs @@ -15,13 +15,13 @@ use errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc::lint; use rustc::session::Session; use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet}; +use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use std::borrow::Cow; use std::cell::Cell; use std::mem::{replace, take}; use syntax::ast; use syntax::attr; -use syntax::symbol::{kw, sym}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::{self, GenericParamKind, LifetimeParamKind}; diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index d5ac6a5179b30..d23c7013b5f87 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -12,8 +12,8 @@ use rustc::traits::{ use rustc::ty::query::Providers; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, List, TyCtxt}; +use rustc_span::symbol::sym; use syntax::ast; -use syntax::symbol::sym; use std::iter; diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 8934fd4df742a..609ce70057d0d 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -22,13 +22,13 @@ use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef}; use rustc::ty::wf::object_region_bounds; use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; +use rustc_span::symbol::sym; use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_target::spec::abi; use smallvec::SmallVec; use syntax::ast; use syntax::errors::pluralize; use syntax::feature_gate::feature_err; -use syntax::symbol::sym; use syntax::util::lev_distance::find_best_match_for_name; use std::collections::BTreeSet; diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index e079b42f81d5e..f9cc86b85095c 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -66,11 +66,11 @@ use rustc::ty::relate::RelateResult; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut}; use rustc_span; +use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; use smallvec::{smallvec, SmallVec}; use std::ops::Deref; use syntax::feature_gate; -use syntax::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 8f3b95a882f83..773c9a2665992 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -33,8 +33,8 @@ use rustc::ty::TypeFoldable; use rustc::ty::{AdtKind, Visibility}; use rustc_span::hygiene::DesugaringKind; use rustc_span::source_map::Span; +use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast; -use syntax::symbol::{kw, sym, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 66d3c797cf996..ce8edd70eb684 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -6,8 +6,8 @@ use rustc::traits::{ObligationCause, ObligationCauseCode}; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_span::symbol::Symbol; use rustc_target::spec::abi::Abi; -use syntax::symbol::Symbol; use rustc::hir; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 2487859582c33..43e0134ceda40 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -120,12 +120,12 @@ use rustc::ty::{ use rustc_index::vec::Idx; use rustc_span::hygiene::DesugaringKind; use rustc_span::source_map::{original_sp, DUMMY_SP}; +use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::{self, BytePos, MultiSpan, Span}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::attr; use syntax::feature_gate::feature_err; -use syntax::symbol::{kw, sym, Ident}; use syntax::util::parser::ExprPrecedence; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index bf2c6776d1aa5..e0ce95aa46b8b 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -10,10 +10,10 @@ use rustc::ty::{self, GenericParamDefKind, ToPredicate, Ty, TyCtxt, TypeFoldable use rustc::util::nodemap::{FxHashMap, FxHashSet}; use errors::DiagnosticBuilder; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast; use syntax::feature_gate; -use syntax::symbol::sym; use rustc::hir; use rustc::hir::itemlikevisit::ParItemLikeVisitor; diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index a19e6a113be61..ecf5aa576f54d 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -14,8 +14,8 @@ use rustc::ty::fold::{TypeFoldable, TypeFolder}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::DefIdSet; use rustc_data_structures::sync::Lrc; +use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::symbol::sym; use std::mem; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index dfbeb0353a61c..d13ddb28bf937 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -32,12 +32,12 @@ use rustc::util::captures::Captures; use rustc::util::nodemap::FxHashMap; use rustc_target::spec::abi; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast; use syntax::ast::{Ident, MetaItemKind}; use syntax::attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr}; use syntax::feature_gate; -use syntax::symbol::{kw, sym, Symbol}; use rustc::hir::def::{CtorKind, DefKind, Res}; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index a57553f3ea66c..992781e3bcbeb 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -4,8 +4,8 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::ty::query::Providers; use rustc::ty::subst::GenericArgKind; use rustc::ty::{self, CratePredicatesMap, TyCtxt}; +use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::symbol::sym; mod explicit; mod implicit_infer; diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 13430b752c11a..f29d2d8f42448 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -1,7 +1,7 @@ use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; -use syntax::symbol::sym; +use rustc_span::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index f098fb9de1009..69e05772906e0 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -1,7 +1,7 @@ use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; -use syntax::symbol::sym; +use rustc_span::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 8b739b704fba3..13df1892a5f17 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -8,9 +8,9 @@ use std::mem; use std::ops; use rustc_feature::Features; +use rustc_span::symbol::{sym, Symbol}; use syntax::ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; use syntax::sess::ParseSess; -use syntax::symbol::{sym, Symbol}; use rustc_span::Span; diff --git a/src/librustdoc/clean/cfg/tests.rs b/src/librustdoc/clean/cfg/tests.rs index 3ea971e3138d9..309f72040615d 100644 --- a/src/librustdoc/clean/cfg/tests.rs +++ b/src/librustdoc/clean/cfg/tests.rs @@ -1,9 +1,9 @@ use super::*; +use rustc_span::symbol::Symbol; use rustc_span::DUMMY_SP; use syntax::ast::*; use syntax::attr; -use syntax::symbol::Symbol; use syntax::with_default_globals; fn word_cfg(s: &str) -> Cfg { diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index d3169de632e48..57ec985285d59 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -3,9 +3,9 @@ use std::iter::once; use rustc_span::hygiene::MacroKind; +use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast; -use syntax::symbol::sym; use rustc::hir::def::{CtorKind, DefKind, Res}; use rustc::hir::def_id::DefId; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index cac3480f28d86..cb22039327e07 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -18,10 +18,10 @@ use rustc_resolve as resolve; use errors::emitter::{Emitter, EmitterWriter}; use errors::json::JsonEmitter; use rustc_span::source_map; +use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; use syntax::ast::CRATE_NODE_ID; use syntax::attr; -use syntax::symbol::sym; use rustc_data_structures::sync::{self, Lrc}; use std::cell::RefCell; diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index bf8a8fcd3a354..fb6bdcdc9f48b 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -13,9 +13,9 @@ use std::io::prelude::*; use rustc_parse::lexer; use rustc_span::source_map::SourceMap; +use rustc_span::symbol::{kw, sym}; use rustc_span::{FileName, Span}; use syntax::sess::ParseSess; -use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; /// Highlights `src`, returning the HTML output. diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 32d42b9c7347d..4758e48241f1c 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -52,12 +52,12 @@ use rustc_data_structures::flock; use rustc_feature::UnstableFeatures; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::FileName; +use rustc_span::symbol::{sym, Symbol}; use serde::ser::SerializeSeq; use serde::{Serialize, Serializer}; use syntax::ast; use syntax::edition::Edition; use syntax::print::pprust; -use syntax::symbol::{sym, Symbol}; use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy}; use crate::config::RenderOptions; diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index 04e7c3a616130..6de56ec5127ed 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -4,10 +4,10 @@ use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::middle::privacy::AccessLevels; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_span::source_map::FileName; +use rustc_span::symbol::sym; use std::collections::BTreeMap; use std::mem; use std::path::{Path, PathBuf}; -use syntax::symbol::sym; use serde::Serialize; diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 7432e8b0ce087..803bcc2cfdf86 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -3,9 +3,9 @@ use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass; +use rustc_span::symbol::sym; use rustc_span::FileName; use syntax::attr; -use syntax::symbol::sym; use std::collections::BTreeMap; use std::ops; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 7b89738b43cca..a8bb40a06b989 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -11,10 +11,10 @@ use rustc::ty; use rustc_expand::base::SyntaxExtensionKind; use rustc_feature::UnstableFeatures; use rustc_resolve::ParentScope; +use rustc_span::symbol::Symbol; use rustc_span::DUMMY_SP; use syntax; use syntax::ast::{self, Ident}; -use syntax::symbol::Symbol; use std::ops::Range; diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 4e0d1a101917d..63ad9a66a482d 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -5,7 +5,7 @@ use crate::fold::DocFolder; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::util::nodemap::FxHashSet; -use syntax::symbol::sym; +use rustc_span::symbol::sym; pub const COLLECT_TRAIT_IMPLS: Pass = Pass { name: "collect-trait-impls", diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index 379e2496a0a41..9698ad1d2312d 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -1,6 +1,6 @@ use rustc::util::nodemap::DefIdSet; +use rustc_span::symbol::sym; use std::mem; -use syntax::symbol::sym; use crate::clean::Item; use crate::clean::{self, AttributesExt, NestedAttributesExt}; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 312c6dad822aa..af06effa77daa 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -6,6 +6,7 @@ use rustc_data_structures::sync::Lrc; use rustc_feature::UnstableFeatures; use rustc_interface::interface; use rustc_span::source_map::SourceMap; +use rustc_span::symbol::sym; use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP}; use rustc_target::spec::TargetTriple; use std::env; @@ -16,7 +17,6 @@ use std::process::{self, Command, Stdio}; use std::str; use syntax::ast; use syntax::edition::Edition; -use syntax::symbol::sym; use syntax::with_globals; use tempfile::Builder as TempFileBuilder; use testing; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index c7a1739bb9130..959f61644d60d 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -9,9 +9,9 @@ use rustc::ty::TyCtxt; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::Spanned; +use rustc_span::symbol::sym; use rustc_span::{self, Span}; use syntax::ast; -use syntax::symbol::sym; use std::mem; diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index 591258ced9d0c..f8f82e17e8f4c 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -3,7 +3,7 @@ use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::middle::privacy::{AccessLevel, AccessLevels}; use rustc::ty::{TyCtxt, Visibility}; use rustc::util::nodemap::FxHashSet; -use syntax::symbol::sym; +use rustc_span::symbol::sym; use crate::clean::{AttributesExt, NestedAttributesExt}; diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index e0040d42aaf7a..8449b61f7b0bb 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -14,15 +14,15 @@ use crate::ast::{Expr, GenericParam, Item, Lit, LitKind, Local, Stmt, StmtKind}; use crate::ast::{MacArgs, MacDelimiter, MetaItem, MetaItemKind, NestedMetaItem}; use crate::mut_visit::visit_clobber; use crate::ptr::P; -use crate::symbol::{sym, Symbol}; use crate::token::{self, Token}; use crate::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use crate::GLOBALS; -use log::debug; use rustc_span::source_map::{BytePos, Spanned}; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; +use log::debug; use std::iter; use std::ops::DerefMut; diff --git a/src/libsyntax/entry.rs b/src/libsyntax/entry.rs index a896da5629f53..0a72019bfe986 100644 --- a/src/libsyntax/entry.rs +++ b/src/libsyntax/entry.rs @@ -1,6 +1,6 @@ use crate::ast::{Item, ItemKind}; use crate::attr; -use crate::symbol::sym; +use rustc_span::symbol::sym; pub enum EntryPointType { None, diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 41cde019fe0fd..4ccec421483b0 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -3,7 +3,6 @@ use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData} use crate::attr; use crate::edition::{Edition, ALL_EDITIONS}; use crate::sess::ParseSess; -use crate::symbol::{sym, Symbol}; use crate::visit::{self, FnKind, Visitor}; use errors::{Applicability, DiagnosticBuilder, Handler}; @@ -16,6 +15,7 @@ use rustc_feature::{ ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, }; use rustc_span::source_map::Spanned; +use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; use log::debug; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 40d86f5fb75d0..3815aa6d77459 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -97,7 +97,6 @@ pub mod ptr; pub mod show_span; pub use rustc_session::parse as sess; pub use rustc_span::edition; -pub use rustc_span::symbol; pub mod token; pub mod tokenstream; pub mod visit; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 90037324e56b9..dd9976510dccf 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -6,7 +6,6 @@ use crate::print::pp::Breaks::{Consistent, Inconsistent}; use crate::print::pp::{self, Breaks}; use crate::ptr::P; use crate::sess::ParseSess; -use crate::symbol::{kw, sym}; use crate::token::{self, BinOpToken, DelimToken, Nonterminal, Token, TokenKind}; use crate::tokenstream::{self, TokenStream, TokenTree}; use crate::util::classify; @@ -14,6 +13,7 @@ use crate::util::comments; use crate::util::parser::{self, AssocOp, Fixity}; use rustc_span::source_map::{dummy_spanned, SourceMap, Spanned}; +use rustc_span::symbol::{kw, sym}; use rustc_span::{BytePos, FileName, Span}; use std::borrow::Cow; diff --git a/src/libsyntax/token.rs b/src/libsyntax/token.rs index 9e63f8496049b..14279561cbb8d 100644 --- a/src/libsyntax/token.rs +++ b/src/libsyntax/token.rs @@ -6,15 +6,14 @@ pub use TokenKind::*; use crate::ast; use crate::ptr::P; -use crate::symbol::kw; use crate::tokenstream::TokenTree; -use rustc_span::symbol::Symbol; -use rustc_span::{self, Span, DUMMY_SP}; - use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_macros::HashStable_Generic; +use rustc_span::symbol::kw; +use rustc_span::symbol::Symbol; +use rustc_span::{self, Span, DUMMY_SP}; use std::fmt; use std::mem; diff --git a/src/libsyntax/util/lev_distance.rs b/src/libsyntax/util/lev_distance.rs index f55b58d7d137a..fc697026fe4f8 100644 --- a/src/libsyntax/util/lev_distance.rs +++ b/src/libsyntax/util/lev_distance.rs @@ -1,4 +1,6 @@ -use crate::symbol::Symbol; +// FIXME(Centril): Move to rustc_span? + +use rustc_span::symbol::Symbol; use std::cmp; #[cfg(test)] diff --git a/src/libsyntax/util/literal.rs b/src/libsyntax/util/literal.rs index 3b156e03d3eb6..dd06c25b4de0f 100644 --- a/src/libsyntax/util/literal.rs +++ b/src/libsyntax/util/literal.rs @@ -1,17 +1,17 @@ //! Code related to parsing literals. use crate::ast::{self, Lit, LitKind}; -use crate::symbol::{kw, sym, Symbol}; use crate::token::{self, Token}; use crate::tokenstream::TokenTree; -use log::debug; use rustc_data_structures::sync::Lrc; use rustc_lexer::unescape::{unescape_byte, unescape_char}; use rustc_lexer::unescape::{unescape_byte_str, unescape_str}; use rustc_lexer::unescape::{unescape_raw_byte_str, unescape_raw_str}; +use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; +use log::debug; use std::ascii; pub enum LitError { diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index 98af382efb083..a0ed89a9caef1 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -1,6 +1,6 @@ use crate::ast::{self, BinOpKind}; -use crate::symbol::kw; use crate::token::{self, BinOpToken, Token}; +use rustc_span::symbol::kw; /// Associative operator with precedence. /// From b1aad76586a9816ae577f5338982c4cbcee9a6a5 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 1 Jan 2020 19:40:49 +0100 Subject: [PATCH 12/17] Normalize `syntax::edition` imports. --- src/librustc/lint/builtin.rs | 2 +- src/librustc_builtin_macros/lib.rs | 2 +- .../standard_library_imports.rs | 2 +- src/librustc_expand/base.rs | 2 +- src/librustc_expand/mbe/macro_rules.rs | 2 +- src/librustc_interface/tests.rs | 2 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_metadata/creader.rs | 2 +- src/librustc_metadata/rmeta/mod.rs | 2 +- src/librustc_parse/config.rs | 2 +- src/librustc_resolve/macros.rs | 2 +- src/librustdoc/config.rs | 2 +- src/librustdoc/externalfiles.rs | 2 +- src/librustdoc/html/markdown.rs | 6 +++--- src/librustdoc/html/markdown/tests.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/librustdoc/markdown.rs | 2 +- src/librustdoc/test.rs | 2 +- src/librustdoc/test/tests.rs | 2 +- src/libsyntax/feature_gate/check.rs | 2 +- src/libsyntax/lib.rs | 15 ++++----------- src/tools/error_index_generator/main.rs | 3 ++- 22 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index aab0db4e4e34f..847c61033daf4 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -9,11 +9,11 @@ use crate::middle::stability; use crate::session::Session; use errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc_session::declare_lint; +use rustc_span::edition::Edition; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; use syntax::ast; use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE}; -use syntax::edition::Edition; declare_lint! { pub EXCEEDING_BITSHIFTS, diff --git a/src/librustc_builtin_macros/lib.rs b/src/librustc_builtin_macros/lib.rs index 066e3a26445a6..c735ba0df3b31 100644 --- a/src/librustc_builtin_macros/lib.rs +++ b/src/librustc_builtin_macros/lib.rs @@ -15,9 +15,9 @@ use crate::deriving::*; use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::BangProcMacro; +use rustc_span::edition::Edition; use rustc_span::symbol::sym; use syntax::ast::Ident; -use syntax::edition::Edition; mod asm; mod assert; diff --git a/src/librustc_builtin_macros/standard_library_imports.rs b/src/librustc_builtin_macros/standard_library_imports.rs index b56a2f5254a17..0c982b21eee2c 100644 --- a/src/librustc_builtin_macros/standard_library_imports.rs +++ b/src/librustc_builtin_macros/standard_library_imports.rs @@ -1,9 +1,9 @@ use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::ExpansionConfig; +use rustc_span::edition::Edition; use rustc_span::hygiene::AstPass; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::DUMMY_SP; -use syntax::edition::Edition; use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::{ast, attr}; diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index e53a7c992749f..fe08c85249a2e 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -1,11 +1,11 @@ use crate::expand::{self, AstFragment, Invocation}; use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS}; +use rustc_span::edition::Edition; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use syntax::ast::{self, Attribute, Name, NodeId, PatKind}; use syntax::attr::{self, Deprecation, HasAttrs, Stability}; -use syntax::edition::Edition; use syntax::mut_visit::{self, MutVisitor}; use syntax::ptr::P; use syntax::sess::ParseSess; diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index 3c3f3a44db05c..6e965346d30e9 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -11,12 +11,12 @@ use crate::mbe::transcribe::transcribe; use rustc_feature::Features; use rustc_parse::parser::Parser; use rustc_parse::Directory; +use rustc_span::edition::Edition; use rustc_span::hygiene::Transparency; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast; use syntax::attr::{self, TransparencyError}; -use syntax::edition::Edition; use syntax::print::pprust; use syntax::sess::ParseSess; use syntax::token::{self, NtTT, Token, TokenKind::*}; diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs index 182b1e7861b12..25ab7650b0ec2 100644 --- a/src/librustc_interface/tests.rs +++ b/src/librustc_interface/tests.rs @@ -12,13 +12,13 @@ use rustc::session::search_paths::SearchPath; use rustc::session::{build_session, Session}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig}; +use rustc_span::edition::{Edition, DEFAULT_EDITION}; use rustc_span::symbol::sym; use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel}; use std::collections::{BTreeMap, BTreeSet}; use std::iter::FromIterator; use std::path::PathBuf; use syntax; -use syntax::edition::{Edition, DEFAULT_EDITION}; type CfgSpecs = FxHashSet<(String, Option)>; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index f1e3951e14925..055b1f8b366d8 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -37,12 +37,12 @@ use rustc::util::nodemap::FxHashSet; use rustc_feature::Stability; use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType}; +use rustc_span::edition::Edition; use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{BytePos, Span}; use syntax::ast::{self, Expr}; use syntax::attr::{self, HasAttrs}; -use syntax::edition::Edition; use syntax::errors::{Applicability, DiagnosticBuilder}; use syntax::print::pprust::{self, expr_to_string}; use syntax::ptr::P; diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 02c912ff7407e..f95801d6fb15a 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -23,11 +23,11 @@ use std::{cmp, fs}; use log::{debug, info, log_enabled}; use proc_macro::bridge::client::ProcMacro; use rustc_expand::base::SyntaxExtension; +use rustc_span::edition::Edition; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast; use syntax::attr; -use syntax::edition::Edition; use syntax::expand::allocator::{global_allocator_spans, AllocatorKind}; use syntax::span_fatal; diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 66637cf97b5bf..40b0ec74a4a33 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -15,10 +15,10 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; use rustc_index::vec::IndexVec; use rustc_serialize::opaque::Encoder; +use rustc_span::edition::Edition; use rustc_span::symbol::Symbol; use rustc_span::{self, Span}; use rustc_target::spec::{PanicStrategy, TargetTriple}; -use syntax::edition::Edition; use syntax::{ast, attr}; use std::marker::PhantomData; diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index 0dbbda37ee411..f2ffd9470ed76 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -11,12 +11,12 @@ use crate::{parse_in, validate_attr}; use rustc_errors::Applicability; use rustc_feature::Features; +use rustc_span::edition::Edition; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast::{self, AttrItem, Attribute, MetaItem}; use syntax::attr; use syntax::attr::HasAttrs; -use syntax::edition::Edition; use syntax::feature_gate::{feature_err, get_features}; use syntax::mut_visit::*; use syntax::ptr::P; diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 0903afeef4da4..4c95607410bd7 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -17,12 +17,12 @@ use rustc_expand::base::{self, Indeterminate, InvocationRes}; use rustc_expand::compile_declarative_macro; use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; use rustc_feature::is_builtin_attr_name; +use rustc_span::edition::Edition; use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Ident, NodeId}; use syntax::attr::{self, StabilityLevel}; -use syntax::edition::Edition; use syntax::feature_gate::feature_err; use syntax::print::pprust; diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 25a892062fcbb..4a65a9f431a44 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -15,8 +15,8 @@ use rustc::session::config::{parse_crate_types_from_list, parse_externs, CrateTy use rustc::session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, Externs}; use rustc::session::search_paths::SearchPath; use rustc_driver; +use rustc_span::edition::{Edition, DEFAULT_EDITION}; use rustc_target::spec::TargetTriple; -use syntax::edition::{Edition, DEFAULT_EDITION}; use crate::core::new_handler; use crate::externalfiles::ExternalHtml; diff --git a/src/librustdoc/externalfiles.rs b/src/librustdoc/externalfiles.rs index ec1c6890230c1..e0ed02c11c71a 100644 --- a/src/librustdoc/externalfiles.rs +++ b/src/librustdoc/externalfiles.rs @@ -1,5 +1,5 @@ use crate::html::markdown::{ErrorCodes, IdMap, Markdown, Playground}; -use crate::syntax::edition::Edition; +use crate::rustc_span::edition::Edition; use errors; use rustc_feature::UnstableFeatures; use std::fs; diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 4250d4305f3c5..c5f88f9f7f421 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -5,9 +5,9 @@ //! ``` //! #![feature(rustc_private)] //! -//! extern crate syntax; +//! extern crate rustc_span; //! -//! use syntax::edition::Edition; +//! use rustc_span::edition::Edition; //! use rustdoc::html::markdown::{IdMap, Markdown, ErrorCodes}; //! //! let s = "My *markdown* _text_"; @@ -20,6 +20,7 @@ #![allow(non_camel_case_types)] use rustc_data_structures::fx::FxHashMap; +use rustc_span::edition::Edition; use std::borrow::Cow; use std::cell::RefCell; use std::collections::VecDeque; @@ -27,7 +28,6 @@ use std::default::Default; use std::fmt::Write; use std::ops::Range; use std::str; -use syntax::edition::Edition; use crate::html::highlight; use crate::html::toc::TocBuilder; diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index 862c6c56c78f8..48231ce7b73ef 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -1,7 +1,7 @@ use super::plain_summary_line; use super::{ErrorCodes, IdMap, Ignore, LangString, Markdown, MarkdownHtml}; +use rustc_span::edition::{Edition, DEFAULT_EDITION}; use std::cell::RefCell; -use syntax::edition::{Edition, DEFAULT_EDITION}; #[test] fn test_unique_id() { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 4758e48241f1c..ad059463aa43a 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -50,13 +50,13 @@ use rustc::middle::stability; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::flock; use rustc_feature::UnstableFeatures; +use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::FileName; use rustc_span::symbol::{sym, Symbol}; use serde::ser::SerializeSeq; use serde::{Serialize, Serializer}; use syntax::ast; -use syntax::edition::Edition; use syntax::print::pprust; use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy}; diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 95edff4ba8099..69aa248aa8e98 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -4,8 +4,8 @@ use std::path::PathBuf; use errors; use rustc_feature::UnstableFeatures; +use rustc_span::edition::Edition; use rustc_span::source_map::DUMMY_SP; -use syntax::edition::Edition; use testing; use crate::config::{Options, RenderOptions}; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index af06effa77daa..d7285b9d0bb07 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -5,6 +5,7 @@ use rustc::util::common::ErrorReported; use rustc_data_structures::sync::Lrc; use rustc_feature::UnstableFeatures; use rustc_interface::interface; +use rustc_span::edition::Edition; use rustc_span::source_map::SourceMap; use rustc_span::symbol::sym; use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP}; @@ -16,7 +17,6 @@ use std::path::PathBuf; use std::process::{self, Command, Stdio}; use std::str; use syntax::ast; -use syntax::edition::Edition; use syntax::with_globals; use tempfile::Builder as TempFileBuilder; use testing; diff --git a/src/librustdoc/test/tests.rs b/src/librustdoc/test/tests.rs index b041251b7d312..a96186a95e16b 100644 --- a/src/librustdoc/test/tests.rs +++ b/src/librustdoc/test/tests.rs @@ -1,5 +1,5 @@ use super::{make_test, TestOptions}; -use syntax::edition::DEFAULT_EDITION; +use rustc_span::edition::DEFAULT_EDITION; #[test] fn make_test_basic() { diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 4ccec421483b0..50712058874c4 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -1,7 +1,6 @@ use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId}; use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; use crate::attr; -use crate::edition::{Edition, ALL_EDITIONS}; use crate::sess::ParseSess; use crate::visit::{self, FnKind, Visitor}; @@ -14,6 +13,7 @@ use rustc_feature::{Feature, Features, State as FeatureState, UnstableFeatures}; use rustc_feature::{ ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, }; +use rustc_span::edition::{Edition, ALL_EDITIONS}; use rustc_span::source_map::Spanned; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 3815aa6d77459..0b0a19517ec1a 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -21,7 +21,7 @@ use ast::AttrId; pub use errors; use rustc_data_structures::sync::Lock; use rustc_index::bit_set::GrowableBitSet; -use rustc_span::edition::Edition; +use rustc_span::edition::{Edition, DEFAULT_EDITION}; #[macro_export] macro_rules! unwrap_or { @@ -51,19 +51,13 @@ impl Globals { } } -pub fn with_globals(edition: Edition, f: F) -> R -where - F: FnOnce() -> R, -{ +pub fn with_globals(edition: Edition, f: impl FnOnce() -> R) -> R { let globals = Globals::new(edition); GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals.rustc_span_globals, f)) } -pub fn with_default_globals(f: F) -> R -where - F: FnOnce() -> R, -{ - with_globals(edition::DEFAULT_EDITION, f) +pub fn with_default_globals(f: impl FnOnce() -> R) -> R { + with_globals(DEFAULT_EDITION, f) } scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals); @@ -96,7 +90,6 @@ pub mod mut_visit; pub mod ptr; pub mod show_span; pub use rustc_session::parse as sess; -pub use rustc_span::edition; pub mod token; pub mod tokenstream; pub mod visit; diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index c1777f7ea0329..313a303edb2bf 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -2,6 +2,7 @@ #![deny(warnings)] extern crate env_logger; +extern crate rustc_span; extern crate syntax; use std::cell::RefCell; @@ -13,7 +14,7 @@ use std::io::Write; use std::path::Path; use std::path::PathBuf; -use syntax::edition::DEFAULT_EDITION; +use rustc_span::edition::DEFAULT_EDITION; use rustdoc::html::markdown::{ErrorCodes, IdMap, Markdown, Playground}; From bebdb44e5d4600c27d99b716079cb28b9aec5627 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 1 Jan 2020 21:11:02 +0100 Subject: [PATCH 13/17] syntax::map_in_place: leave fixme --- src/libsyntax/util/map_in_place.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libsyntax/util/map_in_place.rs b/src/libsyntax/util/map_in_place.rs index 5dd9fc6e8bc08..a237a6e6162c0 100644 --- a/src/libsyntax/util/map_in_place.rs +++ b/src/libsyntax/util/map_in_place.rs @@ -1,3 +1,5 @@ +// FIXME(Centril): Move to rustc_data_structures. + use smallvec::{Array, SmallVec}; use std::ptr; From 6e4ea1476a39b8a74ae6da0a53a7f1136bbf5a97 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 2 Jan 2020 00:01:07 +0100 Subject: [PATCH 14/17] fix src/test fallout --- .../run-make-fulldeps/hotplug_codegen_backend/the_backend.rs | 4 ++-- src/test/run-make-fulldeps/issue-19371/foo.rs | 4 ++-- src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs | 5 +++-- src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs | 5 +++-- src/test/ui-fulldeps/auxiliary/lint-for-crate.rs | 5 +++-- src/test/ui-fulldeps/mod_dir_path_canonicalized.rs | 3 ++- src/test/ui-fulldeps/pprust-expr-roundtrip.rs | 5 +++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index eb96c61060b39..84b8c7c6e43c7 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -1,17 +1,17 @@ #![feature(rustc_private)] -extern crate syntax; extern crate rustc; extern crate rustc_codegen_utils; #[macro_use] extern crate rustc_data_structures; extern crate rustc_target; extern crate rustc_driver; +extern crate rustc_span; use std::any::Any; use std::sync::Arc; use std::path::Path; -use syntax::symbol::Symbol; +use rustc_span::symbol::Symbol; use rustc::session::Session; use rustc::session::config::OutputFilenames; use rustc::ty::TyCtxt; diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index 62a66aefd2deb..12da64fc88f18 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -3,13 +3,13 @@ extern crate rustc; extern crate rustc_interface; extern crate rustc_driver; -extern crate syntax; +extern crate rustc_span; use rustc::session::DiagnosticOutput; use rustc::session::config::{Input, Options, OutputType, OutputTypes}; use rustc_interface::interface; -use syntax::source_map::FileName; +use rustc_span::source_map::FileName; use std::path::PathBuf; diff --git a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs index e9ef58f29a8f5..6163f270fe313 100644 --- a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs @@ -4,13 +4,14 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_span; extern crate syntax; -use rustc_driver::plugin::Registry; use rustc::hir::{self, intravisit, Node}; use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; +use rustc_driver::plugin::Registry; +use rustc_span::source_map; use syntax::print::pprust; -use syntax::source_map; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs index 118ba1711191b..47751f4711f4d 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs @@ -5,13 +5,14 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_span; extern crate syntax; +use rustc::hir; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass}; use rustc_driver::plugin::Registry; -use rustc::hir; +use rustc_span::symbol::Symbol; use syntax::attr; -use syntax::symbol::Symbol; macro_rules! fake_lint_pass { ($struct:ident, $($attr:expr),*) => { diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs index 49ca43d471ba9..4821c9b02fe19 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -6,13 +6,14 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_span; extern crate syntax; +use rustc::hir; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LintArray}; use rustc_driver::plugin::Registry; -use rustc::hir; +use rustc_span::symbol::Symbol; use syntax::attr; -use syntax::symbol::Symbol; declare_lint! { CRATE_NOT_OKAY, diff --git a/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs b/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs index 51aa5f24e4ce9..2b4a9fb21e4c7 100644 --- a/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs +++ b/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs @@ -6,11 +6,12 @@ extern crate syntax; extern crate rustc_parse; +extern crate rustc_span; use rustc_parse::new_parser_from_file; +use rustc_span::source_map::FilePathMapping; use std::path::Path; use syntax::sess::ParseSess; -use syntax::source_map::FilePathMapping; #[path = "mod_dir_simple/test.rs"] mod gravy; diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index 59813322e5b25..04d1054e2877f 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -22,13 +22,14 @@ extern crate rustc_data_structures; extern crate syntax; extern crate rustc_parse; +extern crate rustc_span; use rustc_data_structures::thin_vec::ThinVec; use rustc_parse::new_parser_from_source_str; +use rustc_span::source_map::{Spanned, DUMMY_SP, FileName}; +use rustc_span::source_map::FilePathMapping; use syntax::ast::*; use syntax::sess::ParseSess; -use syntax::source_map::{Spanned, DUMMY_SP, FileName}; -use syntax::source_map::FilePathMapping; use syntax::mut_visit::{self, MutVisitor, visit_clobber}; use syntax::print::pprust; use syntax::ptr::P; From 485e98aae2f4d6e7d795eb13170a08407a776fdf Mon Sep 17 00:00:00 2001 From: Charles Lew Date: Thu, 2 Jan 2020 20:02:22 +0800 Subject: [PATCH 15/17] Implement uncommon_codepoints lint. --- Cargo.lock | 16 ++++++++++ src/librustc_lint/Cargo.toml | 1 + src/librustc_lint/non_ascii_idents.rs | 25 ++++++++++++--- src/test/ui/issues/issue-48508.rs | 1 + .../lint-uncommon-codepoints.rs | 11 +++++++ .../lint-uncommon-codepoints.stderr | 32 +++++++++++++++++++ src/tools/tidy/src/deps.rs | 2 ++ 7 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs create mode 100644 src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr diff --git a/Cargo.lock b/Cargo.lock index ba0f55ab5af6f..45a1a169be446 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3642,6 +3642,7 @@ dependencies = [ "rustc_span", "rustc_target", "syntax", + "unicode-security", ] [[package]] @@ -4940,6 +4941,21 @@ dependencies = [ "smallvec 1.0.0", ] +[[package]] +name = "unicode-script" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b2c5c29e805da6817f5af6a627d65adb045cebf05cccd5a3493d6109454391c" + +[[package]] +name = "unicode-security" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c49d35967fa037b881acc34ef717c38c4b5560eba10e3685271b3f530bb19634" +dependencies = [ + "unicode-script", +] + [[package]] name = "unicode-segmentation" version = "1.6.0" diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index 600f7031ed5c0..a40c5d1697c43 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -10,6 +10,7 @@ path = "lib.rs" [dependencies] log = "0.4" +unicode-security = "0.0.2" rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } diff --git a/src/librustc_lint/non_ascii_idents.rs b/src/librustc_lint/non_ascii_idents.rs index 9ec8455394295..f30d0bcbdd53f 100644 --- a/src/librustc_lint/non_ascii_idents.rs +++ b/src/librustc_lint/non_ascii_idents.rs @@ -7,15 +7,32 @@ declare_lint! { "detects non-ASCII identifiers" } -declare_lint_pass!(NonAsciiIdents => [NON_ASCII_IDENTS]); +declare_lint! { + pub UNCOMMON_CODEPOINTS, + Warn, + "detects uncommon Unicode codepoints in identifiers" +} + +declare_lint_pass!(NonAsciiIdents => [NON_ASCII_IDENTS, UNCOMMON_CODEPOINTS]); impl EarlyLintPass for NonAsciiIdents { fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: ast::Ident) { - if !ident.name.as_str().is_ascii() { + use unicode_security::GeneralSecurityProfile; + let name_str = ident.name.as_str(); + if name_str.is_ascii() { + return; + } + cx.struct_span_lint( + NON_ASCII_IDENTS, + ident.span, + "identifier contains non-ASCII characters", + ) + .emit(); + if !name_str.chars().all(GeneralSecurityProfile::identifier_allowed) { cx.struct_span_lint( - NON_ASCII_IDENTS, + UNCOMMON_CODEPOINTS, ident.span, - "identifier contains non-ASCII characters", + "identifier contains uncommon Unicode codepoints", ) .emit(); } diff --git a/src/test/ui/issues/issue-48508.rs b/src/test/ui/issues/issue-48508.rs index b7aa642287638..87965c204ada7 100644 --- a/src/test/ui/issues/issue-48508.rs +++ b/src/test/ui/issues/issue-48508.rs @@ -11,6 +11,7 @@ // ignore-asmjs wasm2js does not support source maps yet #![feature(non_ascii_idents)] +#[allow(uncommon_codepoints)] #[path = "issue-48508-aux.rs"] mod other_file; diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs new file mode 100644 index 0000000000000..7ac0d035d5bf1 --- /dev/null +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs @@ -0,0 +1,11 @@ +#![feature(non_ascii_idents)] +#![deny(uncommon_codepoints)] + +const µ: f64 = 0.000001; //~ ERROR identifier contains uncommon Unicode codepoints + +fn dijkstra() {} //~ ERROR identifier contains uncommon Unicode codepoints + +fn main() { + let ㇻㇲㇳ = "rust"; //~ ERROR identifier contains uncommon Unicode codepoints + println!("{}", ㇻㇲㇳ); //~ ERROR identifier contains uncommon Unicode codepoints +} diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr new file mode 100644 index 0000000000000..4580d25665ef9 --- /dev/null +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr @@ -0,0 +1,32 @@ +error: identifier contains uncommon Unicode codepoints + --> $DIR/lint-uncommon-codepoints.rs:4:7 + | +LL | const µ: f64 = 0.000001; + | ^ + | +note: lint level defined here + --> $DIR/lint-uncommon-codepoints.rs:2:9 + | +LL | #![deny(uncommon_codepoints)] + | ^^^^^^^^^^^^^^^^^^^ + +error: identifier contains uncommon Unicode codepoints + --> $DIR/lint-uncommon-codepoints.rs:6:4 + | +LL | fn dijkstra() {} + | ^^^^^^^ + +error: identifier contains uncommon Unicode codepoints + --> $DIR/lint-uncommon-codepoints.rs:9:9 + | +LL | let ㇻㇲㇳ = "rust"; + | ^^^^^^ + +error: identifier contains uncommon Unicode codepoints + --> $DIR/lint-uncommon-codepoints.rs:10:20 + | +LL | println!("{}", ㇻㇲㇳ); + | ^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index a3042803dd7e1..352c00dbe41bd 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -171,6 +171,8 @@ const WHITELIST: &[Crate<'_>] = &[ Crate("thread_local"), Crate("ucd-util"), Crate("unicode-normalization"), + Crate("unicode-script"), + Crate("unicode-security"), Crate("unicode-width"), Crate("unicode-xid"), Crate("unreachable"), From 7fd014d56986d7b52c49f07fb8db9529059d839d Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Fri, 3 Jan 2020 08:40:15 -0500 Subject: [PATCH 16/17] tweak wording of mismatched delimiter errors --- src/librustc_parse/lexer/tokentrees.rs | 10 +++++----- src/librustc_parse/parser/mod.rs | 8 ++++---- src/test/ui/issues/issue-62554.rs | 2 +- src/test/ui/issues/issue-62554.stderr | 14 +++++++------- src/test/ui/parser-recovery-1.rs | 2 +- src/test/ui/parser-recovery-1.stderr | 8 ++++---- src/test/ui/parser-recovery-2.rs | 2 +- src/test/ui/parser-recovery-2.stderr | 6 +++--- src/test/ui/parser/issue-10636-1.rs | 6 +++--- src/test/ui/parser/issue-10636-1.stderr | 6 +++--- src/test/ui/parser/issue-2354-1.rs | 2 +- src/test/ui/parser/issue-2354-1.stderr | 4 ++-- src/test/ui/parser/issue-2354.rs | 4 ++-- src/test/ui/parser/issue-2354.stderr | 8 ++++---- ...e-58094-missing-right-square-bracket.stderr | 4 ++-- src/test/ui/parser/issue-62524.stderr | 4 ++-- src/test/ui/parser/issue-62546.rs | 2 +- src/test/ui/parser/issue-62546.stderr | 8 ++++---- src/test/ui/parser/issue-62881.rs | 2 +- src/test/ui/parser/issue-62881.stderr | 8 ++++---- src/test/ui/parser/issue-62973.stderr | 18 +++++++++--------- src/test/ui/parser/issue-63116.stderr | 4 ++-- src/test/ui/parser/issue-63135.stderr | 6 +++--- .../macro-mismatched-delim-brace-paren.rs | 2 +- .../macro-mismatched-delim-brace-paren.stderr | 6 +++--- .../macro-mismatched-delim-paren-brace.rs | 4 ++-- .../macro-mismatched-delim-paren-brace.stderr | 10 +++++----- .../ui/parser/mbe_missing_right_paren.stderr | 4 ++-- .../missing-close-brace-in-impl-trait.rs | 2 +- .../missing-close-brace-in-impl-trait.stderr | 8 ++++---- .../missing-close-brace-in-struct.rs | 2 +- .../missing-close-brace-in-struct.stderr | 8 ++++---- .../missing-close-brace-in-trait.rs | 2 +- .../missing-close-brace-in-trait.stderr | 10 +++++----- .../mismatched-delim-brace-empty-block.rs | 2 +- .../mismatched-delim-brace-empty-block.stderr | 4 ++-- src/test/ui/parser/missing_right_paren.stderr | 6 +++--- src/test/ui/parser/unclosed-braces.rs | 4 ++-- src/test/ui/parser/unclosed-braces.stderr | 8 ++++---- .../ui/parser/unclosed-delimiter-in-dep.stderr | 8 ++++---- src/test/ui/parser/unclosed_delim_mod.rs | 2 +- src/test/ui/parser/unclosed_delim_mod.stderr | 8 ++++---- .../unmatched-delimiter-at-end-of-file.rs | 2 +- .../unmatched-delimiter-at-end-of-file.stderr | 6 +++--- .../ui/proc-macro/invalid-punct-ident-4.rs | 2 +- .../ui/proc-macro/invalid-punct-ident-4.stderr | 4 ++-- src/test/ui/resolve/token-error-correct-2.rs | 2 +- .../ui/resolve/token-error-correct-2.stderr | 6 +++--- src/test/ui/resolve/token-error-correct.rs | 2 +- src/test/ui/resolve/token-error-correct.stderr | 8 ++++---- 50 files changed, 135 insertions(+), 135 deletions(-) diff --git a/src/librustc_parse/lexer/tokentrees.rs b/src/librustc_parse/lexer/tokentrees.rs index 5beda290b9144..a28bff3babfbf 100644 --- a/src/librustc_parse/lexer/tokentrees.rs +++ b/src/librustc_parse/lexer/tokentrees.rs @@ -78,11 +78,11 @@ impl<'a> TokenTreesReader<'a> { let sm = self.string_reader.sess.source_map(); match self.token.kind { token::Eof => { - let msg = "this file contains an un-closed delimiter"; + let msg = "this file contains an unclosed delimiter"; let mut err = self.string_reader.sess.span_diagnostic.struct_span_err(self.token.span, msg); for &(_, sp) in &self.open_braces { - err.span_label(sp, "un-closed delimiter"); + err.span_label(sp, "unclosed delimiter"); self.unmatched_braces.push(UnmatchedBrace { expected_delim: token::DelimToken::Brace, found_delim: None, @@ -155,7 +155,7 @@ impl<'a> TokenTreesReader<'a> { close_brace_span, )); } - // Parse the close delimiter. + // Parse the closing delimiter. self.real_token(); } // Incorrect delimiter. @@ -218,7 +218,7 @@ impl<'a> TokenTreesReader<'a> { // An unexpected closing delimiter (i.e., there is no // matching opening delimiter). let token_str = token_to_string(&self.token); - let msg = format!("unexpected close delimiter: `{}`", token_str); + let msg = format!("unexpected closing delimiter: `{}`", token_str); let mut err = self.string_reader.sess.span_diagnostic.struct_span_err(self.token.span, &msg); @@ -228,7 +228,7 @@ impl<'a> TokenTreesReader<'a> { "this block is empty, you might have not meant to close it", ); } - err.span_label(self.token.span, "unexpected close delimiter"); + err.span_label(self.token.span, "unexpected closing delimiter"); Err(err) } _ => { diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs index 6dcffcf0bd7b8..a2fa335cf72e2 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -1354,16 +1354,16 @@ crate fn make_unclosed_delims_error( let mut err = sess.span_diagnostic.struct_span_err( unmatched.found_span, &format!( - "incorrect close delimiter: `{}`", + "mismatched closing delimiter: `{}`", pprust::token_kind_to_string(&token::CloseDelim(found_delim)), ), ); - err.span_label(unmatched.found_span, "incorrect close delimiter"); + err.span_label(unmatched.found_span, "mismatched closing delimiter"); if let Some(sp) = unmatched.candidate_span { - err.span_label(sp, "close delimiter possibly meant for this"); + err.span_label(sp, "closing delimiter possibly meant for this"); } if let Some(sp) = unmatched.unclosed_span { - err.span_label(sp, "un-closed delimiter"); + err.span_label(sp, "unclosed delimiter"); } Some(err) } diff --git a/src/test/ui/issues/issue-62554.rs b/src/test/ui/issues/issue-62554.rs index 3d50674e624ff..20e84ec364b65 100644 --- a/src/test/ui/issues/issue-62554.rs +++ b/src/test/ui/issues/issue-62554.rs @@ -2,4 +2,4 @@ fn main() {} fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { //~^ ERROR expected `{`, found `macro_rules` -//~ ERROR this file contains an un-closed delimiter +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/issues/issue-62554.stderr b/src/test/ui/issues/issue-62554.stderr index d59546e23839a..692bfe02275a8 100644 --- a/src/test/ui/issues/issue-62554.stderr +++ b/src/test/ui/issues/issue-62554.stderr @@ -1,15 +1,15 @@ -error: this file contains an un-closed delimiter - --> $DIR/issue-62554.rs:5:53 +error: this file contains an unclosed delimiter + --> $DIR/issue-62554.rs:5:52 | LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - un-closed delimiter + | - - - - - unclosed delimiter | | | | | - | | | | un-closed delimiter - | | | un-closed delimiter - | un-closed delimiter un-closed delimiter + | | | | unclosed delimiter + | | | unclosed delimiter + | unclosed delimiter unclosed delimiter LL | LL | - | ^ + | ^ error: expected `{`, found `macro_rules` --> $DIR/issue-62554.rs:3:23 diff --git a/src/test/ui/parser-recovery-1.rs b/src/test/ui/parser-recovery-1.rs index 21d36048e6703..dcc0dc00a72ea 100644 --- a/src/test/ui/parser-recovery-1.rs +++ b/src/test/ui/parser-recovery-1.rs @@ -12,4 +12,4 @@ fn main() { let x = y.; //~^ ERROR unexpected token //~| ERROR cannot find value `y` in this scope -} //~ ERROR this file contains an un-closed delimiter +} //~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser-recovery-1.stderr b/src/test/ui/parser-recovery-1.stderr index 83f8ef63c9954..4d881918c40cc 100644 --- a/src/test/ui/parser-recovery-1.stderr +++ b/src/test/ui/parser-recovery-1.stderr @@ -1,8 +1,8 @@ -error: this file contains an un-closed delimiter - --> $DIR/parser-recovery-1.rs:15:55 +error: this file contains an unclosed delimiter + --> $DIR/parser-recovery-1.rs:15:54 | LL | trait Foo { - | - un-closed delimiter + | - unclosed delimiter LL | fn bar() { | - this delimiter might not be properly closed... ... @@ -10,7 +10,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | } - | ^ + | ^ error: unexpected token: `;` --> $DIR/parser-recovery-1.rs:12:15 diff --git a/src/test/ui/parser-recovery-2.rs b/src/test/ui/parser-recovery-2.rs index be686ccbc22ed..dc5be96cc6405 100644 --- a/src/test/ui/parser-recovery-2.rs +++ b/src/test/ui/parser-recovery-2.rs @@ -5,7 +5,7 @@ trait Foo { fn bar() { let x = foo(); //~ ERROR cannot find function `foo` in this scope - ) //~ ERROR incorrect close delimiter: `)` + ) //~ ERROR mismatched closing delimiter: `)` } fn main() { diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index c246fa80b0a05..c48211d406479 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -4,14 +4,14 @@ error: unexpected token: `;` LL | let x = y.; | ^ -error: incorrect close delimiter: `)` +error: mismatched closing delimiter: `)` --> $DIR/parser-recovery-2.rs:8:5 | LL | fn bar() { - | - un-closed delimiter + | - unclosed delimiter LL | let x = foo(); LL | ) - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error[E0425]: cannot find function `foo` in this scope --> $DIR/parser-recovery-2.rs:7:17 diff --git a/src/test/ui/parser/issue-10636-1.rs b/src/test/ui/parser/issue-10636-1.rs index e495c0411d816..77c6072d6fc0a 100644 --- a/src/test/ui/parser/issue-10636-1.rs +++ b/src/test/ui/parser/issue-10636-1.rs @@ -1,8 +1,8 @@ struct Obj { - //~^ NOTE: un-closed delimiter + //~^ NOTE: unclosed delimiter member: usize ) -//~^ ERROR incorrect close delimiter -//~| NOTE incorrect close delimiter +//~^ ERROR mismatched closing delimiter +//~| NOTE mismatched closing delimiter fn main() {} diff --git a/src/test/ui/parser/issue-10636-1.stderr b/src/test/ui/parser/issue-10636-1.stderr index 894139f24ddaf..ff90cb97096f7 100644 --- a/src/test/ui/parser/issue-10636-1.stderr +++ b/src/test/ui/parser/issue-10636-1.stderr @@ -1,11 +1,11 @@ -error: incorrect close delimiter: `)` +error: mismatched closing delimiter: `)` --> $DIR/issue-10636-1.rs:4:1 | LL | struct Obj { - | - un-closed delimiter + | - unclosed delimiter ... LL | ) - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/issue-2354-1.rs b/src/test/ui/parser/issue-2354-1.rs index 7e4e24fae1964..996cf1bcbf920 100644 --- a/src/test/ui/parser/issue-2354-1.rs +++ b/src/test/ui/parser/issue-2354-1.rs @@ -1 +1 @@ -static foo: isize = 2; } //~ ERROR unexpected close delimiter: +static foo: isize = 2; } //~ ERROR unexpected closing delimiter: diff --git a/src/test/ui/parser/issue-2354-1.stderr b/src/test/ui/parser/issue-2354-1.stderr index 7c083751228b6..7ea0f2a982855 100644 --- a/src/test/ui/parser/issue-2354-1.stderr +++ b/src/test/ui/parser/issue-2354-1.stderr @@ -1,8 +1,8 @@ -error: unexpected close delimiter: `}` +error: unexpected closing delimiter: `}` --> $DIR/issue-2354-1.rs:1:24 | LL | static foo: isize = 2; } - | ^ unexpected close delimiter + | ^ unexpected closing delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/issue-2354.rs b/src/test/ui/parser/issue-2354.rs index c4fc471618283..c422040cbe300 100644 --- a/src/test/ui/parser/issue-2354.rs +++ b/src/test/ui/parser/issue-2354.rs @@ -1,4 +1,4 @@ -fn foo() { //~ NOTE un-closed delimiter +fn foo() { //~ NOTE unclosed delimiter match Some(10) { //~^ NOTE this delimiter might not be properly closed... Some(y) => { panic!(); } @@ -12,4 +12,4 @@ fn bar() { } fn main() {} -//~ ERROR this file contains an un-closed delimiter +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/issue-2354.stderr b/src/test/ui/parser/issue-2354.stderr index 45199b02cb8d4..b89ed3958357d 100644 --- a/src/test/ui/parser/issue-2354.stderr +++ b/src/test/ui/parser/issue-2354.stderr @@ -1,8 +1,8 @@ -error: this file contains an un-closed delimiter - --> $DIR/issue-2354.rs:15:53 +error: this file contains an unclosed delimiter + --> $DIR/issue-2354.rs:15:52 | LL | fn foo() { - | - un-closed delimiter + | - unclosed delimiter LL | match Some(10) { | - this delimiter might not be properly closed... ... @@ -10,7 +10,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | - | ^ + | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr b/src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr index 2c987da81d833..00f6652b311da 100644 --- a/src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr +++ b/src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr @@ -1,10 +1,10 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[Ѕ | - ^ | | - | un-closed delimiter + | unclosed delimiter error: expected item after attributes --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 diff --git a/src/test/ui/parser/issue-62524.stderr b/src/test/ui/parser/issue-62524.stderr index 229768f4959fe..3482435cd1d03 100644 --- a/src/test/ui/parser/issue-62524.stderr +++ b/src/test/ui/parser/issue-62524.stderr @@ -1,8 +1,8 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/issue-62524.rs:4:3 | LL | y![ - | - un-closed delimiter + | - unclosed delimiter LL | Ϥ, | ^ diff --git a/src/test/ui/parser/issue-62546.rs b/src/test/ui/parser/issue-62546.rs index 75b95e7407302..f06b6505859cf 100644 --- a/src/test/ui/parser/issue-62546.rs +++ b/src/test/ui/parser/issue-62546.rs @@ -1,3 +1,3 @@ pub t(# //~^ ERROR missing `fn` or `struct` for function or struct definition -//~ ERROR this file contains an un-closed delimiter +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/issue-62546.stderr b/src/test/ui/parser/issue-62546.stderr index 631aac9550585..32c61391e1682 100644 --- a/src/test/ui/parser/issue-62546.stderr +++ b/src/test/ui/parser/issue-62546.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter - --> $DIR/issue-62546.rs:3:53 +error: this file contains an unclosed delimiter + --> $DIR/issue-62546.rs:3:52 | LL | pub t(# - | - un-closed delimiter + | - unclosed delimiter LL | LL | - | ^ + | ^ error: missing `fn` or `struct` for function or struct definition --> $DIR/issue-62546.rs:1:4 diff --git a/src/test/ui/parser/issue-62881.rs b/src/test/ui/parser/issue-62881.rs index 1782c2e375df5..b9204595fb971 100644 --- a/src/test/ui/parser/issue-62881.rs +++ b/src/test/ui/parser/issue-62881.rs @@ -3,4 +3,4 @@ fn main() {} fn f() -> isize { fn f() -> isize {} pub f< //~^ ERROR missing `fn` or `struct` for function or struct definition //~| ERROR mismatched types -//~ ERROR this file contains an un-closed delimiter +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/issue-62881.stderr b/src/test/ui/parser/issue-62881.stderr index fdf772fcbdb77..87be69baadda5 100644 --- a/src/test/ui/parser/issue-62881.stderr +++ b/src/test/ui/parser/issue-62881.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter - --> $DIR/issue-62881.rs:6:53 +error: this file contains an unclosed delimiter + --> $DIR/issue-62881.rs:6:52 | LL | fn f() -> isize { fn f() -> isize {} pub f< - | - un-closed delimiter + | - unclosed delimiter ... LL | - | ^ + | ^ error: missing `fn` or `struct` for function or struct definition --> $DIR/issue-62881.rs:3:41 diff --git a/src/test/ui/parser/issue-62973.stderr b/src/test/ui/parser/issue-62973.stderr index e2a5b4cba06f5..e95e629957c26 100644 --- a/src/test/ui/parser/issue-62973.stderr +++ b/src/test/ui/parser/issue-62973.stderr @@ -1,10 +1,10 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/issue-62973.rs:8:2 | LL | fn p() { match s { v, E { [) {) } - | - - un-closed delimiter + | - - unclosed delimiter | | - | un-closed delimiter + | unclosed delimiter LL | LL | | ^ @@ -44,21 +44,21 @@ LL | LL | | ^ expected one of `.`, `?`, `{`, or an operator -error: incorrect close delimiter: `)` +error: mismatched closing delimiter: `)` --> $DIR/issue-62973.rs:6:28 | LL | fn p() { match s { v, E { [) {) } - | -^ incorrect close delimiter + | -^ mismatched closing delimiter | | - | un-closed delimiter + | unclosed delimiter -error: incorrect close delimiter: `)` +error: mismatched closing delimiter: `)` --> $DIR/issue-62973.rs:6:31 | LL | fn p() { match s { v, E { [) {) } - | -^ incorrect close delimiter + | -^ mismatched closing delimiter | | - | un-closed delimiter + | unclosed delimiter error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/issue-63116.stderr b/src/test/ui/parser/issue-63116.stderr index 0aed0386a907b..2beb73d83d261 100644 --- a/src/test/ui/parser/issue-63116.stderr +++ b/src/test/ui/parser/issue-63116.stderr @@ -1,10 +1,10 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/issue-63116.rs:3:18 | LL | impl W $DIR/issue-63116.rs:3:12 diff --git a/src/test/ui/parser/issue-63135.stderr b/src/test/ui/parser/issue-63135.stderr index 152601b353805..a6fb037b299f5 100644 --- a/src/test/ui/parser/issue-63135.stderr +++ b/src/test/ui/parser/issue-63135.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/issue-63135.rs:3:16 | LL | fn i(n{...,f # | - - ^ | | | - | | un-closed delimiter - | un-closed delimiter + | | unclosed delimiter + | unclosed delimiter error: expected field pattern, found `...` --> $DIR/issue-63135.rs:3:8 diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs b/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs index 3f3e997deceb8..404aa7b806a51 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs @@ -3,5 +3,5 @@ macro_rules! foo { ($($tt:tt)*) => () } fn main() { foo! { bar, "baz", 1, 2.0 - ) //~ ERROR incorrect close delimiter + ) //~ ERROR mismatched closing delimiter } diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr index f411ee8ce2ccc..93c5ab383d488 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr @@ -1,11 +1,11 @@ -error: incorrect close delimiter: `)` +error: mismatched closing delimiter: `)` --> $DIR/macro-mismatched-delim-brace-paren.rs:6:5 | LL | foo! { - | - un-closed delimiter + | - unclosed delimiter LL | bar, "baz", 1, 2.0 LL | ) - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs b/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs index 1185f882a1390..1a1b9edfbcb66 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs @@ -1,5 +1,5 @@ fn main() { foo! ( bar, "baz", 1, 2.0 - } //~ ERROR incorrect close delimiter -} //~ ERROR unexpected close delimiter: `}` + } //~ ERROR mismatched closing delimiter +} //~ ERROR unexpected closing delimiter: `}` diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr index b68433936117a..042142ac35033 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,17 +1,17 @@ -error: unexpected close delimiter: `}` +error: unexpected closing delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 | LL | } - | ^ unexpected close delimiter + | ^ unexpected closing delimiter -error: incorrect close delimiter: `}` +error: mismatched closing delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:4:5 | LL | foo! ( - | - un-closed delimiter + | - unclosed delimiter LL | bar, "baz", 1, 2.0 LL | } - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/mbe_missing_right_paren.stderr b/src/test/ui/parser/mbe_missing_right_paren.stderr index 4504fc0eb0004..c5b3cc275ce9a 100644 --- a/src/test/ui/parser/mbe_missing_right_paren.stderr +++ b/src/test/ui/parser/mbe_missing_right_paren.stderr @@ -1,10 +1,10 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/mbe_missing_right_paren.rs:3:19 | LL | macro_rules! abc(ؼ | - ^ | | - | un-closed delimiter + | unclosed delimiter error: macros that expand to items must be delimited with braces or followed by a semicolon --> $DIR/mbe_missing_right_paren.rs:3:17 diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs index 8d89905909e94..9f02a7a997bf2 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs @@ -9,4 +9,4 @@ trait T { //~ ERROR expected one of pub(crate) struct Bar(); fn main() {} -//~ ERROR this file contains an un-closed delimiter +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr index e1aed8a6b4ea3..a23cfeac58f84 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter - --> $DIR/missing-close-brace-in-impl-trait.rs:12:53 +error: this file contains an unclosed delimiter + --> $DIR/missing-close-brace-in-impl-trait.rs:12:52 | LL | impl T for () { - | - un-closed delimiter + | - unclosed delimiter ... LL | - | ^ + | ^ error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found keyword `trait` --> $DIR/missing-close-brace-in-impl-trait.rs:5:1 diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs index 5b716b1467cb1..0d53315839ceb 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs @@ -11,4 +11,4 @@ impl T for Bar { fn foo(&self) {} } -fn main() {} //~ ERROR this file contains an un-closed delimiter +fn main() {} //~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr index 15ce94a6d00fa..ac8dd48a58879 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter - --> $DIR/missing-close-brace-in-struct.rs:14:66 +error: this file contains an unclosed delimiter + --> $DIR/missing-close-brace-in-struct.rs:14:65 | LL | pub(crate) struct Bar { - | - un-closed delimiter + | - unclosed delimiter ... LL | fn main() {} - | ^ + | ^ error: expected identifier, found keyword `trait` --> $DIR/missing-close-brace-in-struct.rs:4:1 diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs index 9f3d78d584d44..5ec5d45bbe7b2 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs @@ -9,4 +9,4 @@ impl T for Bar { fn foo(&self) {} } -fn main() {} //~ ERROR this file contains an un-closed delimiter +fn main() {} //~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr index 7e8abf22d55ab..213640127829c 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter - --> $DIR/missing-close-brace-in-trait.rs:12:66 +error: this file contains an unclosed delimiter + --> $DIR/missing-close-brace-in-trait.rs:12:65 | LL | trait T { - | - un-closed delimiter + | - unclosed delimiter ... LL | fn main() {} - | ^ + | ^ error: expected one of `async`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found keyword `struct` --> $DIR/missing-close-brace-in-trait.rs:5:12 @@ -23,7 +23,7 @@ LL | | ... | LL | | LL | | fn main() {} - | |_________________________________________________________________^ consider adding a `main` function to `$DIR/missing-close-brace-in-trait.rs` + | |________________________________________________________________^ consider adding a `main` function to `$DIR/missing-close-brace-in-trait.rs` error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/mismatched-delim-brace-empty-block.rs b/src/test/ui/parser/mismatched-delim-brace-empty-block.rs index 0f5a2cb09ecc4..61d7a9af22359 100644 --- a/src/test/ui/parser/mismatched-delim-brace-empty-block.rs +++ b/src/test/ui/parser/mismatched-delim-brace-empty-block.rs @@ -2,4 +2,4 @@ fn main() { } let _ = (); -} //~ ERROR unexpected close delimiter +} //~ ERROR unexpected closing delimiter diff --git a/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr b/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr index 5ae5fc91a4e8a..311f1768d829c 100644 --- a/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr +++ b/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr @@ -1,4 +1,4 @@ -error: unexpected close delimiter: `}` +error: unexpected closing delimiter: `}` --> $DIR/mismatched-delim-brace-empty-block.rs:5:1 | LL | fn main() { @@ -8,7 +8,7 @@ LL | | } | |_- this block is empty, you might have not meant to close it LL | let _ = (); LL | } - | ^ unexpected close delimiter + | ^ unexpected closing delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/missing_right_paren.stderr b/src/test/ui/parser/missing_right_paren.stderr index ac16ebe641271..c98b6bb6991c7 100644 --- a/src/test/ui/parser/missing_right_paren.stderr +++ b/src/test/ui/parser/missing_right_paren.stderr @@ -1,11 +1,11 @@ -error: this file contains an un-closed delimiter +error: this file contains an unclosed delimiter --> $DIR/missing_right_paren.rs:3:11 | LL | fn main((ؼ | -- ^ | || - | |un-closed delimiter - | un-closed delimiter + | |unclosed delimiter + | unclosed delimiter error: expected one of `:` or `|`, found `)` --> $DIR/missing_right_paren.rs:3:11 diff --git a/src/test/ui/parser/unclosed-braces.rs b/src/test/ui/parser/unclosed-braces.rs index 9c9ab766130cf..ed94fff386438 100644 --- a/src/test/ui/parser/unclosed-braces.rs +++ b/src/test/ui/parser/unclosed-braces.rs @@ -11,7 +11,7 @@ fn foo() { } fn main() { -//~^ NOTE un-closed delimiter +//~^ NOTE unclosed delimiter { { //~^ NOTE this delimiter might not be properly closed... @@ -19,4 +19,4 @@ fn main() { } //~^ NOTE ...as it matches this but it has different indentation } -//~ ERROR this file contains an un-closed delimiter +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/unclosed-braces.stderr b/src/test/ui/parser/unclosed-braces.stderr index 44c7e930a3a43..cbc5f8de4c3a7 100644 --- a/src/test/ui/parser/unclosed-braces.stderr +++ b/src/test/ui/parser/unclosed-braces.stderr @@ -1,8 +1,8 @@ -error: this file contains an un-closed delimiter - --> $DIR/unclosed-braces.rs:22:53 +error: this file contains an unclosed delimiter + --> $DIR/unclosed-braces.rs:22:52 | LL | fn main() { - | - un-closed delimiter + | - unclosed delimiter ... LL | { | - this delimiter might not be properly closed... @@ -11,7 +11,7 @@ LL | } | - ...as it matches this but it has different indentation ... LL | - | ^ + | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr index bda59d4dea644..a32a27bf987cd 100644 --- a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr @@ -1,13 +1,13 @@ -error: incorrect close delimiter: `}` +error: mismatched closing delimiter: `}` --> $DIR/unclosed_delim_mod.rs:7:1 | LL | pub fn new() -> Result { - | - close delimiter possibly meant for this + | - closing delimiter possibly meant for this LL | Ok(Value { - | - un-closed delimiter + | - unclosed delimiter LL | } LL | } - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error[E0308]: mismatched types --> $DIR/unclosed-delimiter-in-dep.rs:4:20 diff --git a/src/test/ui/parser/unclosed_delim_mod.rs b/src/test/ui/parser/unclosed_delim_mod.rs index 486e23312819d..d977d2c03de7e 100644 --- a/src/test/ui/parser/unclosed_delim_mod.rs +++ b/src/test/ui/parser/unclosed_delim_mod.rs @@ -5,4 +5,4 @@ pub fn new() -> Result { Ok(Value { } } -//~^ ERROR incorrect close delimiter +//~^ ERROR mismatched closing delimiter diff --git a/src/test/ui/parser/unclosed_delim_mod.stderr b/src/test/ui/parser/unclosed_delim_mod.stderr index fe2d968af0f32..9c16707212367 100644 --- a/src/test/ui/parser/unclosed_delim_mod.stderr +++ b/src/test/ui/parser/unclosed_delim_mod.stderr @@ -1,13 +1,13 @@ -error: incorrect close delimiter: `}` +error: mismatched closing delimiter: `}` --> $DIR/unclosed_delim_mod.rs:7:1 | LL | pub fn new() -> Result { - | - close delimiter possibly meant for this + | - closing delimiter possibly meant for this LL | Ok(Value { - | - un-closed delimiter + | - unclosed delimiter LL | } LL | } - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs index 3eef75bafd39b..f56013266ce52 100644 --- a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs +++ b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs @@ -8,4 +8,4 @@ fn main() { y: 5 }; } -fn foo() { //~ ERROR this file contains an un-closed delimiter +fn foo() { //~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr index bfbdb0363ef68..430a13e6e0713 100644 --- a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr +++ b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr @@ -1,8 +1,8 @@ -error: this file contains an un-closed delimiter - --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:64 +error: this file contains an unclosed delimiter + --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:63 | LL | fn foo() { - | - un-closed delimiter ^ + | - unclosed delimiter ^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.rs b/src/test/ui/proc-macro/invalid-punct-ident-4.rs index 5918782169597..e50f24deae343 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-4.rs +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.rs @@ -4,4 +4,4 @@ extern crate invalid_punct_ident; lexer_failure!(); //~ ERROR proc macro panicked - //~| ERROR unexpected close delimiter: `)` + //~| ERROR unexpected closing delimiter: `)` diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr index 65e40172ef539..e7764004e8de7 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr @@ -1,10 +1,10 @@ -error: unexpected close delimiter: `)` +error: unexpected closing delimiter: `)` --> $DIR/invalid-punct-ident-4.rs:6:1 | LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^^ | | - | unexpected close delimiter + | unexpected closing delimiter | in this macro invocation error: proc macro panicked diff --git a/src/test/ui/resolve/token-error-correct-2.rs b/src/test/ui/resolve/token-error-correct-2.rs index 807a39c8c7f4b..f7c7d908c784f 100644 --- a/src/test/ui/resolve/token-error-correct-2.rs +++ b/src/test/ui/resolve/token-error-correct-2.rs @@ -3,5 +3,5 @@ fn main() { if foo { //~^ ERROR: cannot find value `foo` - ) //~ ERROR: incorrect close delimiter: `)` + ) //~ ERROR: mismatched closing delimiter: `)` } diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index d568117d67626..4014af2f41b61 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -1,11 +1,11 @@ -error: incorrect close delimiter: `)` +error: mismatched closing delimiter: `)` --> $DIR/token-error-correct-2.rs:6:5 | LL | if foo { - | - un-closed delimiter + | - unclosed delimiter LL | LL | ) - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error[E0425]: cannot find value `foo` in this scope --> $DIR/token-error-correct-2.rs:4:8 diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs index d64907780efb5..4f74df0bf1f39 100644 --- a/src/test/ui/resolve/token-error-correct.rs +++ b/src/test/ui/resolve/token-error-correct.rs @@ -4,6 +4,6 @@ fn main() { foo(bar(; //~^ ERROR cannot find function `bar` in this scope } -//~^ ERROR: incorrect close delimiter: `}` +//~^ ERROR: mismatched closing delimiter: `}` fn foo(_: usize) {} diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index 9452e2d68deca..bf300ecd78173 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -1,13 +1,13 @@ -error: incorrect close delimiter: `}` +error: mismatched closing delimiter: `}` --> $DIR/token-error-correct.rs:6:1 | LL | fn main() { - | - close delimiter possibly meant for this + | - closing delimiter possibly meant for this LL | foo(bar(; - | - un-closed delimiter + | - unclosed delimiter LL | LL | } - | ^ incorrect close delimiter + | ^ mismatched closing delimiter error[E0425]: cannot find function `bar` in this scope --> $DIR/token-error-correct.rs:4:9 From ae002c1d84a2a8e8a272a3c0db28b7402064f072 Mon Sep 17 00:00:00 2001 From: jumbatm Date: Sat, 4 Jan 2020 08:42:05 +1000 Subject: [PATCH 17/17] Also remove const-hack for abs --- src/libcore/num/mod.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 14540394caba1..605ab98219f91 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1997,27 +1997,15 @@ $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")] + #[allow_internal_unstable(const_if_match)] #[inline] #[rustc_inherit_overflow_checks] pub const fn abs(self) -> Self { - // Note that the #[inline] above means that the overflow - // semantics of the subtraction depend on the crate we're being - // inlined into. - - // sign is -1 (all ones) for negative numbers, 0 otherwise. - let sign = self >> ($BITS - 1); - // For positive self, sign == 0 so the expression is simply - // (self ^ 0) - 0 == self == abs(self). - // - // For negative self, self ^ sign == self ^ all_ones. - // But all_ones ^ self == all_ones - self == -1 - self. - // So for negative numbers, (self ^ sign) - sign is - // (-1 - self) - -1 == -self == abs(self). - // - // The subtraction overflows when self is min_value(), because - // (-1 - min_value()) - -1 is max_value() - -1 which overflows. - // This is exactly when we want self.abs() to overflow. - (self ^ sign) - sign + if self.is_negative() { + -self + } else { + self + } } }