Skip to content

Commit abe7d68

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 #135186 (comment). Co-authored-by: BoxyUwU <[email protected]>
1 parent f8a4a65 commit abe7d68

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
@@ -269,7 +269,8 @@ impl LowerAssocMode {
269269
fn permit_variants(self) -> bool {
270270
match self {
271271
LowerAssocMode::Type { permit_variants } => permit_variants,
272-
LowerAssocMode::Const => true,
272+
// FIXME(mgca): Support paths like `Option::<T>::None` or `Option::<T>::Some` which resolve to const ctors/fn items respectively
273+
LowerAssocMode::Const => false,
273274
}
274275
}
275276
}
@@ -1204,7 +1205,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
12041205
}
12051206
(def_id, args)
12061207
}
1207-
LoweredAssoc::Variant { adt: _, variant_did } => (variant_did, ty::List::empty()),
1208+
// FIXME(mgca): implement support for this once ready to support all adt ctor expressions,
1209+
// not just const ctors
1210+
LoweredAssoc::Variant { .. } => {
1211+
span_bug!(span, "unexpected variant res for type associated const path")
1212+
}
12081213
};
12091214
Ok(Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, args)))
12101215
}

0 commit comments

Comments
 (0)