Skip to content

Commit bf37eb4

Browse files
committed
Revert "Encode const constructor MIR in crate metadata"
This reverts commit 2010e0a. For now, we'll let this ICE and deal with it later since it's feature-gated anyway. Also add known-bug test for it.
1 parent 317465c commit bf37eb4

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

compiler/rustc_mir_transform/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_const_eval::util;
2121
use rustc_data_structures::fx::FxIndexSet;
2222
use rustc_data_structures::steal::Steal;
2323
use rustc_hir as hir;
24-
use rustc_hir::def::DefKind;
24+
use rustc_hir::def::{CtorKind, DefKind};
2525
use rustc_hir::def_id::LocalDefId;
2626
use rustc_index::IndexVec;
2727
use rustc_middle::mir::{
@@ -322,7 +322,7 @@ fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LocalDefId> {
322322
for item in tcx.hir_crate_items(()).free_items() {
323323
if let DefKind::Struct | DefKind::Enum = tcx.def_kind(item.owner_id) {
324324
for variant in tcx.adt_def(item.owner_id).variants() {
325-
if let Some((_, ctor_def_id)) = variant.ctor {
325+
if let Some((CtorKind::Fn, ctor_def_id)) = variant.ctor {
326326
set.insert(ctor_def_id.expect_local());
327327
}
328328
}

tests/crashes/132985.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ known-bug: #132985
2+
//@ aux-build:aux132985.rs
3+
4+
#![allow(incomplete_features)]
5+
#![feature(min_generic_const_args)]
6+
#![feature(adt_const_params)]
7+
8+
extern crate aux132985;
9+
use aux132985::Foo;
10+
11+
fn bar<const N: Foo>() {}
12+
13+
fn baz() {
14+
bar::<{ Foo }>();
15+
}
16+
17+
fn main() {}

tests/crashes/auxiliary/aux132985.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(adt_const_params)]
2+
3+
use std::marker::ConstParamTy;
4+
5+
#[derive(Eq, PartialEq, ConstParamTy)]
6+
pub struct Foo;

0 commit comments

Comments
 (0)