From c9d05aa9ceb82f31a86a548eaaffab8bdb229d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 4 Sep 2019 17:36:01 -0700 Subject: [PATCH] Point at correct span for parenthesized types --- src/librustc/hir/lowering.rs | 5 +++- src/libsyntax/parse/parser/path.rs | 13 +++++---- .../anonymous-higher-ranked-lifetime.stderr | 22 +++++++-------- .../expect-fn-supply-fn.stderr | 6 ++-- src/test/ui/error-codes/E0214.stderr | 10 +++---- ...-gate-unboxed-closures-manual-impls.stderr | 4 +-- src/test/ui/issues/issue-23589.stderr | 10 +++---- src/test/ui/issues/issue-32995-2.stderr | 12 ++++---- src/test/ui/issues/issue-32995.stderr | 28 +++++++++---------- src/test/ui/issues/issue-39687.stderr | 4 +-- src/test/ui/issues/issue-43623.stderr | 2 +- src/test/ui/issues/issue-60283.stderr | 2 +- .../closure-arg-type-mismatch.stderr | 2 +- .../type-parameters-in-field-exprs.stderr | 12 ++++---- src/test/ui/span/macro-ty-params.stderr | 12 ++++---- .../ui/type/ascription/issue-34255-1.stderr | 4 +-- ...oxed-closure-sugar-used-on-struct-1.stderr | 4 +-- ...oxed-closure-sugar-used-on-struct-3.stderr | 10 +++---- ...nboxed-closure-sugar-used-on-struct.stderr | 4 +-- ...ong-number-number-type-parameters-1.stderr | 4 +-- ...ong-number-number-type-parameters-3.stderr | 4 +-- ...wrong-number-number-type-parameters.stderr | 8 +++--- .../unboxed-closure-sugar-wrong-trait.stderr | 4 +-- 23 files changed, 95 insertions(+), 91 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 48f7fc44465..f6b872623d7 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1893,10 +1893,13 @@ impl<'a> LoweringContext<'a> { if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) { // Do not suggest going from `Trait()` to `Trait<>` if data.inputs.len() > 0 { + let split = snippet.find('(').unwrap(); + let trait_name = &snippet[0..split]; + let args = &snippet[split + 1 .. snippet.len() - 1]; err.span_suggestion( data.span, "use angle brackets instead", - format!("<{}>", &snippet[1..snippet.len() - 1]), + format!("{}<{}>", trait_name, args), Applicability::MaybeIncorrect, ); } diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs index dcd3c648017..f6df24c0568 100644 --- a/src/libsyntax/parse/parser/path.rs +++ b/src/libsyntax/parse/parser/path.rs @@ -129,10 +129,11 @@ impl<'a> Parser<'a> { self.parse_path(style) } - crate fn parse_path_segments(&mut self, - segments: &mut Vec, - style: PathStyle) - -> PResult<'a, ()> { + crate fn parse_path_segments( + &mut self, + segments: &mut Vec, + style: PathStyle, + ) -> PResult<'a, ()> { loop { let segment = self.parse_path_segment(style)?; if style == PathStyle::Expr { @@ -196,12 +197,12 @@ impl<'a> Parser<'a> { let (args, constraints) = self.parse_generic_args_with_leaning_angle_bracket_recovery(style, lo)?; self.expect_gt()?; - let span = lo.to(self.prev_span); + let span = ident.span.to(self.prev_span); AngleBracketedArgs { args, constraints, span }.into() } else { // `(T, U) -> R` let (inputs, _) = self.parse_paren_comma_seq(|p| p.parse_ty())?; - let span = lo.to(self.prev_span); + let span = ident.span.to(self.prev_span); let output = if self.eat(&token::RArrow) { Some(self.parse_ty_common(false, false, false)?) } else { diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 51550e1471e..fbe2d192d0c 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -18,7 +18,7 @@ LL | f1(|_: (), _: ()| {}); | expected signature of `fn(&(), &()) -> _` ... LL | fn f1(_: F) where F: Fn(&(), &()) {} - | -- ---------- required by this bound in `f1` + | -- ------------ required by this bound in `f1` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 @@ -40,7 +40,7 @@ LL | f2(|_: (), _: ()| {}); | expected signature of `fn(&'a (), &()) -> _` ... LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} - | -- ------------- required by this bound in `f2` + | -- --------------- required by this bound in `f2` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 @@ -62,7 +62,7 @@ LL | f3(|_: (), _: ()| {}); | expected signature of `fn(&(), &()) -> _` ... LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} - | -- ------------- required by this bound in `f3` + | -- --------------- required by this bound in `f3` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 @@ -84,7 +84,7 @@ LL | f4(|_: (), _: ()| {}); | expected signature of `fn(&(), &'r ()) -> _` ... LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} - | -- ------------- required by this bound in `f4` + | -- --------------- required by this bound in `f4` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 @@ -106,7 +106,7 @@ LL | f5(|_: (), _: ()| {}); | expected signature of `fn(&'r (), &'r ()) -> _` ... LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} - | -- ---------------- required by this bound in `f5` + | -- ------------------ required by this bound in `f5` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 @@ -128,7 +128,7 @@ LL | g1(|_: (), _: ()| {}); | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` ... LL | fn g1(_: F) where F: Fn(&(), Box) {} - | -- ----------------------- required by this bound in `g1` + | -- ------------------------- required by this bound in `g1` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 @@ -150,7 +150,7 @@ LL | g2(|_: (), _: ()| {}); | expected signature of `fn(&(), for<'r> fn(&'r ())) -> _` ... LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} - | -- -------------- required by this bound in `g2` + | -- ---------------- required by this bound in `g2` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 @@ -172,7 +172,7 @@ LL | g3(|_: (), _: ()| {}); | expected signature of `fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` ... LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} - | -- -------------------------- required by this bound in `g3` + | -- ---------------------------- required by this bound in `g3` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 @@ -194,7 +194,7 @@ LL | g4(|_: (), _: ()| {}); | expected signature of `fn(&(), for<'r> fn(&'r ())) -> _` ... LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} - | -- ------------------------- required by this bound in `g4` + | -- --------------------------- required by this bound in `g4` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 @@ -216,7 +216,7 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>, &(), for<'r, 's> fn(&'r (), &'s ())) -> _` ... LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} - | -- ------------------------------------------ required by this bound in `h1` + | -- -------------------------------------------- required by this bound in `h1` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 @@ -238,7 +238,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>, &'t0 (), for<'r, 's> fn(&'r (), &'s ())) -> _` ... LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} - | -- ---------------------------------------------- required by this bound in `h2` + | -- ------------------------------------------------ required by this bound in `h2` error: aborting due to 22 previous errors diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr index 6fadea31f7e..ac4666fe36d 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -42,7 +42,7 @@ error[E0631]: type mismatch in closure arguments LL | fn with_closure_expecting_fn_with_free_region(_: F) | ------------------------------------------ LL | where F: for<'a> FnOnce(fn(&'a u32), &i32) - | ------------------- required by this bound in `with_closure_expecting_fn_with_free_region` + | ------------------------- required by this bound in `with_closure_expecting_fn_with_free_region` ... LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _` @@ -55,7 +55,7 @@ error[E0631]: type mismatch in closure arguments LL | fn with_closure_expecting_fn_with_bound_region(_: F) | ------------------------------------------- LL | where F: FnOnce(fn(&u32), &i32) - | ---------------- required by this bound in `with_closure_expecting_fn_with_bound_region` + | ---------------------- required by this bound in `with_closure_expecting_fn_with_bound_region` ... LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _` @@ -68,7 +68,7 @@ error[E0631]: type mismatch in closure arguments LL | fn with_closure_expecting_fn_with_bound_region(_: F) | ------------------------------------------- LL | where F: FnOnce(fn(&u32), &i32) - | ---------------- required by this bound in `with_closure_expecting_fn_with_bound_region` + | ---------------------- required by this bound in `with_closure_expecting_fn_with_bound_region` ... LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _` diff --git a/src/test/ui/error-codes/E0214.stderr b/src/test/ui/error-codes/E0214.stderr index a10f2c00578..bcbd3a91cb9 100644 --- a/src/test/ui/error-codes/E0214.stderr +++ b/src/test/ui/error-codes/E0214.stderr @@ -1,11 +1,11 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/E0214.rs:2:15 + --> $DIR/E0214.rs:2:12 | LL | let v: Vec(&str) = vec!["foo"]; - | ^^^^^^ - | | - | only `Fn` traits may use parentheses - | help: use angle brackets instead: `<&str>` + | ^^^^^^^^^ + | | + | only `Fn` traits may use parentheses + | help: use angle brackets instead: `Vec<&str>` error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index fc4317b316a..c05379c71ee 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -44,10 +44,10 @@ LL | impl Fn<()> for Foo { = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable error[E0229]: associated type bindings are not allowed here - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:15:12 + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:15:6 | LL | impl FnOnce() for Foo1 { - | ^^ associated type not allowed here + | ^^^^^^^^ associated type not allowed here error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:21:6 diff --git a/src/test/ui/issues/issue-23589.stderr b/src/test/ui/issues/issue-23589.stderr index d169fdfe2dd..c3b419fe939 100644 --- a/src/test/ui/issues/issue-23589.stderr +++ b/src/test/ui/issues/issue-23589.stderr @@ -1,11 +1,11 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-23589.rs:2:15 + --> $DIR/issue-23589.rs:2:12 | LL | let v: Vec(&str) = vec!['1', '2']; - | ^^^^^^ - | | - | only `Fn` traits may use parentheses - | help: use angle brackets instead: `<&str>` + | ^^^^^^^^^ + | | + | only `Fn` traits may use parentheses + | help: use angle brackets instead: `Vec<&str>` error[E0308]: mismatched types --> $DIR/issue-23589.rs:2:29 diff --git a/src/test/ui/issues/issue-32995-2.stderr b/src/test/ui/issues/issue-32995-2.stderr index 4a580b09bf3..976e3064db6 100644 --- a/src/test/ui/issues/issue-32995-2.stderr +++ b/src/test/ui/issues/issue-32995-2.stderr @@ -1,27 +1,27 @@ error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:4:28 + --> $DIR/issue-32995-2.rs:4:22 | LL | { fn f() {} } - | ^^ + | ^^^^^^^^ | = note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:8:35 + --> $DIR/issue-32995-2.rs:8:29 | LL | { fn f() -> impl ::std::marker()::Send { } } - | ^^ + | ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:16:19 + --> $DIR/issue-32995-2.rs:16:13 | LL | impl ::std::marker()::Copy for X {} - | ^^ + | ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 diff --git a/src/test/ui/issues/issue-32995.stderr b/src/test/ui/issues/issue-32995.stderr index 59d93ece067..724e82a59dc 100644 --- a/src/test/ui/issues/issue-32995.stderr +++ b/src/test/ui/issues/issue-32995.stderr @@ -1,63 +1,63 @@ error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:4:17 + --> $DIR/issue-32995.rs:4:12 | LL | let x: usize() = 1; - | ^^ + | ^^^^^^^ | = note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:8:24 + --> $DIR/issue-32995.rs:8:19 | LL | let b: ::std::boxed()::Box<_> = Box::new(1); - | ^^ + | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:12:25 + --> $DIR/issue-32995.rs:12:20 | LL | let p = ::std::str::()::from_utf8(b"foo").unwrap(); - | ^^ + | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:16:36 + --> $DIR/issue-32995.rs:16:25 | LL | let p = ::std::str::from_utf8::()(b"foo").unwrap(); - | ^^ + | ^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:20:35 + --> $DIR/issue-32995.rs:20:29 | LL | let o : Box = Box::new(1); - | ^^ + | ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:24:41 + --> $DIR/issue-32995.rs:24:35 | LL | let o : Box = Box::new(1); - | ^^ + | ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:30:14 + --> $DIR/issue-32995.rs:30:13 | LL | let d : X() = Default::default(); - | ^^ + | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 diff --git a/src/test/ui/issues/issue-39687.stderr b/src/test/ui/issues/issue-39687.stderr index 886de1d6faf..b1b3041ea02 100644 --- a/src/test/ui/issues/issue-39687.stderr +++ b/src/test/ui/issues/issue-39687.stderr @@ -1,8 +1,8 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-39687.rs:4:16 + --> $DIR/issue-39687.rs:4:14 | LL | ::call; - | ^^ associated type not allowed here + | ^^^^ associated type not allowed here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43623.stderr b/src/test/ui/issues/issue-43623.stderr index 210d831abf0..2c57b8585d9 100644 --- a/src/test/ui/issues/issue-43623.stderr +++ b/src/test/ui/issues/issue-43623.stderr @@ -19,7 +19,7 @@ LL | pub fn break_me(f: F) | -------- LL | where T: for<'b> Trait<'b>, LL | F: for<'b> FnMut(>::Assoc) { - | ------------------------- required by this bound in `break_me` + | ------------------------------ required by this bound in `break_me` LL | break_me::; | ^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'b, found concrete lifetime diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr index dc7952200b1..69c1d85e4e1 100644 --- a/src/test/ui/issues/issue-60283.stderr +++ b/src/test/ui/issues/issue-60283.stderr @@ -20,7 +20,7 @@ LL | pub fn foo(_: T, _: F) | --- LL | where T: for<'a> Trait<'a>, LL | F: for<'a> FnMut(>::Item) {} - | ------------------------ required by this bound in `foo` + | ----------------------------- required by this bound in `foo` ... LL | foo((), drop) | ^^^ expected bound lifetime parameter 'a, found concrete lifetime diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index a731891bf76..85cad61210e 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -38,7 +38,7 @@ error[E0271]: type mismatch resolving `for<'r> $DIR/closure-arg-type-mismatch.rs:10:5 | LL | fn baz(_: F) {} - | --- ----------- required by this bound in `baz` + | --- ------------- required by this bound in `baz` LL | fn _test<'a>(f: fn(*mut &'a u32)) { LL | baz(f); | ^^^ expected bound lifetime parameter, found concrete lifetime diff --git a/src/test/ui/parser/type-parameters-in-field-exprs.stderr b/src/test/ui/parser/type-parameters-in-field-exprs.stderr index 2183c74da0a..dd8a3feb049 100644 --- a/src/test/ui/parser/type-parameters-in-field-exprs.stderr +++ b/src/test/ui/parser/type-parameters-in-field-exprs.stderr @@ -1,20 +1,20 @@ error: field expressions may not have generic arguments - --> $DIR/type-parameters-in-field-exprs.rs:13:10 + --> $DIR/type-parameters-in-field-exprs.rs:13:7 | LL | f.x::; - | ^^^^^^^ + | ^^^^^^^^^^ error: field expressions may not have generic arguments - --> $DIR/type-parameters-in-field-exprs.rs:15:10 + --> $DIR/type-parameters-in-field-exprs.rs:15:7 | LL | f.x::<>; - | ^^ + | ^^^^^ error: field expressions may not have generic arguments - --> $DIR/type-parameters-in-field-exprs.rs:17:10 + --> $DIR/type-parameters-in-field-exprs.rs:17:7 | LL | f.x::(); - | ^^ + | ^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 39b3edc6703..139247c0388 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -1,14 +1,14 @@ error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:10:10 + --> $DIR/macro-ty-params.rs:10:5 | LL | foo::!(); - | ^^^ + | ^^^^^^^^ error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:11:10 + --> $DIR/macro-ty-params.rs:11:5 | LL | foo::<>!(); - | ^^ + | ^^^^^^^ error: unexpected generic arguments in path --> $DIR/macro-ty-params.rs:12:8 @@ -17,10 +17,10 @@ LL | m!(Default<>); | ^^^^^^^^^ error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:12:15 + --> $DIR/macro-ty-params.rs:12:8 | LL | m!(Default<>); - | ^^ + | ^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/type/ascription/issue-34255-1.stderr b/src/test/ui/type/ascription/issue-34255-1.stderr index 195b393b2f6..0d0acfde886 100644 --- a/src/test/ui/type/ascription/issue-34255-1.stderr +++ b/src/test/ui/type/ascription/issue-34255-1.stderr @@ -5,10 +5,10 @@ LL | input_cells: Vec::new() | ^^^^^^^^^^^ a field by this name exists in `Self` error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-34255-1.rs:7:30 + --> $DIR/issue-34255-1.rs:7:27 | LL | input_cells: Vec::new() - | ^^ + | ^^^^^ | = note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr index 81095826f38..32619420f6d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr @@ -1,8 +1,8 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:19 + --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16 | LL | let x: Box = panic!(); - | ^^ only `Fn` traits may use parentheses + | ^^^^^ only `Fn` traits may use parentheses error[E0107]: wrong number of type arguments: expected 1, found 0 --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr index 7d05ca55ffd..f5cf6db30f9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr @@ -1,11 +1,11 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:14:18 + --> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:14:13 | LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser) - | ^^^^^^^^^^^^^^ - | | - | only `Fn` traits may use parentheses - | help: use angle brackets instead: `` + | ^^^^^^^^^^^^^^^^^^^ + | | + | only `Fn` traits may use parentheses + | help: use angle brackets instead: `Bar::` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr index 3c78d9f9135..ba93b60dad8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr @@ -1,8 +1,8 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:18 + --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15 | LL | fn foo(b: Box) { - | ^^ only `Fn` traits may use parentheses + | ^^^^^ only `Fn` traits may use parentheses error[E0107]: wrong number of type arguments: expected 1, found 0 --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr index c59082932dd..59e7bc8c832 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr @@ -1,8 +1,8 @@ error[E0220]: associated type `Output` not found for `One<()>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:19 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:16 | LL | fn foo(_: &dyn One()) - | ^^ associated type `Output` not found + | ^^^^^ associated type `Output` not found error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr index 6c61e74584a..f42ac38d370 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr @@ -5,10 +5,10 @@ LL | fn foo(_: &dyn Three()) | ^^^^^^^ expected 3 type arguments error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:21 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16 | LL | fn foo(_: &dyn Three()) - | ^^ associated type `Output` not found + | ^^^^^^^ associated type `Output` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index b96e2cbc36b..8185a798e7b 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -1,14 +1,14 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:19 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 | LL | fn foo(_: dyn Zero()) - | ^^ unexpected type argument + | ^^^^^^ unexpected type argument error[E0220]: associated type `Output` not found for `Zero` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:19 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 | LL | fn foo(_: dyn Zero()) - | ^^ associated type `Output` not found + | ^^^^^^ associated type `Output` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index bd707a8508a..c81402a3dcc 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -1,8 +1,8 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:13 + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f isize>(x: F) {} - | ^^^^^^^ unexpected type argument + | ^^^^^^^^^^^^ unexpected type argument error[E0220]: associated type `Output` not found for `Trait` --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24