Fix #91489
This commit is contained in:
parent
e70e4d499d
commit
5166f68754
@ -1319,6 +1319,11 @@ impl<'tcx> ParamEnv<'tcx> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn without_const(mut self) -> Self {
|
||||||
|
self.packed.set_tag(ParamTag { constness: hir::Constness::NotConst, ..self.packed.tag() });
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a new parameter environment with the same clauses, but
|
/// Returns a new parameter environment with the same clauses, but
|
||||||
/// which "reveals" the true results of projections in all cases
|
/// which "reveals" the true results of projections in all cases
|
||||||
/// (even for associated types that are specializable). This is
|
/// (even for associated types that are specializable). This is
|
||||||
|
@ -80,7 +80,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
|
|
||||||
let generator_types = check_fn(
|
let generator_types = check_fn(
|
||||||
self,
|
self,
|
||||||
self.param_env,
|
self.param_env.without_const(),
|
||||||
liberated_sig,
|
liberated_sig,
|
||||||
decl,
|
decl,
|
||||||
expr.hir_id,
|
expr.hir_id,
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
#![feature(const_trait_impl)]
|
||||||
|
#![feature(const_fn_trait_bound)]
|
||||||
|
|
||||||
|
trait Convert<T> {
|
||||||
|
fn to(self) -> T;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<A, B> const Convert<B> for A where B: ~const From<A> {
|
||||||
|
fn to(self) -> B {
|
||||||
|
B::from(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const FOO: fn() -> String = || "foo".to();
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user