Skip to content

Commit c98d0cb

Browse files
committed
Auto merge of #160980 - JonathanBrouwer:rollup-MX1XSgM, r=JonathanBrouwer
Rollup of 6 pull requests Successful merges: - #160966 (bootstrap: Avoid some unnecessary imports from the crate root) - #159987 (trait solver: Track canonical response universe assumptions) - #160886 (Trim `GoalStalledOn::Certainty`) - #160925 (Add `TypeId::is_signed` method) - #160926 (sve: add addl. passing test for field projection) - #160977 (Remove `MutatingUseContext::Retag`)
2 parents ab8058a + 17a573d commit c98d0cb

59 files changed

Lines changed: 415 additions & 169 deletions

File tree

Some content is hidden

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

compiler/rustc_borrowck/src/def_use.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ pub(crate) fn categorize(context: PlaceContext) -> Option<DefUse> {
5959
PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow) |
6060
PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect) |
6161
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) |
62-
PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) |
63-
PlaceContext::MutatingUse(MutatingUseContext::Retag) => Some(DefUse::Use),
62+
PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => Some(DefUse::Use),
6463

6564
///////////////////////////////////////////////////////////////////////////
6665
// DROP USES

compiler/rustc_codegen_ssa/src/mir/analyze.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ impl<'a, 'b, 'tcx, Bx: BuilderMethods<'b, 'tcx>> Visitor<'tcx> for LocalAnalyzer
211211
}
212212

213213
PlaceContext::NonUse(_)
214-
| PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention)
215-
| PlaceContext::MutatingUse(MutatingUseContext::Retag) => {}
214+
| PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention) => {}
216215

217216
PlaceContext::NonMutatingUse(
218217
NonMutatingUseContext::Copy

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,11 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
606606
ecx.write_type_info(ty, dest)?;
607607
}
608608

609+
sym::type_id_is_signed => {
610+
let ty = ecx.read_type_id(&args[0])?;
611+
ecx.write_scalar(Scalar::from_bool(ty.is_signed()), dest)?;
612+
}
613+
609614
sym::size_of_type_id => {
610615
let ty = ecx.read_type_id(&args[0])?;
611616
let layout = ecx.layout_of(ty)?;

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
221221
| sym::type_id_field_representing_type
222222
| sym::type_id_fields
223223
| sym::type_id_generics
224+
| sym::type_id_is_signed
224225
| sym::type_id_variants
225226
| sym::type_id_vtable
226227
| sym::type_name
@@ -332,6 +333,7 @@ pub(crate) fn check_intrinsic_type(
332333
(0, 0, vec![type_id_ty(), tcx.types.usize, tcx.types.usize], type_id_ty())
333334
}
334335
sym::type_id_fields => (0, 0, vec![type_id_ty(), tcx.types.usize], tcx.types.usize),
336+
sym::type_id_is_signed => (0, 0, vec![type_id_ty()], tcx.types.bool),
335337
sym::type_id_variants => (0, 0, vec![type_id_ty()], tcx.types.usize),
336338
sym::type_id_vtable => {
337339
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, span);

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,6 @@ pub enum MutatingUseContext {
13541354
/// f(&mut x.y);
13551355
/// ```
13561356
Projection,
1357-
/// Retagging, a "Stacked Borrows" shadow state operation
1358-
Retag,
13591357
}
13601358

13611359
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

compiler/rustc_mir_dataflow/src/impls/liveness.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ impl DefUse {
180180
PlaceContext::MutatingUse(
181181
MutatingUseContext::RawBorrow
182182
| MutatingUseContext::Borrow
183-
| MutatingUseContext::Drop
184-
| MutatingUseContext::Retag,
183+
| MutatingUseContext::Drop,
185184
)
186185
| PlaceContext::NonMutatingUse(
187186
NonMutatingUseContext::RawBorrow

compiler/rustc_mir_transform/src/deduce_param_attrs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ impl<'tcx> Visitor<'tcx> for DeduceParamAttrs {
7474
MutatingUseContext::Store
7575
| MutatingUseContext::SetDiscriminant
7676
| MutatingUseContext::AsmOutput
77-
| MutatingUseContext::Projection
78-
| MutatingUseContext::Retag) => {
77+
| MutatingUseContext::Projection) => {
7978
self.usage[i] |= UsageSummary::MUTATE;
8079
}
8180
| PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow) => {

compiler/rustc_mir_transform/src/known_panics_lint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,6 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
975975
// whether they'd be fine right now.
976976
MutatingUse(MutatingUseContext::Yield)
977977
| MutatingUse(MutatingUseContext::Drop)
978-
| MutatingUse(MutatingUseContext::Retag)
979978
// These can't ever be propagated under any scheme, as we can't reason about indirect
980979
// mutation.
981980
| NonMutatingUse(NonMutatingUseContext::SharedBorrow)

compiler/rustc_mir_transform/src/liveness.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,8 +1548,7 @@ impl DefUse {
15481548
PlaceContext::MutatingUse(
15491549
MutatingUseContext::RawBorrow
15501550
| MutatingUseContext::Borrow
1551-
| MutatingUseContext::Drop
1552-
| MutatingUseContext::Retag,
1551+
| MutatingUseContext::Drop,
15531552
)
15541553
| PlaceContext::NonMutatingUse(
15551554
NonMutatingUseContext::RawBorrow

compiler/rustc_next_trait_solver/src/canonical/mod.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,20 @@ where
162162
let prev_universe = delegate.universe();
163163
let universes_created_in_query = response.max_universe.index();
164164
for _ in 0..universes_created_in_query {
165-
delegate.create_next_universe();
165+
let new_universe = delegate.create_next_universe();
166+
if delegate.cx().assumptions_on_binders() {
167+
// FIXME(-Zassumptions-on-binders): Remove this temporary workaround once
168+
// opaque types no longer escape query responses with query-created placeholders.
169+
// Region constraints involving query-created placeholders were handled inside
170+
// the query. However, the placeholders can still escape in other response
171+
// fields, such as opaque type constraints. To avoid triggering
172+
// assertions, we explicitly insert empty assumptions for the
173+
// recreated universes here.
174+
delegate.insert_placeholder_assumptions(
175+
new_universe,
176+
Some(rustc_type_ir::region_constraint::Assumptions::empty()),
177+
);
178+
}
166179
}
167180

168181
compute_query_response_instantiation_values_in_universe(

0 commit comments

Comments
 (0)