Auto merge of #109626 - matthiaskrgr:rollup-k0y7bdd, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #109007 (rustdoc: skip `// some variants omitted` if enum is `#[non_exhaustive]`) - #109593 (Rustdoc Book refer to rustdoc::missing_doc_code_examples. Fixes #109592.) - #109595 (Improve "Auto-hide trait implementation documentation" GUI test) - #109619 (Still-further-specializable projections are ambiguous in new solver) - #109620 (Correct typo (`back_box` -> `black_box`)) - #109621 (Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
89c2e3d3d7
37 changed files with 252 additions and 97 deletions
|
@ -10,7 +10,7 @@ use rustc_middle::mir::*;
|
|||
use rustc_middle::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{hygiene::ExpnKind, ExpnData, LocalExpnId, Span};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use rustc_target::abi::FIRST_VARIANT;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::simplify::{remove_dead_blocks, CfgSimplifier};
|
||||
|
@ -904,7 +904,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
|
|||
check_equal(self, *f_ty);
|
||||
}
|
||||
ty::Adt(adt_def, substs) => {
|
||||
let var = parent_ty.variant_index.unwrap_or(VariantIdx::from_u32(0));
|
||||
let var = parent_ty.variant_index.unwrap_or(FIRST_VARIANT);
|
||||
let Some(field) = adt_def.variant(var).fields.get(f.as_usize()) else {
|
||||
self.validation = Err("malformed MIR");
|
||||
return;
|
||||
|
|
|
@ -5,7 +5,7 @@ use rustc_middle::mir::*;
|
|||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::InternalSubsts;
|
||||
use rustc_middle::ty::{self, EarlyBinder, GeneratorSubsts, Ty, TyCtxt};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use rustc_target::abi::{VariantIdx, FIRST_VARIANT};
|
||||
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
|
||||
|
@ -816,11 +816,8 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> {
|
|||
|
||||
let source_info = SourceInfo::outermost(span);
|
||||
|
||||
let variant_index = if adt_def.is_enum() {
|
||||
adt_def.variant_index_with_ctor_id(ctor_id)
|
||||
} else {
|
||||
VariantIdx::new(0)
|
||||
};
|
||||
let variant_index =
|
||||
if adt_def.is_enum() { adt_def.variant_index_with_ctor_id(ctor_id) } else { FIRST_VARIANT };
|
||||
|
||||
// Generate the following MIR:
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue