Skip to content

Commit 87fe433

Browse files
committed
Avoid "const depends on generics" error for bare paths under mgca
1 parent 097ce04 commit 87fe433

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ pub fn is_const_evaluatable<'tcx>(
8585
}
8686
_ => bug!("unexpected constkind in `is_const_evalautable: {unexpanded_ct:?}`"),
8787
}
88+
} else if tcx.features().min_generic_const_args() {
89+
// This is a sanity check to make sure that non-generics consts are checked to
90+
// be evaluatable in case they aren't cchecked elsewhere. This will NOT error
91+
// if the const uses generics, as desired.
92+
crate::traits::evaluate_const(infcx, unexpanded_ct, param_env);
93+
Ok(())
8894
} else {
8995
let uv = match unexpanded_ct.kind() {
9096
ty::ConstKind::Unevaluated(uv) => uv,

0 commit comments

Comments
 (0)