diff options
| author | bors <bors@rust-lang.org> | 2020-01-10 20:08:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-10 20:08:58 +0000 |
| commit | 175631311716d7dfeceec40d2587cde7142ffa8c (patch) | |
| tree | c77e6f2bb4e682bb6239b5e6ab31d674057ee31a /src/libsyntax | |
| parent | ac6eb0db01a781d4f4940b34bd4c1cbe7e75263a (diff) | |
| parent | bcfb3806340939127d61f15ce101933bce6805f1 (diff) | |
| download | rust-175631311716d7dfeceec40d2587cde7142ffa8c.tar.gz rust-175631311716d7dfeceec40d2587cde7142ffa8c.zip | |
Auto merge of #68101 - JohnTitor:rollup-mvmjukr, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #66045 (Add method Result::into_ok) - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns) - #68014 (Unify output of "variant not found" errors) - #68019 (Build compiletest with in-tree libtest) - #68039 (remove explicit strip-hidden pass from compiler doc generation) - #68050 (Canonicalize rustc_error imports) - #68059 (Allow specifying LLVM args in target specifications) - #68075 (rustbuild: Cleanup book generation) Failed merges: - #68089 (Unstabilize `Vec::remove_item`) r? @ghost
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/attr/builtin.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/attr/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/mut_visit.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/show_span.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 4 |
10 files changed, 19 insertions, 15 deletions
diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index e4f0398fb42..7d9f715e9fe 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -13,8 +13,8 @@ doctest = false rustc_serialize = { path = "../libserialize", package = "serialize" } log = "0.4" scoped-tls = "1.0" +rustc_errors = { path = "../librustc_errors" } rustc_span = { path = "../librustc_span" } -errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } rustc_index = { path = "../librustc_index" } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 1d3bb7d8768..33acba8eba0 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -649,7 +649,7 @@ pub enum PatKind { Lit(P<Expr>), /// A range pattern (e.g., `1...2`, `1..=2` or `1..2`). - Range(P<Expr>, P<Expr>, Spanned<RangeEnd>), + Range(Option<P<Expr>>, Option<P<Expr>>, Spanned<RangeEnd>), /// A slice pattern `[a, b, c]`. Slice(Vec<P<Pat>>), diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index b308d479545..958e4373cc0 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -6,7 +6,7 @@ use crate::feature_gate::feature_err; use crate::print::pprust; use crate::sess::ParseSess; -use errors::{struct_span_err, Applicability, Handler}; +use rustc_errors::{struct_span_err, Applicability, Handler}; use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg}; use rustc_macros::HashStable_Generic; use rustc_span::hygiene::Transparency; diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 8449b61f7b0..ec05dab451a 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -384,7 +384,7 @@ pub fn find_by_name(attrs: &[Attribute], name: Symbol) -> Option<&Attribute> { pub fn allow_internal_unstable<'a>( attrs: &[Attribute], - span_diagnostic: &'a errors::Handler, + span_diagnostic: &'a rustc_errors::Handler, ) -> Option<impl Iterator<Item = Symbol> + 'a> { find_by_name(attrs, sym::allow_internal_unstable).and_then(|attr| { attr.meta_item_list() diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 52eb20d320f..4eee4e943c2 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -4,9 +4,9 @@ use crate::attr; use crate::sess::ParseSess; use crate::visit::{self, FnKind, Visitor}; -use errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder, Handler}; use rustc_data_structures::fx::FxHashMap; use rustc_error_codes::*; +use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder, Handler}; use rustc_feature::{find_feature_issue, GateIssue}; use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; use rustc_feature::{Feature, Features, State as FeatureState, UnstableFeatures}; @@ -911,6 +911,7 @@ pub fn check_crate( gate_all!(raw_ref_op, "raw address of syntax is experimental"); gate_all!(const_trait_bound_opt_out, "`?const` on trait bounds is experimental"); gate_all!(const_trait_impl, "const trait impls are experimental"); + gate_all!(half_open_range_patterns, "half-open range patterns are unstable"); // All uses of `gate_all!` below this point were added in #65742, // and subsequently disabled (with the non-early gating readded). diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index b197eab7394..7ee4ca4603c 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -18,7 +18,6 @@ #![recursion_limit = "256"] use ast::AttrId; -pub use errors; use rustc_data_structures::sync::Lock; use rustc_index::bit_set::GrowableBitSet; use rustc_span::edition::{Edition, DEFAULT_EDITION}; diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 264ba25cede..58d4e46111b 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -1075,8 +1075,8 @@ pub fn noop_visit_pat<T: MutVisitor>(pat: &mut P<Pat>, vis: &mut T) { PatKind::Box(inner) => vis.visit_pat(inner), PatKind::Ref(inner, _mutbl) => vis.visit_pat(inner), PatKind::Range(e1, e2, Spanned { span: _, node: _ }) => { - vis.visit_expr(e1); - vis.visit_expr(e2); + visit_opt(e1, |e| vis.visit_expr(e)); + visit_opt(e2, |e| vis.visit_expr(e)); vis.visit_span(span); } PatKind::Tuple(elems) | PatKind::Slice(elems) | PatKind::Or(elems) => { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index dd9976510dc..11c8cb8ef75 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2329,14 +2329,18 @@ impl<'a> State<'a> { } PatKind::Lit(ref e) => self.print_expr(&**e), PatKind::Range(ref begin, ref end, Spanned { node: ref end_kind, .. }) => { - self.print_expr(begin); - self.s.space(); + if let Some(e) = begin { + self.print_expr(e); + self.s.space(); + } match *end_kind { RangeEnd::Included(RangeSyntax::DotDotDot) => self.s.word("..."), RangeEnd::Included(RangeSyntax::DotDotEq) => self.s.word("..="), RangeEnd::Excluded => self.s.word(".."), } - self.print_expr(end); + if let Some(e) = end { + self.print_expr(e); + } } PatKind::Slice(ref elts) => { self.s.word("["); diff --git a/src/libsyntax/show_span.rs b/src/libsyntax/show_span.rs index fb641239dfa..b70e2ce0d3e 100644 --- a/src/libsyntax/show_span.rs +++ b/src/libsyntax/show_span.rs @@ -29,7 +29,7 @@ impl FromStr for Mode { } struct ShowSpanVisitor<'a> { - span_diagnostic: &'a errors::Handler, + span_diagnostic: &'a rustc_errors::Handler, mode: Mode, } @@ -60,7 +60,7 @@ impl<'a> Visitor<'a> for ShowSpanVisitor<'a> { } } -pub fn run(span_diagnostic: &errors::Handler, mode: &str, krate: &ast::Crate) { +pub fn run(span_diagnostic: &rustc_errors::Handler, mode: &str, krate: &ast::Crate) { let mode = match mode.parse().ok() { Some(mode) => mode, None => return, diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index ebb49abebb0..3c2ebacbc4e 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -492,8 +492,8 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) { } PatKind::Lit(ref expression) => visitor.visit_expr(expression), PatKind::Range(ref lower_bound, ref upper_bound, _) => { - visitor.visit_expr(lower_bound); - visitor.visit_expr(upper_bound); + walk_list!(visitor, visit_expr, lower_bound); + walk_list!(visitor, visit_expr, upper_bound); } PatKind::Wild | PatKind::Rest => {} PatKind::Tuple(ref elems) | PatKind::Slice(ref elems) | PatKind::Or(ref elems) => { |
