Skip to content

Commit

Permalink
Revert "Encode const constructor MIR in crate metadata"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
camelid committed Nov 13, 2024
1 parent 317465c commit bf37eb4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_const_eval::util;
use rustc_data_structures::fx::FxIndexSet;
use rustc_data_structures::steal::Steal;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def_id::LocalDefId;
use rustc_index::IndexVec;
use rustc_middle::mir::{
Expand Down Expand Up @@ -322,7 +322,7 @@ fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LocalDefId> {
for item in tcx.hir_crate_items(()).free_items() {
if let DefKind::Struct | DefKind::Enum = tcx.def_kind(item.owner_id) {
for variant in tcx.adt_def(item.owner_id).variants() {
if let Some((_, ctor_def_id)) = variant.ctor {
if let Some((CtorKind::Fn, ctor_def_id)) = variant.ctor {
set.insert(ctor_def_id.expect_local());
}
}
Expand Down
17 changes: 17 additions & 0 deletions tests/crashes/132985.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ known-bug: #132985
//@ aux-build:aux132985.rs

#![allow(incomplete_features)]
#![feature(min_generic_const_args)]
#![feature(adt_const_params)]

extern crate aux132985;
use aux132985::Foo;

fn bar<const N: Foo>() {}

fn baz() {
bar::<{ Foo }>();
}

fn main() {}
6 changes: 6 additions & 0 deletions tests/crashes/auxiliary/aux132985.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![feature(adt_const_params)]

use std::marker::ConstParamTy;

#[derive(Eq, PartialEq, ConstParamTy)]
pub struct Foo;

0 comments on commit bf37eb4

Please sign in to comment.