wording tweaks

This commit is contained in:
Ellen 2022-05-06 11:37:22 +01:00
parent fea1d76503
commit 2819b2d8c9
5 changed files with 20 additions and 20 deletions

View file

@ -1003,7 +1003,7 @@ fn compare_generic_param_kinds<'tcx>(
} {
let make_param_message = |prefix: &str, param: &ty::GenericParamDef| match param.kind {
Const { .. } => {
format!("{} const parameter with type `{}`", prefix, tcx.type_of(param.def_id))
format!("{} const parameter of type `{}`", prefix, tcx.type_of(param.def_id))
}
Type { .. } => format!("{} type parameter", prefix),
Lifetime { .. } => unreachable!(),
@ -1016,7 +1016,7 @@ fn compare_generic_param_kinds<'tcx>(
tcx.sess,
param_impl_span,
E0053,
"{} `{}` has an incompatible generic parameter for trait: `{}`",
"{} `{}` has an incompatible generic parameter for trait `{}`",
assoc_item_kind_str(&impl_item),
trait_item.name,
&tcx.def_path_str(tcx.parent(trait_item.def_id))

View file

@ -1,4 +1,4 @@
error[E0053]: method `foo` has an incompatible generic parameter for trait: `Trait`
error[E0053]: method `foo` has an incompatible generic parameter for trait `Trait`
--> $DIR/mismatched_ty_const_in_trait_impl.rs:5:12
|
LL | trait Trait {
@ -9,48 +9,48 @@ LL | }
LL | impl Trait for () {
| -----------------
LL | fn foo<const M: u64>() {}
| ^^^^^^^^^^^^ found const parameter with type `u64`
| ^^^^^^^^^^^^ found const parameter of type `u64`
error[E0053]: method `bar` has an incompatible generic parameter for trait: `Other`
error[E0053]: method `bar` has an incompatible generic parameter for trait `Other`
--> $DIR/mismatched_ty_const_in_trait_impl.rs:13:12
|
LL | trait Other {
| -----
LL | fn bar<const M: u8>() {}
| ----------- expected const parameter with type `u8`
| ----------- expected const parameter of type `u8`
LL | }
LL | impl Other for () {
| -----------------
LL | fn bar<T>() {}
| ^ found type parameter
error[E0053]: method `baz` has an incompatible generic parameter for trait: `Uwu`
error[E0053]: method `baz` has an incompatible generic parameter for trait `Uwu`
--> $DIR/mismatched_ty_const_in_trait_impl.rs:21:12
|
LL | trait Uwu {
| ---
LL | fn baz<const N: u32>() {}
| ------------ expected const parameter with type `u32`
| ------------ expected const parameter of type `u32`
LL | }
LL | impl Uwu for () {
| ---------------
LL | fn baz<const N: i32>() {}
| ^^^^^^^^^^^^ found const parameter with type `i32`
| ^^^^^^^^^^^^ found const parameter of type `i32`
error[E0053]: method `bbbb` has an incompatible generic parameter for trait: `Aaaaaa`
error[E0053]: method `bbbb` has an incompatible generic parameter for trait `Aaaaaa`
--> $DIR/mismatched_ty_const_in_trait_impl.rs:29:13
|
LL | trait Aaaaaa {
| ------
LL | fn bbbb<const N: u32, T>() {}
| ------------ expected const parameter with type `u32`
| ------------ expected const parameter of type `u32`
LL | }
LL | impl Aaaaaa for () {
| ------------------
LL | fn bbbb<T, const N: u32>() {}
| ^ found type parameter
error[E0053]: method `abcd` has an incompatible generic parameter for trait: `Names`
error[E0053]: method `abcd` has an incompatible generic parameter for trait `Names`
--> $DIR/mismatched_ty_const_in_trait_impl.rs:37:13
|
LL | trait Names {
@ -61,7 +61,7 @@ LL | }
LL | impl Names for () {
| -----------------
LL | fn abcd<const N: u32, T>() {}
| ^^^^^^^^^^^^ found const parameter with type `u32`
| ^^^^^^^^^^^^ found const parameter of type `u32`
error: aborting due to 5 previous errors

View file

@ -14,7 +14,7 @@ trait Bits {
impl Bits for u8 {
fn bit<const I: usize>(self) -> bool {
//~^ ERROR: method `bit` has an incompatible generic parameter for trait: `Bits` [E0053]
//~^ ERROR: method `bit` has an incompatible generic parameter for trait `Bits` [E0053]
let i = 1 << I;
let mask = u8::from(i);
mask & self == mask

View file

@ -1,15 +1,15 @@
error[E0053]: method `bit` has an incompatible generic parameter for trait: `Bits`
error[E0053]: method `bit` has an incompatible generic parameter for trait `Bits`
--> $DIR/issue-86820.rs:16:12
|
LL | trait Bits {
| ----
LL | fn bit<const I: u8>(self) -> bool;
| ----------- expected const parameter with type `u8`
| ----------- expected const parameter of type `u8`
...
LL | impl Bits for u8 {
| ----------------
LL | fn bit<const I: usize>(self) -> bool {
| ^^^^^^^^^^^^^^ found const parameter with type `usize`
| ^^^^^^^^^^^^^^ found const parameter of type `usize`
error: aborting due to previous error

View file

@ -1,15 +1,15 @@
error[E0053]: type `Foo` has an incompatible generic parameter for trait: `Trait`
error[E0053]: type `Foo` has an incompatible generic parameter for trait `Trait`
--> $DIR/const_params_have_right_type.rs:8:14
|
LL | trait Trait {
| -----
LL | type Foo<const N: u8>;
| ----------- expected const parameter with type `u8`
| ----------- expected const parameter of type `u8`
...
LL | impl Trait for () {
| -----------------
LL | type Foo<const N: u64> = u32;
| ^^^^^^^^^^^^ found const parameter with type `u64`
| ^^^^^^^^^^^^ found const parameter of type `u64`
error: aborting due to previous error