Skip to content

Commit

Permalink
change error messages to be incorrect, but more helpful
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Feb 22, 2024
1 parent 49dc0f2 commit c71484e
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
self.dcx(),
span,
E0275,
"overflow setting `{a}` to a subtype of `{b}`",
"overflow assigning `{a}` to `{b}`",
)
}
_ => {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/impl-trait/issues/issue-84073.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ where
}

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<_>`
}
2 changes: 1 addition & 1 deletion tests/ui/impl-trait/issues/issue-84073.stderr
Original file line number Diff line number Diff line change
@@ -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());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/infinite/infinite-autoderef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/infinite/infinite-autoderef.stderr
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/occurs-check-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 `_`
}
2 changes: 1 addition & 1 deletion tests/ui/occurs-check-2.stderr
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/occurs-check-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(_) => { }
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/occurs-check-3.stderr
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/occurs-check.rs
Original file line number Diff line number Diff line change
@@ -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 `_`
}
2 changes: 1 addition & 1 deletion tests/ui/occurs-check.stderr
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/subtype-recursion-limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/subtype-recursion-limit.stderr
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/well-formed-recursion-limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/well-formed-recursion-limit.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c71484e

Please sign in to comment.