1
Fork 0

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 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
self.dcx(), self.dcx(),
span, span,
E0275, E0275,
"overflow setting `{a}` to a subtype of `{b}`", "overflow assigning `{a}` to `{b}`",
) )
} }
_ => { _ => {

View file

@ -29,5 +29,5 @@ where
} }
fn main() { 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 --> $DIR/issue-84073.rs:32:22
| |
LL | Race::new(|race| race.when()); LL | Race::new(|race| race.when());

View file

@ -14,7 +14,7 @@ pub fn main() {
let mut x; let mut x;
loop { loop {
x = Box::new(x); x = Box::new(x);
//~^ ERROR overflow setting `Box<_>` to a subtype of `_` //~^ ERROR overflow assigning `Box<_>` to `_`
x.foo; x.foo;
x.bar(); 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 --> $DIR/infinite-autoderef.rs:16:13
| |
LL | x = Box::new(x); LL | x = Box::new(x);

View file

@ -5,5 +5,5 @@ fn main() {
g = f; g = f;
f = Box::new(g); 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 --> $DIR/occurs-check-2.rs:7:9
| |
LL | f = Box::new(g); LL | f = Box::new(g);

View file

@ -4,7 +4,7 @@ enum Clam<T> { A(T) }
fn main() { fn main() {
let c; let c;
c = Clam::A(c); c = Clam::A(c);
//~^ ERROR overflow setting `Clam<_>` to a subtype of `_` //~^ ERROR overflow assigning `Clam<_>` to `_`
match c { match c {
Clam::A::<isize>(_) => { } 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 --> $DIR/occurs-check-3.rs:6:9
| |
LL | c = Clam::A(c); LL | c = Clam::A(c);

View file

@ -1,5 +1,5 @@
fn main() { fn main() {
let f; let f;
f = Box::new(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 --> $DIR/occurs-check.rs:3:9
| |
LL | f = Box::new(f); LL | f = Box::new(f);

View file

@ -10,7 +10,7 @@ fn main() {
let x = return; let x = return;
let y = return; let y = return;
let mut w = (x, y); 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. // Avoid creating lifetimes, `Sized` bounds or function calls.
let a = (ptr::addr_of!(y), ptr::addr_of!(x)); let a = (ptr::addr_of!(y), ptr::addr_of!(x));
w = a; 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 --> $DIR/subtype-recursion-limit.rs:12:17
| |
LL | let mut w = (x, y); 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 `ab` on type
//~| ERROR no field `ba` on type //~| ERROR no field `ba` on type
let left = move |o_a| match o_a { let left = move |o_a| match o_a {
//~^ ERROR overflow setting `_` to a subtype of `Option<_>` //~^ ERROR overflow assigning `_` to `Option<_>`
None => panic!("absurd"), None => panic!("absurd"),
Some(a) => a, 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); LL | let (ab, ba) = (i.ab, i.ba);
| ^^ unknown field | ^^ 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 --> $DIR/well-formed-recursion-limit.rs:15:33
| |
LL | let left = move |o_a| match o_a { LL | let left = move |o_a| match o_a {