diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index f0c1d017326cd..949766a465906 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -2515,7 +2515,6 @@ impl<'a> State<'a> { PatKind::Range(ref begin, ref end, Spanned { node: ref end_kind, .. }) => { if let Some(e) = begin { self.print_expr(e); - self.space(); } match *end_kind { RangeEnd::Included(RangeSyntax::DotDotDot) => self.word("..."), diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 334fa6f4e5ccf..fb11aaf24c4b8 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1948,7 +1948,6 @@ impl<'a> State<'a> { PatKind::Range(ref begin, ref end, ref end_kind) => { if let Some(expr) = begin { self.print_expr(expr); - self.space(); } match *end_kind { RangeEnd::Included => self.word("..."), diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr index a5f7c390627ba..93b73c57e9b4d 100644 --- a/src/test/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr +++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr @@ -2,7 +2,7 @@ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:8:10 | LL | &0.. | _ => {} - | ^^^ help: add parentheses to clarify the precedence: `(0 ..)` + | ^^^ help: add parentheses to clarify the precedence: `(0..)` error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:10:11 @@ -16,7 +16,7 @@ error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:10:10 | LL | &0..= | _ => {} - | ^^^^ help: add parentheses to clarify the precedence: `(0 ..=)` + | ^^^^ help: add parentheses to clarify the precedence: `(0..=)` error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:13:11 diff --git a/src/test/ui/macros/stringify.rs b/src/test/ui/macros/stringify.rs index 90bc7dc1da239..d3dcb0986f426 100644 --- a/src/test/ui/macros/stringify.rs +++ b/src/test/ui/macros/stringify.rs @@ -712,10 +712,10 @@ fn test_pat() { // PatKind::Range assert_eq!(stringify_pat!(..1), "..1"); - assert_eq!(stringify_pat!(0..), "0 .."); // FIXME - assert_eq!(stringify_pat!(0..1), "0 ..1"); - assert_eq!(stringify_pat!(0..=1), "0 ..=1"); - assert_eq!(stringify_pat!(-2..=-1), "-2 ..=-1"); + assert_eq!(stringify_pat!(0..), "0.."); + assert_eq!(stringify_pat!(0..1), "0..1"); + assert_eq!(stringify_pat!(0..=1), "0..=1"); + assert_eq!(stringify_pat!(-2..=-1), "-2..=-1"); // PatKind::Slice assert_eq!(stringify_pat!([]), "[]"); diff --git a/src/test/ui/parser/intersection-patterns.rs b/src/test/ui/parser/intersection-patterns.rs index adb607cf6b97b..a6d27aab4f6af 100644 --- a/src/test/ui/parser/intersection-patterns.rs +++ b/src/test/ui/parser/intersection-patterns.rs @@ -34,7 +34,7 @@ fn main() { //~| pattern on the left, should be on the right //~| binding on the right, should be on the left //~| HELP switch the order - //~| SUGGESTION e @ 1 ..=5 + //~| SUGGESTION e @ 1..=5 _ => {} } } diff --git a/src/test/ui/parser/intersection-patterns.stderr b/src/test/ui/parser/intersection-patterns.stderr index f5bfee5bbd611..9dc4c469a6072 100644 --- a/src/test/ui/parser/intersection-patterns.stderr +++ b/src/test/ui/parser/intersection-patterns.stderr @@ -27,7 +27,7 @@ LL | 1 ..= 5 @ e => {} | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `e @ 1 ..=5` + | help: switch the order: `e @ 1..=5` error: aborting due to 3 previous errors diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.fixed b/src/test/ui/range/range-inclusive-pattern-precedence.fixed index 8a4b8fc38e37a..38104bab7c8ee 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.fixed +++ b/src/test/ui/range/range-inclusive-pattern-precedence.fixed @@ -12,7 +12,7 @@ pub fn main() { //~^ WARN `...` range patterns are deprecated //~| WARN this is accepted in the current edition //~| HELP use `..=` for an inclusive range - &(10 ..=15) => {} + &(10..=15) => {} //~^ ERROR the range pattern here has ambiguous interpretation //~| HELP add parentheses to clarify the precedence &(16..=20) => {} diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr index 8af1a570253a2..10513374cf808 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.stderr +++ b/src/test/ui/range/range-inclusive-pattern-precedence.stderr @@ -2,7 +2,7 @@ error: the range pattern here has ambiguous interpretation --> $DIR/range-inclusive-pattern-precedence.rs:15:10 | LL | &10..=15 => {} - | ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)` + | ^^^^^^^ help: add parentheses to clarify the precedence: `(10..=15)` warning: `...` range patterns are deprecated --> $DIR/range-inclusive-pattern-precedence.rs:11:9 diff --git a/src/test/ui/range/range-inclusive-pattern-precedence2.stderr b/src/test/ui/range/range-inclusive-pattern-precedence2.stderr index 009273c74350b..cdec41d7f75d5 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence2.stderr +++ b/src/test/ui/range/range-inclusive-pattern-precedence2.stderr @@ -2,7 +2,7 @@ error: the range pattern here has ambiguous interpretation --> $DIR/range-inclusive-pattern-precedence2.rs:14:13 | LL | box 10..=15 => {} - | ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)` + | ^^^^^^^ help: add parentheses to clarify the precedence: `(10..=15)` warning: `...` range patterns are deprecated --> $DIR/range-inclusive-pattern-precedence2.rs:10:14 diff --git a/src/test/ui/unpretty-expr-fn-arg.stdout b/src/test/ui/unpretty-expr-fn-arg.stdout index cb04dfead7321..b745b98863169 100644 --- a/src/test/ui/unpretty-expr-fn-arg.stdout +++ b/src/test/ui/unpretty-expr-fn-arg.stdout @@ -14,4 +14,4 @@ extern crate std; fn main() ({ } as ()) -fn foo((-(128 as i8) as i8) ...(127 as i8): i8) ({ } as ()) +fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ())