Skip to content

Commit a266f11

Browse files
committed
Auto merge of #109496 - Dylan-DPC:rollup-u8rsi3h, r=Dylan-DPC
Rollup of 11 pull requests Successful merges: - #100311 (Fix handling of trailing bare CR in str::lines) - #108997 (Change text -> rust highlighting in sanitizer.md) - #109179 (move Option::as_slice to intrinsic) - #109187 (Render source page layout with Askama) - #109280 (Remove `VecMap`) - #109295 (refactor `fn bootstrap::builder::Builder::compiler_for` logic) - #109312 (rustdoc: Cleanup parent module tracking for doc links) - #109317 (Update links for custom discriminants.) - #109405 (RPITITs are `DefKind::Opaque` with new lowering strategy) - #109414 (Do not consider synthesized RPITITs on missing items checks) - #109435 (Detect uninhabited types early in const eval) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 439292b + eda88a3 commit a266f11

File tree

62 files changed

+513
-676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+513
-676
lines changed

compiler/rustc_borrowck/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ extern crate tracing;
1919

2020
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
2121
use rustc_data_structures::graph::dominators::Dominators;
22-
use rustc_data_structures::vec_map::VecMap;
2322
use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, SubdiagnosticMessage};
2423
use rustc_hir as hir;
2524
use rustc_hir::def_id::LocalDefId;
@@ -141,7 +140,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &Bor
141140
debug!("Skipping borrowck because of injected body");
142141
// Let's make up a borrowck result! Fun times!
143142
let result = BorrowCheckResult {
144-
concrete_opaque_types: VecMap::new(),
143+
concrete_opaque_types: FxIndexMap::default(),
145144
closure_requirements: None,
146145
used_mut_upvars: SmallVec::new(),
147146
tainted_by_errors: None,

compiler/rustc_borrowck/src/nll.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![deny(rustc::diagnostic_outside_of_impl)]
33
//! The entry point of the NLL borrow checker.
44
5-
use rustc_data_structures::vec_map::VecMap;
5+
use rustc_data_structures::fx::FxIndexMap;
66
use rustc_hir::def_id::LocalDefId;
77
use rustc_index::vec::IndexVec;
88
use rustc_middle::mir::{create_dump_file, dump_enabled, dump_mir, PassWhere};
@@ -44,7 +44,7 @@ pub type PoloniusOutput = Output<RustcFacts>;
4444
/// closure requirements to propagate, and any generated errors.
4545
pub(crate) struct NllOutput<'tcx> {
4646
pub regioncx: RegionInferenceContext<'tcx>,
47-
pub opaque_type_values: VecMap<LocalDefId, OpaqueHiddenType<'tcx>>,
47+
pub opaque_type_values: FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>>,
4848
pub polonius_input: Option<Box<AllFacts>>,
4949
pub polonius_output: Option<Rc<PoloniusOutput>>,
5050
pub opt_closure_req: Option<ClosureRegionRequirements<'tcx>>,
@@ -377,7 +377,7 @@ pub(super) fn dump_annotation<'tcx>(
377377
body: &Body<'tcx>,
378378
regioncx: &RegionInferenceContext<'tcx>,
379379
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
380-
opaque_type_values: &VecMap<LocalDefId, OpaqueHiddenType<'tcx>>,
380+
opaque_type_values: &FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>>,
381381
errors: &mut crate::error::BorrowckErrors<'tcx>,
382382
) {
383383
let tcx = infcx.tcx;

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
2-
use rustc_data_structures::vec_map::VecMap;
32
use rustc_errors::ErrorGuaranteed;
43
use rustc_hir::def_id::LocalDefId;
54
use rustc_hir::OpaqueTyOrigin;
@@ -61,9 +60,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
6160
pub(crate) fn infer_opaque_types(
6261
&self,
6362
infcx: &InferCtxt<'tcx>,
64-
opaque_ty_decls: VecMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
65-
) -> VecMap<LocalDefId, OpaqueHiddenType<'tcx>> {
66-
let mut result: VecMap<LocalDefId, OpaqueHiddenType<'tcx>> = VecMap::new();
63+
opaque_ty_decls: FxIndexMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
64+
) -> FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>> {
65+
let mut result: FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>> = FxIndexMap::default();
6766

6867
let member_constraints: FxIndexMap<_, _> = self
6968
.member_constraints

compiler/rustc_borrowck/src/type_check/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use either::Either;
1010
use hir::OpaqueTyOrigin;
1111
use rustc_data_structures::frozen::Frozen;
1212
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
13-
use rustc_data_structures::vec_map::VecMap;
1413
use rustc_hir as hir;
1514
use rustc_hir::def::DefKind;
1615
use rustc_hir::def_id::LocalDefId;
@@ -894,7 +893,7 @@ pub(crate) struct MirTypeckResults<'tcx> {
894893
pub(crate) constraints: MirTypeckRegionConstraints<'tcx>,
895894
pub(crate) universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
896895
pub(crate) opaque_type_values:
897-
VecMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
896+
FxIndexMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
898897
}
899898

900899
/// A collection of region constraints that must be satisfied for the

compiler/rustc_const_eval/src/const_eval/machine.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_hir::def::DefKind;
22
use rustc_hir::{LangItem, CRATE_HIR_ID};
33
use rustc_middle::mir;
44
use rustc_middle::mir::interpret::PointerArithmetic;
5-
use rustc_middle::ty::layout::FnAbiOf;
5+
use rustc_middle::ty::layout::{FnAbiOf, TyAndLayout};
66
use rustc_middle::ty::{self, Ty, TyCtxt};
77
use rustc_session::lint::builtin::INVALID_ALIGNMENT;
88
use std::borrow::Borrow;
@@ -335,8 +335,8 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
335335
}
336336

337337
#[inline(always)]
338-
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
339-
ecx.tcx.sess.opts.unstable_opts.extra_const_ub_checks
338+
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>, layout: TyAndLayout<'tcx>) -> bool {
339+
ecx.tcx.sess.opts.unstable_opts.extra_const_ub_checks || layout.abi.is_uninhabited()
340340
}
341341

342342
fn alignment_check_failed(

compiler/rustc_const_eval/src/interpret/machine.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::hash::Hash;
88

99
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
1010
use rustc_middle::mir;
11+
use rustc_middle::ty::layout::TyAndLayout;
1112
use rustc_middle::ty::{self, Ty, TyCtxt};
1213
use rustc_span::def_id::DefId;
1314
use rustc_target::abi::{Align, Size};
@@ -145,8 +146,8 @@ pub trait Machine<'mir, 'tcx>: Sized {
145146
check: CheckAlignment,
146147
) -> InterpResult<'tcx, ()>;
147148

148-
/// Whether to enforce the validity invariant
149-
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
149+
/// Whether to enforce the validity invariant for a specific layout.
150+
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>, layout: TyAndLayout<'tcx>) -> bool;
150151

151152
/// Whether function calls should be [ABI](CallAbi)-checked.
152153
fn enforce_abi(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {

compiler/rustc_const_eval/src/interpret/place.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ where
461461
) -> InterpResult<'tcx> {
462462
self.write_immediate_no_validate(src, dest)?;
463463

464-
if M::enforce_validity(self) {
464+
if M::enforce_validity(self, dest.layout) {
465465
// Data got changed, better make sure it matches the type!
466466
self.validate_operand(&self.place_to_op(dest)?)?;
467467
}
@@ -616,7 +616,7 @@ where
616616
) -> InterpResult<'tcx> {
617617
self.copy_op_no_validate(src, dest, allow_transmute)?;
618618

619-
if M::enforce_validity(self) {
619+
if M::enforce_validity(self, dest.layout) {
620620
// Data got changed, better make sure it matches the type!
621621
self.validate_operand(&self.place_to_op(dest)?)?;
622622
}

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub mod sync;
7979
pub mod tiny_list;
8080
pub mod transitive_relation;
8181
pub mod vec_linked_list;
82-
pub mod vec_map;
8382
pub mod work_queue;
8483
pub use atomic_ref::AtomicRef;
8584
pub mod frozen;

compiler/rustc_data_structures/src/vec_map.rs

-192
This file was deleted.

compiler/rustc_data_structures/src/vec_map/tests.rs

-48
This file was deleted.

0 commit comments

Comments
 (0)