change error messages to be incorrect, but more helpful

This commit is contained in:
lcnr 2024-02-22 18:18:33 +01:00
parent 49dc0f22f4
commit c71484eefd
15 changed files with 15 additions and 15 deletions

View file

@ -246,7 +246,7 @@ fn with_short_path<'tcx, T>(tcx: TyCtxt<'tcx>, value: T) -> String
self.dcx(),
span,
E0275,
"overflow setting `{a}` to a subtype of `{b}`",
"overflow assigning `{a}` to `{b}`",
)
}
_ => {

View file

@ -29,5 +29,5 @@ pub fn new(race: R) {}
}
fn main() {
Race::new(|race| race.when()); //~ ERROR overflow setting `_` to a subtype of `Option<_>`
Race::new(|race| race.when()); //~ ERROR overflow assigning `_` to `Option<_>`
}

View file

@ -1,4 +1,4 @@
error[E0275]: overflow setting `_` to a subtype of `Option<_>`
error[E0275]: overflow assigning `_` to `Option<_>`
--> $DIR/issue-84073.rs:32:22
|
LL | Race::new(|race| race.when());

View file

@ -14,7 +14,7 @@ pub fn main() {
let mut x;
loop {
x = Box::new(x);
//~^ ERROR overflow setting `Box<_>` to a subtype of `_`
//~^ ERROR overflow assigning `Box<_>` to `_`
x.foo;
x.bar();
}

View file

@ -1,4 +1,4 @@
error[E0275]: overflow setting `Box<_>` to a subtype of `_`
error[E0275]: overflow assigning `Box<_>` to `_`
--> $DIR/infinite-autoderef.rs:16:13
|
LL | x = Box::new(x);

View file

@ -5,5 +5,5 @@ fn main() {
g = f;
f = Box::new(g);
//~^ ERROR overflow setting `Box<_>` to a subtype of `_`
//~^ ERROR overflow assigning `Box<_>` to `_`
}

View file

@ -1,4 +1,4 @@
error[E0275]: overflow setting `Box<_>` to a subtype of `_`
error[E0275]: overflow assigning `Box<_>` to `_`
--> $DIR/occurs-check-2.rs:7:9
|
LL | f = Box::new(g);

View file

@ -4,7 +4,7 @@ enum Clam<T> { A(T) }
fn main() {
let c;
c = Clam::A(c);
//~^ ERROR overflow setting `Clam<_>` to a subtype of `_`
//~^ ERROR overflow assigning `Clam<_>` to `_`
match c {
Clam::A::<isize>(_) => { }
}

View file

@ -1,4 +1,4 @@
error[E0275]: overflow setting `Clam<_>` to a subtype of `_`
error[E0275]: overflow assigning `Clam<_>` to `_`
--> $DIR/occurs-check-3.rs:6:9
|
LL | c = Clam::A(c);

View file

@ -1,5 +1,5 @@
fn main() {
let f;
f = Box::new(f);
//~^ ERROR overflow setting `Box<_>` to a subtype of `_`
//~^ ERROR overflow assigning `Box<_>` to `_`
}

View file

@ -1,4 +1,4 @@
error[E0275]: overflow setting `Box<_>` to a subtype of `_`
error[E0275]: overflow assigning `Box<_>` to `_`
--> $DIR/occurs-check.rs:3:9
|
LL | f = Box::new(f);

View file

@ -10,7 +10,7 @@ fn main() {
let x = return;
let y = return;
let mut w = (x, y);
//~^ ERROR overflow setting `_` to a subtype of `*const _`
//~^ ERROR overflow assigning `_` to `*const _`
// Avoid creating lifetimes, `Sized` bounds or function calls.
let a = (ptr::addr_of!(y), ptr::addr_of!(x));
w = a;

View file

@ -1,4 +1,4 @@
error[E0275]: overflow setting `_` to a subtype of `*const _`
error[E0275]: overflow assigning `_` to `*const _`
--> $DIR/subtype-recursion-limit.rs:12:17
|
LL | let mut w = (x, y);

View file

@ -13,7 +13,7 @@ pub fn iso_un_option<A: 'static, B: 'static>(i: ISO<Option<A>, Option<B>>) -> IS
//~^ ERROR no field `ab` on type
//~| ERROR no field `ba` on type
let left = move |o_a| match o_a {
//~^ ERROR overflow setting `_` to a subtype of `Option<_>`
//~^ ERROR overflow assigning `_` to `Option<_>`
None => panic!("absurd"),
Some(a) => a,
};

View file

@ -10,7 +10,7 @@ error[E0609]: no field `ba` on type `(Box<(dyn Fn(Option<A>) -> Option<B> + 'sta
LL | let (ab, ba) = (i.ab, i.ba);
| ^^ unknown field
error[E0275]: overflow setting `_` to a subtype of `Option<_>`
error[E0275]: overflow assigning `_` to `Option<_>`
--> $DIR/well-formed-recursion-limit.rs:15:33
|
LL | let left = move |o_a| match o_a {