From c71484eefd38d6d60a54981376f3b157789cc570 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 22 Feb 2024 18:18:33 +0100 Subject: [PATCH] change error messages to be incorrect, but more helpful --- .../src/traits/error_reporting/type_err_ctxt_ext.rs | 2 +- tests/ui/impl-trait/issues/issue-84073.rs | 2 +- tests/ui/impl-trait/issues/issue-84073.stderr | 2 +- tests/ui/infinite/infinite-autoderef.rs | 2 +- tests/ui/infinite/infinite-autoderef.stderr | 2 +- tests/ui/occurs-check-2.rs | 2 +- tests/ui/occurs-check-2.stderr | 2 +- tests/ui/occurs-check-3.rs | 2 +- tests/ui/occurs-check-3.stderr | 2 +- tests/ui/occurs-check.rs | 2 +- tests/ui/occurs-check.stderr | 2 +- tests/ui/traits/subtype-recursion-limit.rs | 2 +- tests/ui/traits/subtype-recursion-limit.stderr | 2 +- tests/ui/traits/well-formed-recursion-limit.rs | 2 +- tests/ui/traits/well-formed-recursion-limit.stderr | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index eaae900549e..2b74b15ec9f 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -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}`", ) } _ => { diff --git a/tests/ui/impl-trait/issues/issue-84073.rs b/tests/ui/impl-trait/issues/issue-84073.rs index 124b1d0eec8..85d9d461fd9 100644 --- a/tests/ui/impl-trait/issues/issue-84073.rs +++ b/tests/ui/impl-trait/issues/issue-84073.rs @@ -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<_>` } diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr index 2441e523684..ab119a8a4f4 100644 --- a/tests/ui/impl-trait/issues/issue-84073.stderr +++ b/tests/ui/impl-trait/issues/issue-84073.stderr @@ -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()); diff --git a/tests/ui/infinite/infinite-autoderef.rs b/tests/ui/infinite/infinite-autoderef.rs index ae854e1d204..ef6ba8ac87b 100644 --- a/tests/ui/infinite/infinite-autoderef.rs +++ b/tests/ui/infinite/infinite-autoderef.rs @@ -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(); } diff --git a/tests/ui/infinite/infinite-autoderef.stderr b/tests/ui/infinite/infinite-autoderef.stderr index 94ec00c591e..7d09af9a7d4 100644 --- a/tests/ui/infinite/infinite-autoderef.stderr +++ b/tests/ui/infinite/infinite-autoderef.stderr @@ -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); diff --git a/tests/ui/occurs-check-2.rs b/tests/ui/occurs-check-2.rs index 80ae75632a5..1ec460a8735 100644 --- a/tests/ui/occurs-check-2.rs +++ b/tests/ui/occurs-check-2.rs @@ -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 `_` } diff --git a/tests/ui/occurs-check-2.stderr b/tests/ui/occurs-check-2.stderr index cf5c95a1c42..54307a6c547 100644 --- a/tests/ui/occurs-check-2.stderr +++ b/tests/ui/occurs-check-2.stderr @@ -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); diff --git a/tests/ui/occurs-check-3.rs b/tests/ui/occurs-check-3.rs index f3d9a28b62d..377a043daf3 100644 --- a/tests/ui/occurs-check-3.rs +++ b/tests/ui/occurs-check-3.rs @@ -4,7 +4,7 @@ enum Clam { 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::(_) => { } } diff --git a/tests/ui/occurs-check-3.stderr b/tests/ui/occurs-check-3.stderr index 84197162c38..77b67ec1a62 100644 --- a/tests/ui/occurs-check-3.stderr +++ b/tests/ui/occurs-check-3.stderr @@ -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); diff --git a/tests/ui/occurs-check.rs b/tests/ui/occurs-check.rs index dce0a41bce7..638b9b6d7e4 100644 --- a/tests/ui/occurs-check.rs +++ b/tests/ui/occurs-check.rs @@ -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 `_` } diff --git a/tests/ui/occurs-check.stderr b/tests/ui/occurs-check.stderr index 0454e6ddda6..30468d68cbd 100644 --- a/tests/ui/occurs-check.stderr +++ b/tests/ui/occurs-check.stderr @@ -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); diff --git a/tests/ui/traits/subtype-recursion-limit.rs b/tests/ui/traits/subtype-recursion-limit.rs index c652e24644d..e4b08a7ec67 100644 --- a/tests/ui/traits/subtype-recursion-limit.rs +++ b/tests/ui/traits/subtype-recursion-limit.rs @@ -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; diff --git a/tests/ui/traits/subtype-recursion-limit.stderr b/tests/ui/traits/subtype-recursion-limit.stderr index 6544852bbf0..e3587de8613 100644 --- a/tests/ui/traits/subtype-recursion-limit.stderr +++ b/tests/ui/traits/subtype-recursion-limit.stderr @@ -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); diff --git a/tests/ui/traits/well-formed-recursion-limit.rs b/tests/ui/traits/well-formed-recursion-limit.rs index 49713be3a79..770b2222580 100644 --- a/tests/ui/traits/well-formed-recursion-limit.rs +++ b/tests/ui/traits/well-formed-recursion-limit.rs @@ -13,7 +13,7 @@ pub fn iso_un_option(i: ISO, Option>) -> 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, }; diff --git a/tests/ui/traits/well-formed-recursion-limit.stderr b/tests/ui/traits/well-formed-recursion-limit.stderr index 690d869b243..e0270ecabbd 100644 --- a/tests/ui/traits/well-formed-recursion-limit.stderr +++ b/tests/ui/traits/well-formed-recursion-limit.stderr @@ -10,7 +10,7 @@ error[E0609]: no field `ba` on type `(Box<(dyn Fn(Option) -> Option + '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 {