Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4974,8 +4974,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
.as_ref()
.and_then(|typeck| typeck.node_type_opt(expr.hir_id))
&& let Some(pred) = predicate.as_clause()
&& let ty::ClauseKind::Trait(pred) = pred.kind().skip_binder()
&& self.can_eq(param_env, pred.self_ty(), expr_ty)
&& let Some(pred) = pred.as_trait_clause()
&& self
.infcx
.enter_forall(pred, |pred| self.can_eq(param_env, pred.self_ty(), expr_ty))
{
(expr_ty, expr)
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `for<'a> u8: From<&'a ()>` is not satisfied
--> $DIR/incorrect-skip-binder-for-item-bound.rs:19:15
--> $DIR/incorrect-skip-binder-for-item-bound.rs:16:15
|
LL | fn hello() -> impl for<'a> A<'a, Assoc: Into<u8> + 'static + Copy> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> From<&'a ()>` is not implemented for `u8`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error[E0277]: the trait bound `for<'a> u8: From<&'a ()>` is not satisfied
--> $DIR/incorrect-skip-binder-for-item-bound.rs:16:15
|
LL | fn hello() -> impl for<'a> A<'a, Assoc: Into<u8> + 'static + Copy> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> From<&'a ()>` is not implemented for `u8`
|
help: `u8` implements trait `From<T>`
--> $SRC_DIR/core/src/convert/num.rs:LL:COL
|
= note: `From<bool>`
::: $SRC_DIR/core/src/convert/num.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
= note: `From<std::ascii::Char>`
::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
= note: in this macro invocation
= note: required for `&'a ()` to implement `for<'a> Into<u8>`
= note: this error originates in the macro `impl_from_bool` which comes from the expansion of the macro `into_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[old] failure-status: 101
//@[old] dont-check-compiler-stderr
//@[old] known-bug: #139381
//@ needs-rustc-debug-assertions

// An ICE caused by an incorrect `skip_binder()` in diagnostics code, see #139381.
Expand All @@ -17,7 +14,7 @@ impl<'a> A<'a> for () {
}

fn hello() -> impl for<'a> A<'a, Assoc: Into<u8> + 'static + Copy> {
//[next]~^ ERROR: the trait bound `for<'a> u8: From<&'a ()>` is not satisfied
//~^ ERROR: the trait bound `for<'a> u8: From<&'a ()>` is not satisfied
()
}

Expand Down
Loading