Check that alias-relate terms are WF if reporting an error in alias-relate
This commit is contained in:
parent
921645c737
commit
93ee07c756
11 changed files with 43 additions and 167 deletions
|
@ -515,6 +515,30 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> {
|
||||||
self.with_derived_obligation(obligation, |this| nested_goal.visit_with(this))?;
|
self.with_derived_obligation(obligation, |this| nested_goal.visit_with(this))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// alias-relate may fail because the lhs or rhs can't be normalized,
|
||||||
|
// and therefore is treated as rigid.
|
||||||
|
if let Some(ty::PredicateKind::AliasRelate(lhs, rhs, _)) = pred_kind.no_bound_vars() {
|
||||||
|
if let Some(obligation) = goal
|
||||||
|
.infcx()
|
||||||
|
.visit_proof_tree(
|
||||||
|
goal.goal().with(goal.infcx().tcx, ty::ClauseKind::WellFormed(lhs.into())),
|
||||||
|
self,
|
||||||
|
)
|
||||||
|
.break_value()
|
||||||
|
{
|
||||||
|
return ControlFlow::Break(obligation);
|
||||||
|
} else if let Some(obligation) = goal
|
||||||
|
.infcx()
|
||||||
|
.visit_proof_tree(
|
||||||
|
goal.goal().with(goal.infcx().tcx, ty::ClauseKind::WellFormed(rhs.into())),
|
||||||
|
self,
|
||||||
|
)
|
||||||
|
.break_value()
|
||||||
|
{
|
||||||
|
return ControlFlow::Break(obligation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ControlFlow::Break(self.obligation.clone())
|
ControlFlow::Break(self.obligation.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,18 +31,6 @@ help: consider further restricting `Self`
|
||||||
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
||||||
| +++++++++++++++++++++++++
|
| +++++++++++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<Self as Deref>::Target == str`
|
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:31
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
||||||
|
|
|
|
||||||
|
@ -50,10 +38,10 @@ LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + Fro
|
||||||
| ^^^^ the trait `Deref` is not implemented for `Self`
|
| ^^^^ the trait `Deref` is not implemented for `Self`
|
||||||
|
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
note: required by a bound in `UncheckedCopy::Output`
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:25
|
--> $DIR/defaults-unsound-62211-1.rs:24:31
|
||||||
|
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
||||||
help: consider further restricting `Self`
|
help: consider further restricting `Self`
|
||||||
|
|
|
|
||||||
LL | trait UncheckedCopy: Sized + Deref {
|
LL | trait UncheckedCopy: Sized + Deref {
|
||||||
|
@ -75,7 +63,6 @@ help: consider further restricting `Self`
|
||||||
LL | trait UncheckedCopy: Sized + Copy {
|
LL | trait UncheckedCopy: Sized + Copy {
|
||||||
| ++++++
|
| ++++++
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ trait UncheckedCopy: Sized {
|
||||||
//~| ERROR the trait bound `Self: Deref` is not satisfied
|
//~| ERROR the trait bound `Self: Deref` is not satisfied
|
||||||
//~| ERROR cannot add-assign `&'static str` to `Self`
|
//~| ERROR cannot add-assign `&'static str` to `Self`
|
||||||
//~| ERROR `Self` doesn't implement `std::fmt::Display`
|
//~| ERROR `Self` doesn't implement `std::fmt::Display`
|
||||||
//[next]~| ERROR type mismatch resolving `<Self as Deref>::Target == str`
|
|
||||||
|
|
||||||
// We said the Output type was Copy, so we can Copy it freely!
|
// We said the Output type was Copy, so we can Copy it freely!
|
||||||
fn unchecked_copy(other: &Self::Output) -> Self::Output {
|
fn unchecked_copy(other: &Self::Output) -> Self::Output {
|
||||||
|
|
|
@ -31,18 +31,6 @@ help: consider further restricting `Self`
|
||||||
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
||||||
| +++++++++++++++++++++++++
|
| +++++++++++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<Self as Deref>::Target == str`
|
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:31
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
||||||
|
|
|
|
||||||
|
@ -50,10 +38,10 @@ LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + Fro
|
||||||
| ^^^^ the trait `Deref` is not implemented for `Self`
|
| ^^^^ the trait `Deref` is not implemented for `Self`
|
||||||
|
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
note: required by a bound in `UncheckedCopy::Output`
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:25
|
--> $DIR/defaults-unsound-62211-2.rs:24:31
|
||||||
|
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
||||||
help: consider further restricting `Self`
|
help: consider further restricting `Self`
|
||||||
|
|
|
|
||||||
LL | trait UncheckedCopy: Sized + Deref {
|
LL | trait UncheckedCopy: Sized + Deref {
|
||||||
|
@ -75,7 +63,6 @@ help: consider further restricting `Self`
|
||||||
LL | trait UncheckedCopy: Sized + Copy {
|
LL | trait UncheckedCopy: Sized + Copy {
|
||||||
| ++++++
|
| ++++++
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ trait UncheckedCopy: Sized {
|
||||||
//~| ERROR the trait bound `Self: Deref` is not satisfied
|
//~| ERROR the trait bound `Self: Deref` is not satisfied
|
||||||
//~| ERROR cannot add-assign `&'static str` to `Self`
|
//~| ERROR cannot add-assign `&'static str` to `Self`
|
||||||
//~| ERROR `Self` doesn't implement `std::fmt::Display`
|
//~| ERROR `Self` doesn't implement `std::fmt::Display`
|
||||||
//[next]~| ERROR type mismatch resolving `<Self as Deref>::Target == str`
|
|
||||||
|
|
||||||
// We said the Output type was Copy, so we can Copy it freely!
|
// We said the Output type was Copy, so we can Copy it freely!
|
||||||
fn unchecked_copy(other: &Self::Output) -> Self::Output {
|
fn unchecked_copy(other: &Self::Output) -> Self::Output {
|
||||||
|
|
|
@ -1,15 +1,3 @@
|
||||||
error[E0271]: type mismatch resolving `<<T as SubEncoder>::ActualSize as Add>::Output == <T as SubEncoder>::ActualSize`
|
|
||||||
--> $DIR/issue-54108.rs:23:17
|
|
||||||
|
|
|
||||||
LL | type Size = <Self as SubEncoder>::ActualSize;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `Encoder::Size`
|
|
||||||
--> $DIR/issue-54108.rs:8:20
|
|
||||||
|
|
|
||||||
LL | type Size: Add<Output = Self::Size>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
|
|
||||||
|
|
||||||
error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
|
error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
|
||||||
--> $DIR/issue-54108.rs:23:17
|
--> $DIR/issue-54108.rs:23:17
|
||||||
|
|
|
|
||||||
|
@ -18,16 +6,15 @@ LL | type Size = <Self as SubEncoder>::ActualSize;
|
||||||
|
|
|
|
||||||
= help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize`
|
= help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize`
|
||||||
note: required by a bound in `Encoder::Size`
|
note: required by a bound in `Encoder::Size`
|
||||||
--> $DIR/issue-54108.rs:8:16
|
--> $DIR/issue-54108.rs:8:20
|
||||||
|
|
|
|
||||||
LL | type Size: Add<Output = Self::Size>;
|
LL | type Size: Add<Output = Self::Size>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
|
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
|
||||||
help: consider further restricting the associated type
|
help: consider further restricting the associated type
|
||||||
|
|
|
|
||||||
LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add
|
LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ where
|
||||||
{
|
{
|
||||||
type Size = <Self as SubEncoder>::ActualSize;
|
type Size = <Self as SubEncoder>::ActualSize;
|
||||||
//~^ ERROR: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
|
//~^ ERROR: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
|
||||||
//[next]~| ERROR type mismatch resolving `<<T as SubEncoder>::ActualSize as Add>::Output == <T as SubEncoder>::ActualSize`
|
|
||||||
|
|
||||||
fn foo(&self) -> Self::Size {
|
fn foo(&self) -> Self::Size {
|
||||||
self.bar() + self.bar()
|
self.bar() + self.bar()
|
||||||
|
|
|
@ -6,8 +6,6 @@ LL | needs_coroutine(
|
||||||
LL | #[coroutine]
|
LL | #[coroutine]
|
||||||
LL | / || {
|
LL | / || {
|
||||||
LL | |
|
LL | |
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | | yield ();
|
LL | | yield ();
|
||||||
LL | | },
|
LL | | },
|
||||||
| |_________^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/coroutine.rs:20:9: 20:11}`
|
| |_________^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/coroutine.rs:20:9: 20:11}`
|
||||||
|
@ -18,47 +16,6 @@ note: required by a bound in `needs_coroutine`
|
||||||
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Yield == B`
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/coroutine.rs:20:9
|
|
||||||
|
|
|
||||||
LL | needs_coroutine(
|
|
||||||
| --------------- required by a bound introduced by this call
|
|
||||||
LL | #[coroutine]
|
|
||||||
LL | / || {
|
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | | yield ();
|
|
||||||
LL | | },
|
|
||||||
| |_________^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `needs_coroutine`
|
|
||||||
--> $DIR/coroutine.rs:14:41
|
|
||||||
|
|
|
||||||
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
|
||||||
| ^^^^^^^^^ required by this bound in `needs_coroutine`
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Return == C`
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
--> $DIR/coroutine.rs:20:9
|
|
||||||
|
|
|
||||||
LL | needs_coroutine(
|
|
||||||
| --------------- required by a bound introduced by this call
|
|
||||||
LL | #[coroutine]
|
|
||||||
LL | / || {
|
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | | yield ();
|
|
||||||
LL | | },
|
|
||||||
| |_________^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `needs_coroutine`
|
|
||||||
--> $DIR/coroutine.rs:14:52
|
|
||||||
|
|
|
||||||
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
|
||||||
| ^^^^^^^^^^ required by this bound in `needs_coroutine`
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ fn main() {
|
||||||
#[coroutine]
|
#[coroutine]
|
||||||
|| {
|
|| {
|
||||||
//[fail]~^ ERROR Coroutine<A>` is not satisfied
|
//[fail]~^ ERROR Coroutine<A>` is not satisfied
|
||||||
//[fail]~| ERROR as Coroutine<A>>::Yield == B`
|
|
||||||
//[fail]~| ERROR as Coroutine<A>>::Return == C`
|
|
||||||
yield ();
|
yield ();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,14 +19,10 @@ fn main() {
|
||||||
require_fn(f as fn() -> i32);
|
require_fn(f as fn() -> i32);
|
||||||
require_fn(f as unsafe fn() -> i32);
|
require_fn(f as unsafe fn() -> i32);
|
||||||
//~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32`
|
//~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32`
|
||||||
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32`
|
|
||||||
require_fn(g);
|
require_fn(g);
|
||||||
//~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
//~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
||||||
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32`
|
|
||||||
require_fn(g as extern "C" fn() -> i32);
|
require_fn(g as extern "C" fn() -> i32);
|
||||||
//~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32`
|
//~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32`
|
||||||
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32`
|
|
||||||
require_fn(h);
|
require_fn(h);
|
||||||
//~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
|
//~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
|
||||||
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32`
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,22 +15,8 @@ note: required by a bound in `require_fn`
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32`
|
|
||||||
--> $DIR/fn-trait.rs:20:16
|
|
||||||
|
|
|
||||||
LL | require_fn(f as unsafe fn() -> i32);
|
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
||||||
--> $DIR/fn-trait.rs:23:16
|
--> $DIR/fn-trait.rs:22:16
|
||||||
|
|
|
|
||||||
LL | require_fn(g);
|
LL | require_fn(g);
|
||||||
| ---------- ^ expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
| ---------- ^ expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
||||||
|
@ -45,22 +31,8 @@ note: required by a bound in `require_fn`
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32`
|
|
||||||
--> $DIR/fn-trait.rs:23:16
|
|
||||||
|
|
|
||||||
LL | require_fn(g);
|
|
||||||
| ---------- ^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
|
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
|
||||||
--> $DIR/fn-trait.rs:26:16
|
--> $DIR/fn-trait.rs:24:16
|
||||||
|
|
|
|
||||||
LL | require_fn(g as extern "C" fn() -> i32);
|
LL | require_fn(g as extern "C" fn() -> i32);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `extern "C" fn() -> i32`
|
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `extern "C" fn() -> i32`
|
||||||
|
@ -75,22 +47,8 @@ note: required by a bound in `require_fn`
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32`
|
|
||||||
--> $DIR/fn-trait.rs:26:16
|
|
||||||
|
|
|
||||||
LL | require_fn(g as extern "C" fn() -> i32);
|
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
|
error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
|
||||||
--> $DIR/fn-trait.rs:29:16
|
--> $DIR/fn-trait.rs:26:16
|
||||||
|
|
|
|
||||||
LL | require_fn(h);
|
LL | require_fn(h);
|
||||||
| ---------- ^ call the function in a closure: `|| unsafe { /* code */ }`
|
| ---------- ^ call the function in a closure: `|| unsafe { /* code */ }`
|
||||||
|
@ -106,21 +64,6 @@ note: required by a bound in `require_fn`
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32`
|
error: aborting due to 4 previous errors
|
||||||
--> $DIR/fn-trait.rs:29:16
|
|
||||||
|
|
|
||||||
LL | require_fn(h);
|
|
||||||
| ---------- ^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue