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 @@ -876,7 +876,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
}

if let Ok(Some(ImplSource::UserDefined(impl_data))) =
SelectionContext::new(self).select(&obligation.with(self.tcx, trait_ref.skip_binder()))
self.enter_forall(trait_ref, |trait_ref_for_select| {
SelectionContext::new(self).select(&obligation.with(self.tcx, trait_ref_for_select))
})
{
let impl_did = impl_data.impl_def_id;
let trait_did = trait_ref.def_id();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Regression test for https://github.com/rust-lang/rust/issues/151894
//@ compile-flags: -Znext-solver=globally

Comment thread
cijiugechu marked this conversation as resolved.
#![feature(const_trait_impl)]

const fn with_positive<F: for<'a> [const] Fn(&'a ())>() {}

const _: () = {
with_positive::<()>(); //~ ERROR expected a `Fn(&'a ())` closure, found `()`
};

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0277]: expected a `Fn(&'a ())` closure, found `()`
--> $DIR/const-host-effect-hrtb-no-ice.rs:9:21
|
LL | with_positive::<()>();
| ^^ expected an `Fn(&'a ())` closure, found `()`
|
= help: the trait `for<'a> Fn(&'a ())` is not implemented for `()`
note: required by a bound in `with_positive`
--> $DIR/const-host-effect-hrtb-no-ice.rs:6:27
|
LL | const fn with_positive<F: for<'a> [const] Fn(&'a ())>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_positive`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
Loading