do not use <: in subtyping overflow msg
This commit is contained in:
parent
f7cdff825c
commit
49dc0f22f4
@ -239,6 +239,17 @@ fn with_short_path<'tcx, T>(tcx: TyCtxt<'tcx>, value: T) -> String
|
||||
}
|
||||
OverflowCause::TraitSolver(predicate) => {
|
||||
let predicate = self.resolve_vars_if_possible(predicate);
|
||||
match predicate.kind().skip_binder() {
|
||||
ty::PredicateKind::Subtype(ty::SubtypePredicate { a, b, a_is_expected: _ })
|
||||
| ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => {
|
||||
struct_span_code_err!(
|
||||
self.dcx(),
|
||||
span,
|
||||
E0275,
|
||||
"overflow setting `{a}` to a subtype of `{b}`",
|
||||
)
|
||||
}
|
||||
_ => {
|
||||
let pred_str = with_short_path(self.tcx, predicate);
|
||||
struct_span_code_err!(
|
||||
self.dcx(),
|
||||
@ -247,6 +258,8 @@ fn with_short_path<'tcx, T>(tcx: TyCtxt<'tcx>, value: T) -> String
|
||||
"overflow evaluating the requirement `{pred_str}`",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if suggest_increasing_limit {
|
||||
|
@ -29,5 +29,5 @@ pub fn new(race: R) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Race::new(|race| race.when()); //~ ERROR overflow evaluating the requirement `_ <: Option<_>`
|
||||
Race::new(|race| race.when()); //~ ERROR overflow setting `_` to a subtype of `Option<_>`
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0275]: overflow evaluating the requirement `_ <: Option<_>`
|
||||
error[E0275]: overflow setting `_` to a subtype of `Option<_>`
|
||||
--> $DIR/issue-84073.rs:32:22
|
||||
|
|
||||
LL | Race::new(|race| race.when());
|
||||
|
@ -14,7 +14,7 @@ pub fn main() {
|
||||
let mut x;
|
||||
loop {
|
||||
x = Box::new(x);
|
||||
//~^ ERROR overflow evaluating the requirement `Box<_> <: _`
|
||||
//~^ ERROR overflow setting `Box<_>` to a subtype of `_`
|
||||
x.foo;
|
||||
x.bar();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0275]: overflow evaluating the requirement `Box<_> <: _`
|
||||
error[E0275]: overflow setting `Box<_>` to a subtype of `_`
|
||||
--> $DIR/infinite-autoderef.rs:16:13
|
||||
|
|
||||
LL | x = Box::new(x);
|
||||
|
@ -5,5 +5,5 @@ fn main() {
|
||||
|
||||
g = f;
|
||||
f = Box::new(g);
|
||||
//~^ ERROR overflow evaluating the requirement `Box<_> <: _`
|
||||
//~^ ERROR overflow setting `Box<_>` to a subtype of `_`
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0275]: overflow evaluating the requirement `Box<_> <: _`
|
||||
error[E0275]: overflow setting `Box<_>` to a subtype of `_`
|
||||
--> $DIR/occurs-check-2.rs:7:9
|
||||
|
|
||||
LL | f = Box::new(g);
|
||||
|
@ -4,7 +4,7 @@ enum Clam<T> { A(T) }
|
||||
fn main() {
|
||||
let c;
|
||||
c = Clam::A(c);
|
||||
//~^ ERROR overflow evaluating the requirement `Clam<_> <: _`
|
||||
//~^ ERROR overflow setting `Clam<_>` to a subtype of `_`
|
||||
match c {
|
||||
Clam::A::<isize>(_) => { }
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0275]: overflow evaluating the requirement `Clam<_> <: _`
|
||||
error[E0275]: overflow setting `Clam<_>` to a subtype of `_`
|
||||
--> $DIR/occurs-check-3.rs:6:9
|
||||
|
|
||||
LL | c = Clam::A(c);
|
||||
|
@ -1,5 +1,5 @@
|
||||
fn main() {
|
||||
let f;
|
||||
f = Box::new(f);
|
||||
//~^ ERROR overflow evaluating the requirement `Box<_> <: _`
|
||||
//~^ ERROR overflow setting `Box<_>` to a subtype of `_`
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0275]: overflow evaluating the requirement `Box<_> <: _`
|
||||
error[E0275]: overflow setting `Box<_>` to a subtype of `_`
|
||||
--> $DIR/occurs-check.rs:3:9
|
||||
|
|
||||
LL | f = Box::new(f);
|
||||
|
@ -10,7 +10,7 @@ fn main() {
|
||||
let x = return;
|
||||
let y = return;
|
||||
let mut w = (x, y);
|
||||
//~^ ERROR overflow evaluating the requirement
|
||||
//~^ ERROR overflow setting `_` to a subtype of `*const _`
|
||||
// Avoid creating lifetimes, `Sized` bounds or function calls.
|
||||
let a = (ptr::addr_of!(y), ptr::addr_of!(x));
|
||||
w = a;
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0275]: overflow evaluating the requirement `_ <: *const _`
|
||||
error[E0275]: overflow setting `_` to a subtype of `*const _`
|
||||
--> $DIR/subtype-recursion-limit.rs:12:17
|
||||
|
|
||||
LL | let mut w = (x, y);
|
||||
|
@ -13,8 +13,8 @@ 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 evaluating the requirement
|
||||
None => panic!("absured"),
|
||||
//~^ ERROR overflow setting `_` to a subtype of `Option<_>`
|
||||
None => panic!("absurd"),
|
||||
Some(a) => a,
|
||||
};
|
||||
let right = move |o_b| match o_b {
|
||||
|
@ -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 evaluating the requirement `_ <: Option<_>`
|
||||
error[E0275]: overflow setting `_` to a subtype of `Option<_>`
|
||||
--> $DIR/well-formed-recursion-limit.rs:15:33
|
||||
|
|
||||
LL | let left = move |o_a| match o_a {
|
||||
|
Loading…
Reference in New Issue
Block a user