Skip to content

Commit

Permalink
Rollup merge of #108401 - notriddle:notriddle/diagnostics-article, r=…
Browse files Browse the repository at this point in the history
…compiler-errors

diagnostics: remove inconsistent English article "this" from E0107

Consider [`tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`][issue-102768.stderr], the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in [`tests/ui/lint/dead-code/issue-85255.stderr`][issue-85255.stderr]. They don't have articles, so it seems unnecessary to have one here.

[issue-102768.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr
[issue-85255.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/lint/dead-code/issue-85255.stderr
  • Loading branch information
matthiaskrgr authored Feb 23, 2023
2 parents 3c954ae + 0241e49 commit 198c687
Show file tree
Hide file tree
Showing 112 changed files with 340 additions and 340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {

if self.gen_args.span_ext().is_some() {
format!(
"this {} takes {}{} {} argument{} but {} {} supplied",
"{} takes {}{} {} argument{} but {} {} supplied",
def_kind,
quantifier,
bound,
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/unable-fulfill-trait.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/unable-fulfill-trait.rs:4:17
|
LL | field1: dyn Bar<'a, 'b,>,
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/argument-suggestions/issue-100154.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-100154.rs:4:5
|
LL | foo::<()>(());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issues/issue-65159.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// edition:2018

async fn copy() -> Result<()>
//~^ ERROR this enum takes 2 generic arguments
//~^ ERROR enum takes 2 generic arguments
{
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issues/issue-65159.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-65159.rs:5:20
|
LL | async fn copy() -> Result<()>
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ impl MarketMultiplier {
}

async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied
LockedMarket(generator.lock().unwrap().buy())
}

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
Expand All @@ -12,7 +12,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^

error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/generic_const_exprs/issue-102768.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ trait X {

const _: () = {
fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
//~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument
//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
};

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
Expand All @@ -14,7 +14,7 @@ help: add missing lifetime argument
LL | fn f2<'a>(arg: Box<dyn X<Y<'_, 1> = &'a ()>>) {}
| +++

error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-76595.rs:15:5
|
LL | test::<2>();
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/incorrect-number-of-const-args.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/incorrect-number-of-const-args.rs:6:5
|
LL | foo::<0>();
Expand All @@ -16,7 +16,7 @@ help: add missing generic argument
LL | foo::<0, Y>();
| +++

error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied
error[E0107]: function takes 2 generic arguments but 3 generic arguments were supplied
--> $DIR/incorrect-number-of-const-args.rs:9:5
|
LL | foo::<0, 0, 0>();
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/invalid-const-arg-for-type-param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ struct S;

fn main() {
let _: u32 = 5i32.try_into::<32>().unwrap();
//~^ ERROR this method takes
//~^ ERROR method takes

S.f::<0>();
//~^ ERROR no method named `f`

S::<0>;
//~^ ERROR this struct takes 0
//~^ ERROR struct takes 0
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/invalid-const-arg-for-type-param.rs:6:23
|
LL | let _: u32 = 5i32.try_into::<32>().unwrap();
Expand All @@ -23,7 +23,7 @@ LL | struct S;
LL | S.f::<0>();
| ^ method not found in `S`

error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
|
LL | S::<0>;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/invalid-constant-in-args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ use std::cell::Cell;

fn main() {
let _: Cell<&str, "a"> = Cell::new("");
//~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied
//~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
}
2 changes: 1 addition & 1 deletion tests/ui/const-generics/invalid-constant-in-args.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/invalid-constant-in-args.rs:4:12
|
LL | let _: Cell<&str, "a"> = Cell::new("");
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/issues/issue-87493.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ where
S: MyTrait,
T: MyTrait<Assoc == S::Assoc>,
//~^ ERROR: expected one of `,` or `>`, found `==`
//~| ERROR: this trait takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
{
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/issues/issue-87493.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ help: if you meant to use an associated type binding, replace `==` with `=`
LL | T: MyTrait<Assoc = S::Assoc>,
| ~

error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-87493.rs:8:8
|
LL | T: MyTrait<Assoc == S::Assoc>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct Bar;
const T: usize = 42;

impl Foo<N = 3> for Bar {
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
//~^ ERROR trait takes 1 generic argument but 0 generic arguments were supplied
//~| ERROR associated type bindings are not allowed here
//~| ERROR associated const equality is incomplete
fn do_x(&self) -> [u8; 3] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | impl Foo<N = 3> for Bar {
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable

error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-89013-no-kw.rs:9:6
|
LL | impl Foo<N = 3> for Bar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const T: usize = 42;

impl Foo<N = const 3> for Bar {
//~^ ERROR expected lifetime, type, or constant, found keyword `const`
//~| ERROR this trait takes 1 generic
//~| ERROR trait takes 1 generic
//~| ERROR associated type bindings are not allowed here
//~| ERROR associated const equality is incomplete
fn do_x(&self) -> [u8; 3] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LL | impl Foo<N = const 3> for Bar {
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable

error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-89013.rs:9:6
|
LL | impl Foo<N = const 3> for Bar {
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/constructor-lifetime-args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ enum E<'a, 'b> {
fn main() {
S(&0, &0); // OK
S::<'static>(&0, &0);
//~^ ERROR this struct takes 2 lifetime arguments
//~^ ERROR struct takes 2 lifetime arguments
S::<'static, 'static, 'static>(&0, &0);
//~^ ERROR this struct takes 2 lifetime arguments
//~^ ERROR struct takes 2 lifetime arguments
E::V(&0); // OK
E::V::<'static>(&0);
//~^ ERROR this enum takes 2 lifetime arguments
//~^ ERROR enum takes 2 lifetime arguments
E::V::<'static, 'static, 'static>(&0);
//~^ ERROR this enum takes 2 lifetime arguments
//~^ ERROR enum takes 2 lifetime arguments
}
8 changes: 4 additions & 4 deletions tests/ui/constructor-lifetime-args.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/constructor-lifetime-args.rs:17:5
|
LL | S::<'static>(&0, &0);
Expand All @@ -16,7 +16,7 @@ help: add missing lifetime argument
LL | S::<'static, 'static>(&0, &0);
| +++++++++

error[E0107]: this struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
--> $DIR/constructor-lifetime-args.rs:19:5
|
LL | S::<'static, 'static, 'static>(&0, &0);
Expand All @@ -30,7 +30,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b`
LL | struct S<'a, 'b>(&'a u8, &'b u8);
| ^ -- --

error[E0107]: this enum takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/constructor-lifetime-args.rs:22:8
|
LL | E::V::<'static>(&0);
Expand All @@ -48,7 +48,7 @@ help: add missing lifetime argument
LL | E::V::<'static, 'static>(&0);
| +++++++++

error[E0107]: this enum takes 2 lifetime arguments but 3 lifetime arguments were supplied
error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supplied
--> $DIR/constructor-lifetime-args.rs:24:8
|
LL | E::V::<'static, 'static, 'static>(&0);
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/error-codes/E0107.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,39 @@ enum Bar {

struct Baz<'a, 'b, 'c> {
buzz: Buzz<'a>,
//~^ ERROR this struct takes 2 lifetime arguments
//~^ ERROR struct takes 2 lifetime arguments
//~| HELP add missing lifetime argument

bar: Bar<'a>,
//~^ ERROR this enum takes 0 lifetime arguments
//~^ ERROR enum takes 0 lifetime arguments
//~| HELP remove these generics

foo2: Foo<'a, 'b, 'c>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments

qux1: Qux<'a, 'b, i32>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument

qux2: Qux<'a, i32, 'b>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument

qux3: Qux<'a, 'b, 'c, i32>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments

qux4: Qux<'a, i32, 'b, 'c>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments

qux5: Qux<'a, 'b, i32, 'c>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument

quux: Quux<'a, i32, 'b>,
//~^ ERROR this struct takes 0 lifetime arguments
//~^ ERROR struct takes 0 lifetime arguments
//~| HELP remove this lifetime argument
}

Expand All @@ -53,7 +53,7 @@ pub trait T {
}

fn trait_bound_generic<I: T<u8, u16>>(_i: I) {
//~^ ERROR this trait takes 0 generic arguments
//~^ ERROR trait takes 0 generic arguments
//~| HELP replace the generic bounds with the associated types
}

Expand Down
20 changes: 10 additions & 10 deletions tests/ui/error-codes/E0107.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/E0107.rs:13:11
|
LL | buzz: Buzz<'a>,
Expand All @@ -16,7 +16,7 @@ help: add missing lifetime argument
LL | buzz: Buzz<'a, 'a>,
| ++++

error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/E0107.rs:17:10
|
LL | bar: Bar<'a>,
Expand All @@ -30,7 +30,7 @@ note: enum defined here, with 0 lifetime parameters
LL | enum Bar {
| ^^^

error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:21:11
|
LL | foo2: Foo<'a, 'b, 'c>,
Expand All @@ -44,7 +44,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Foo<'a>(&'a str);
| ^^^ --

error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:25:11
|
LL | qux1: Qux<'a, 'b, i32>,
Expand All @@ -58,7 +58,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --

error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:29:11
|
LL | qux2: Qux<'a, i32, 'b>,
Expand All @@ -72,7 +72,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --

error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:33:11
|
LL | qux3: Qux<'a, 'b, 'c, i32>,
Expand All @@ -86,7 +86,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --

error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:37:11
|
LL | qux4: Qux<'a, i32, 'b, 'c>,
Expand All @@ -100,7 +100,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --

error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:41:11
|
LL | qux5: Qux<'a, 'b, i32, 'c>,
Expand All @@ -114,7 +114,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --

error[E0107]: this struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:45:11
|
LL | quux: Quux<'a, i32, 'b>,
Expand All @@ -128,7 +128,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct Quux<T>(T);
| ^^^^

error[E0107]: this trait takes 0 generic arguments but 2 generic arguments were supplied
error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied
--> $DIR/E0107.rs:55:27
|
LL | fn trait_bound_generic<I: T<u8, u16>>(_i: I) {
Expand Down
Loading

0 comments on commit 198c687

Please sign in to comment.