Skip to content

Commit 96108c5

Browse files
committed
make effect infer variables suggestable in diagnostics
it works when a non-const context that does not enable effects calls into a const effects-enabled trait. We'd simply suggest the non-const trait bound in this case consistent to its fallback.
1 parent c9192be commit 96108c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/diagnostics.rs

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl<'tcx, T> IsSuggestable<'tcx> for T
9898
where
9999
T: TypeVisitable<TyCtxt<'tcx>> + TypeFoldable<TyCtxt<'tcx>>,
100100
{
101+
#[tracing::instrument(level = "debug", skip(tcx))]
101102
fn is_suggestable(self, tcx: TyCtxt<'tcx>, infer_suggestable: bool) -> bool {
102103
self.visit_with(&mut IsSuggestableVisitor { tcx, infer_suggestable }).is_continue()
103104
}
@@ -533,6 +534,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsSuggestableVisitor<'tcx> {
533534
match c.kind() {
534535
ConstKind::Infer(InferConst::Var(_)) if self.infer_suggestable => {}
535536

537+
// effect variables are always suggestable, because they are not visible
538+
ConstKind::Infer(InferConst::EffectVar(_)) => {}
539+
536540
ConstKind::Infer(..)
537541
| ConstKind::Bound(..)
538542
| ConstKind::Placeholder(..)

0 commit comments

Comments
 (0)