Skip to content

Commit 991f55c

Browse files
camelidBoxyUwU
andcommitted
mgca: Crash on variant const paths for now
A bit tricky to support this special case now, so might as well save it for once we're ready to handle the general case. See rust-lang#135186 (comment). Co-authored-by: BoxyUwU <[email protected]>
1 parent 34385e9 commit 991f55c

File tree

1 file changed

+7
-2
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+7
-2
lines changed

Diff for: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ impl LowerAssocMode {
272272
fn permit_variants(self) -> bool {
273273
match self {
274274
LowerAssocMode::Type { permit_variants } => permit_variants,
275-
LowerAssocMode::Const => true,
275+
// FIXME(mgca): Support paths like `Option::<T>::None` or `Option::<T>::Some` which resolve to const ctors/fn items respectively
276+
LowerAssocMode::Const => false,
276277
}
277278
}
278279
}
@@ -1211,7 +1212,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
12111212
}
12121213
(def_id, args)
12131214
}
1214-
LoweredAssoc::Variant { adt: _, variant_did } => (variant_did, ty::List::empty()),
1215+
// FIXME(mgca): implement support for this once ready to support all adt ctor expressions,
1216+
// not just const ctors
1217+
LoweredAssoc::Variant { .. } => {
1218+
span_bug!(span, "unexpected variant res for type associated const path")
1219+
}
12151220
};
12161221
Ok(Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, args)))
12171222
}

0 commit comments

Comments
 (0)