diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index ce8eceebdf8d2..266ac3f376b76 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -2,7 +2,7 @@ use std::sync::atomic::Ordering::Relaxed; use either::{Left, Right}; use rustc_abi::{self as abi, BackendRepr}; -use rustc_hir::def::DefKind; +use rustc_hir::def::{CtorKind, DefKind}; use rustc_middle::mir::interpret::{AllocId, ErrorHandled, InterpErrorInfo, ReportedErrorInfo}; use rustc_middle::mir::{self, ConstAlloc, ConstValue}; use rustc_middle::query::TyCtxtAt; @@ -41,6 +41,7 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>( | DefKind::AnonConst | DefKind::InlineConst | DefKind::AssocConst + | DefKind::Ctor(_, CtorKind::Const) ), "Unexpected DefKind: {:?}", ecx.tcx.def_kind(cid.instance.def_id()) diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index e1fba9be5bb6d..b7c7448491152 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -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::{CtorKind, DefKind}; +use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; use rustc_index::IndexVec; use rustc_middle::mir::{ @@ -324,7 +324,7 @@ fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet { 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((CtorKind::Fn, ctor_def_id)) = variant.ctor { + if let Some((_, ctor_def_id)) = variant.ctor { set.insert(ctor_def_id.expect_local()); } } diff --git a/tests/crashes/132985.rs b/tests/crashes/132985.rs deleted file mode 100644 index 2735074f44d12..0000000000000 --- a/tests/crashes/132985.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ 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() {} - -fn baz() { - bar::<{ Foo }>(); -} - -fn main() {} diff --git a/tests/crashes/auxiliary/aux132985.rs b/tests/crashes/auxiliary/aux132985.rs deleted file mode 100644 index 7ae5567bdc59d..0000000000000 --- a/tests/crashes/auxiliary/aux132985.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(adt_const_params)] - -use std::marker::ConstParamTy; - -#[derive(Eq, PartialEq, ConstParamTy)] -pub struct Foo; diff --git a/tests/ui/const-generics/auxiliary/xcrate-const-ctor-a.rs b/tests/ui/const-generics/auxiliary/xcrate-const-ctor-a.rs index 7ae5567bdc59d..3056611f5a979 100644 --- a/tests/ui/const-generics/auxiliary/xcrate-const-ctor-a.rs +++ b/tests/ui/const-generics/auxiliary/xcrate-const-ctor-a.rs @@ -1,4 +1,7 @@ +// NOTE: This aux file inherits revisions from its parent tests. + #![feature(adt_const_params)] +#![cfg_attr(mgca, feature(min_generic_const_args), allow(incomplete_features))] use std::marker::ConstParamTy; diff --git a/tests/ui/const-generics/xcrate-const-ctor-b.rs b/tests/ui/const-generics/xcrate-const-ctor-b.rs index dce2e43b316a4..bf33ef6340d8a 100644 --- a/tests/ui/const-generics/xcrate-const-ctor-b.rs +++ b/tests/ui/const-generics/xcrate-const-ctor-b.rs @@ -1,7 +1,9 @@ //@ check-pass +//@ revisions: normal mgca //@ aux-build:xcrate-const-ctor-a.rs #![feature(adt_const_params)] +#![cfg_attr(mgca, feature(min_generic_const_args), allow(incomplete_features))] extern crate xcrate_const_ctor_a; use xcrate_const_ctor_a::Foo; diff --git a/tests/ui/stable-mir-print/operands.stdout b/tests/ui/stable-mir-print/operands.stdout index c3b1151ae24a3..b3b3c0de76d73 100644 --- a/tests/ui/stable-mir-print/operands.stdout +++ b/tests/ui/stable-mir-print/operands.stdout @@ -250,6 +250,13 @@ fn closures::{closure#0}(_1: {closure@$DIR/operands.rs:47:5: 47:19}, _2: bool) - return; } } +fn Ctors::Unit() -> Ctors { + let mut _0: Ctors; + bb0: { + _0 = Ctors::Unit; + return; + } +} fn Ctors::TupLike(_1: bool) -> Ctors { let mut _0: Ctors; bb0: {