Move ty::Error branch into super_combine_tys
This commit is contained in:
parent
df1b5d3cc2
commit
09da2ebd63
10 changed files with 12 additions and 81 deletions
|
@ -43,6 +43,11 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
debug_assert!(!b.has_escaping_bound_vars());
|
debug_assert!(!b.has_escaping_bound_vars());
|
||||||
|
|
||||||
match (a.kind(), b.kind()) {
|
match (a.kind(), b.kind()) {
|
||||||
|
(&ty::Error(e), _) | (_, &ty::Error(e)) => {
|
||||||
|
self.set_tainted_by_errors(e);
|
||||||
|
return Ok(Ty::new_error(self.tcx, e));
|
||||||
|
}
|
||||||
|
|
||||||
// Relate integral variables to other types
|
// Relate integral variables to other types
|
||||||
(&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
|
(&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
|
||||||
self.inner.borrow_mut().int_unification_table().union(a_id, b_id);
|
self.inner.borrow_mut().int_unification_table().union(a_id, b_id);
|
||||||
|
|
|
@ -183,11 +183,6 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, 'tcx> {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
(&ty::Error(e), _) | (_, &ty::Error(e)) => {
|
|
||||||
infcx.set_tainted_by_errors(e);
|
|
||||||
return Ok(Ty::new_error(self.cx(), e));
|
|
||||||
}
|
|
||||||
|
|
||||||
(
|
(
|
||||||
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
|
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
|
||||||
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
|
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
|
||||||
|
|
|
@ -14,7 +14,6 @@ impl Foo for Baz {
|
||||||
//~^ ERROR `F` cannot be sent between threads safely
|
//~^ ERROR `F` cannot be sent between threads safely
|
||||||
where
|
where
|
||||||
F: FnMut() + Send,
|
F: FnMut() + Send,
|
||||||
//~^ ERROR impl has stricter requirements than trait
|
|
||||||
{
|
{
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,6 @@ LL | async fn bar<F>(&mut self, _func: F) -> ()
|
||||||
LL | F: FnMut() + Send,
|
LL | F: FnMut() + Send,
|
||||||
| ^^^^ required by this bound in `<Baz as Foo>::bar`
|
| ^^^^ required by this bound in `<Baz as Foo>::bar`
|
||||||
|
|
||||||
error[E0276]: impl has stricter requirements than trait
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/remove-invalid-type-bound-suggest-issue-127555.rs:16:22
|
|
||||||
|
|
|
||||||
LL | / fn bar<F>(&mut self, func: F) -> impl std::future::Future<Output = ()> + Send
|
|
||||||
LL | | where
|
|
||||||
LL | | F: FnMut();
|
|
||||||
| |___________________- definition of `bar` from trait
|
|
||||||
...
|
|
||||||
LL | F: FnMut() + Send,
|
|
||||||
| ^^^^ impl has extra requirement `F: Send`
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0276, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0276`.
|
|
||||||
|
|
|
@ -73,32 +73,6 @@ help: consider further restricting this bound
|
||||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||||
| +++++++++++
|
| +++++++++++
|
||||||
|
|
||||||
error[E0277]: the trait bound `F: Callback<i32>` is not satisfied
|
|
||||||
--> $DIR/false-positive-predicate-entailment-error.rs:43:12
|
|
||||||
|
|
|
||||||
LL | F: Callback<Self::CallbackArg>,
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>`
|
|
||||||
|
|
|
||||||
note: required for `F` to implement `Callback<i32>`
|
|
||||||
--> $DIR/false-positive-predicate-entailment-error.rs:14:21
|
|
||||||
|
|
|
||||||
LL | impl<A, F: MyFn<A>> Callback<A> for F {
|
|
||||||
| ------- ^^^^^^^^^^^ ^
|
|
||||||
| |
|
|
||||||
| unsatisfied trait bound introduced here
|
|
||||||
note: the requirement `F: Callback<i32>` appears on the `impl`'s method `autobatch` but not on the corresponding trait's method
|
|
||||||
--> $DIR/false-positive-predicate-entailment-error.rs:25:8
|
|
||||||
|
|
|
||||||
LL | trait ChannelSender {
|
|
||||||
| ------------- in this trait
|
|
||||||
...
|
|
||||||
LL | fn autobatch<F>(self) -> impl Trait
|
|
||||||
| ^^^^^^^^^ this trait's method doesn't have the requirement `F: Callback<i32>`
|
|
||||||
help: consider further restricting this bound
|
|
||||||
|
|
|
||||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
|
||||||
| +++++++++++
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
|
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
|
||||||
--> $DIR/false-positive-predicate-entailment-error.rs:36:30
|
--> $DIR/false-positive-predicate-entailment-error.rs:36:30
|
||||||
|
|
|
|
||||||
|
@ -168,6 +142,6 @@ help: consider further restricting this bound
|
||||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||||
| +++++++++++
|
| +++++++++++
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 7 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -41,8 +41,7 @@ impl ChannelSender for Sender {
|
||||||
//[current]~| ERROR the trait bound `F: MyFn<i32>` is not satisfied
|
//[current]~| ERROR the trait bound `F: MyFn<i32>` is not satisfied
|
||||||
where
|
where
|
||||||
F: Callback<Self::CallbackArg>,
|
F: Callback<Self::CallbackArg>,
|
||||||
//[current]~^ ERROR the trait bound `F: Callback<i32>` is not satisfied
|
//[current]~^ ERROR the trait bound `F: MyFn<i32>` is not satisfied
|
||||||
//[current]~| ERROR the trait bound `F: MyFn<i32>` is not satisfied
|
|
||||||
{
|
{
|
||||||
Thing
|
Thing
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ impl Foo<char> for Bar {
|
||||||
fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
||||||
//~^ ERROR: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied [E0277]
|
//~^ ERROR: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied [E0277]
|
||||||
//~| ERROR: the trait bound `Bar: Foo<u8>` is not satisfied [E0277]
|
//~| ERROR: the trait bound `Bar: Foo<u8>` is not satisfied [E0277]
|
||||||
//~| ERROR: impl has stricter requirements than trait
|
|
||||||
//~| ERROR: the trait bound `F2: Foo<u8>` is not satisfied
|
//~| ERROR: the trait bound `F2: Foo<u8>` is not satisfied
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,6 @@ note: required by a bound in `<Bar as Foo<char>>::foo`
|
||||||
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
||||||
| ^^^^^^^ required by this bound in `<Bar as Foo<char>>::foo`
|
| ^^^^^^^ required by this bound in `<Bar as Foo<char>>::foo`
|
||||||
|
|
||||||
error[E0276]: impl has stricter requirements than trait
|
|
||||||
--> $DIR/return-dont-satisfy-bounds.rs:8:16
|
|
||||||
|
|
|
||||||
LL | fn foo<F2>(self) -> impl Foo<T>;
|
|
||||||
| -------------------------------- definition of `foo` from trait
|
|
||||||
...
|
|
||||||
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
|
||||||
| ^^^^^^^ impl has extra requirement `F2: Foo<u8>`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Bar: Foo<u8>` is not satisfied
|
error[E0277]: the trait bound `Bar: Foo<u8>` is not satisfied
|
||||||
--> $DIR/return-dont-satisfy-bounds.rs:8:34
|
--> $DIR/return-dont-satisfy-bounds.rs:8:34
|
||||||
|
|
|
|
||||||
|
@ -44,7 +35,6 @@ LL | self
|
||||||
= help: the trait `Foo<char>` is implemented for `Bar`
|
= help: the trait `Foo<char>` is implemented for `Bar`
|
||||||
= help: for that trait implementation, expected `char`, found `u8`
|
= help: for that trait implementation, expected `char`, found `u8`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0276, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0276`.
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ pub trait Foo {
|
||||||
impl Foo for () {
|
impl Foo for () {
|
||||||
fn bar<'im: 'im>(&'im mut self) -> impl Sized + 'im {}
|
fn bar<'im: 'im>(&'im mut self) -> impl Sized + 'im {}
|
||||||
//~^ ERROR return type captures more lifetimes than trait definition
|
//~^ ERROR return type captures more lifetimes than trait definition
|
||||||
//~| WARN impl trait in impl method signature does not match trait method signature
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -21,22 +21,5 @@ LL | fn bar<'tr: 'tr>(&'tr mut self) -> impl Sized + use<Self>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: hidden type inferred to be `impl Sized + 'im`
|
= note: hidden type inferred to be `impl Sized + 'im`
|
||||||
|
|
||||||
warning: impl trait in impl method signature does not match trait method signature
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/rpitit-captures-more-method-lifetimes.rs:11:40
|
|
||||||
|
|
|
||||||
LL | fn bar<'tr: 'tr>(&'tr mut self) -> impl Sized + use<Self>;
|
|
||||||
| ---------------------- return type from trait method defined here
|
|
||||||
...
|
|
||||||
LL | fn bar<'im: 'im>(&'im mut self) -> impl Sized + 'im {}
|
|
||||||
| ^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
|
|
||||||
= note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
|
|
||||||
= note: `#[warn(refining_impl_trait_reachable)]` on by default
|
|
||||||
help: replace the return type so that it matches the trait
|
|
||||||
|
|
|
||||||
LL | fn bar<'im: 'im>(&'im mut self) -> impl Sized {}
|
|
||||||
| ~~~~~~~~~~
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors; 1 warning emitted
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue