Skip to content

Commit 6ad4d1b

Browse files
committed
Auto merge of #155175 - jhpratt:rollup-jQuvnVx, r=jhpratt
Rollup of 7 pull requests Successful merges: - #155084 (Initial functions to start on transmute v2) - #155126 (add `cfg(target_object_format = "...")`) - #155165 (Portable SIMD subtree update) - #153871 (fix spurious test failure in `metadata_access_times`) - #155150 (replace <name> @ ty::AliasTy matches with just using args: <name>_args) - #155159 (Fix min-specialization ICE from ignored region resolution failure) - #155167 (Reduce size of `ImportData`)
2 parents bf4fbfb + 040b6db commit 6ad4d1b

86 files changed

Lines changed: 1159 additions & 292 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_abi/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ use rustc_hashes::Hash64;
5252
use rustc_index::{Idx, IndexSlice, IndexVec};
5353
#[cfg(feature = "nightly")]
5454
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_Generic};
55+
#[cfg(feature = "nightly")]
56+
use rustc_span::{Symbol, sym};
5557

5658
mod callconv;
5759
mod canon_abi;
@@ -770,6 +772,14 @@ impl Endian {
770772
Self::Big => "big",
771773
}
772774
}
775+
776+
#[cfg(feature = "nightly")]
777+
pub fn desc_symbol(&self) -> Symbol {
778+
match self {
779+
Self::Little => sym::little,
780+
Self::Big => sym::big,
781+
}
782+
}
773783
}
774784

775785
impl fmt::Debug for Endian {

compiler/rustc_borrowck/src/diagnostics/opaque_types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,12 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for FindOpaqueRegion<'_, 'tcx> {
219219
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
220220
// If we find an opaque in a local ty, then for each of its captured regions,
221221
// try to find a path between that captured regions and our borrow region...
222-
if let ty::Alias(opaque @ ty::AliasTy { kind: ty::Opaque { def_id }, .. }) = *ty.kind()
222+
if let ty::Alias(ty::AliasTy { kind: ty::Opaque { def_id }, args, .. }) = *ty.kind()
223223
&& let hir::OpaqueTyOrigin::FnReturn { parent, in_trait_or_impl: None } =
224224
self.tcx.opaque_ty_origin(def_id)
225225
{
226226
let variances = self.tcx.variances_of(def_id);
227-
for (idx, (arg, variance)) in std::iter::zip(opaque.args, variances).enumerate() {
227+
for (idx, (arg, variance)) in std::iter::zip(args, variances).enumerate() {
228228
// Skip uncaptured args.
229229
if *variance == ty::Bivariant {
230230
continue;
@@ -276,12 +276,12 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for CheckExplicitRegionMentionAndCollectGen
276276

277277
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
278278
match *ty.kind() {
279-
ty::Alias(opaque @ ty::AliasTy { kind: ty::Opaque { def_id }, .. }) => {
279+
ty::Alias(ty::AliasTy { kind: ty::Opaque { def_id }, args, .. }) => {
280280
if self.seen_opaques.insert(def_id) {
281281
for (bound, _) in self
282282
.tcx
283283
.explicit_item_bounds(def_id)
284-
.iter_instantiated_copied(self.tcx, opaque.args)
284+
.iter_instantiated_copied(self.tcx, args)
285285
{
286286
bound.visit_with(self)?;
287287
}

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const GATED_CFGS: &[GatedCfg] = &[
6262
sym::cfg_target_has_reliable_f16_f128,
6363
Features::cfg_target_has_reliable_f16_f128,
6464
),
65+
(sym::target_object_format, sym::cfg_target_object_format, Features::cfg_target_object_format),
6566
];
6667

6768
/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ declare_features! (
410410
(unstable, cfg_target_has_atomic, "1.60.0", Some(94039)),
411411
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
412412
(unstable, cfg_target_has_atomic_equal_alignment, "1.60.0", Some(93822)),
413+
/// Allows `cfg(target_object_format = "...")`.
414+
(unstable, cfg_target_object_format, "CURRENT_RUSTC_VERSION", Some(152586)),
413415
/// Allows `cfg(target_thread_local)`.
414416
(unstable, cfg_target_thread_local, "1.7.0", Some(29594)),
415417
/// Allows the use of `#[cfg(ub_checks)` to check if UB checks are enabled.

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ fn sanity_check_found_hidden_type<'tcx>(
523523
// Nothing was actually constrained.
524524
return Ok(());
525525
}
526-
if let &ty::Alias(alias @ ty::AliasTy { kind: ty::Opaque { def_id }, .. }) = ty.ty.kind() {
527-
if def_id == key.def_id.to_def_id() && alias.args == key.args {
526+
if let &ty::Alias(ty::AliasTy { kind: ty::Opaque { def_id }, args, .. }) = ty.ty.kind() {
527+
if def_id == key.def_id.to_def_id() && args == key.args {
528528
// Nothing was actually constrained, this is an opaque usage that was
529529
// only discovered to be opaque after inference vars resolved.
530530
return Ok(());

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -820,24 +820,25 @@ where
820820
}
821821

822822
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
823-
if let &ty::Alias(proj @ ty::AliasTy { kind: ty::Projection { def_id }, .. }) = ty.kind()
823+
if let &ty::Alias(ty::AliasTy { kind: ty::Projection { def_id }, args: proj_args, .. }) =
824+
ty.kind()
824825
&& self.cx().is_impl_trait_in_trait(def_id)
825826
{
826827
if let Some((ty, _)) = self.types.get(&def_id) {
827828
return *ty;
828829
}
829830
//FIXME(RPITIT): Deny nested RPITIT in args too
830-
if proj.args.has_escaping_bound_vars() {
831+
if proj_args.has_escaping_bound_vars() {
831832
bug!("FIXME(RPITIT): error here");
832833
}
833834
// Replace with infer var
834835
let infer_ty = self.ocx.infcx.next_ty_var(self.span);
835-
self.types.insert(def_id, (infer_ty, proj.args));
836+
self.types.insert(def_id, (infer_ty, proj_args));
836837
// Recurse into bounds
837838
for (pred, pred_span) in self
838839
.cx()
839840
.explicit_item_bounds(def_id)
840-
.iter_instantiated_copied(self.cx(), proj.args)
841+
.iter_instantiated_copied(self.cx(), proj_args)
841842
{
842843
let pred = pred.fold_with(self);
843844
let pred = self.ocx.normalize(
@@ -2707,8 +2708,8 @@ fn param_env_with_gat_bounds<'tcx>(
27072708
let bound_vars = tcx.mk_bound_variable_kinds(&bound_vars);
27082709

27092710
match normalize_impl_ty.kind() {
2710-
&ty::Alias(proj @ ty::AliasTy { kind: ty::Projection { def_id }, .. })
2711-
if def_id == trait_ty.def_id && proj.args == rebased_args =>
2711+
&ty::Alias(ty::AliasTy { kind: ty::Projection { def_id }, args, .. })
2712+
if def_id == trait_ty.def_id && args == rebased_args =>
27122713
{
27132714
// Don't include this predicate if the projected type is
27142715
// exactly the same as the projection. This can occur in

compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ fn report_mismatched_rpitit_signature<'tcx>(
308308
let mut return_ty = trait_m_sig.output().fold_with(&mut super::RemapLateParam { tcx, mapping });
309309

310310
if tcx.asyncness(impl_m_def_id).is_async() && tcx.asyncness(trait_m_def_id).is_async() {
311-
let &ty::Alias(
312-
future_ty @ ty::AliasTy { kind: ty::Projection { def_id: future_ty_def_id }, .. },
313-
) = return_ty.kind()
311+
let &ty::Alias(ty::AliasTy {
312+
kind: ty::Projection { def_id: future_ty_def_id }, args, ..
313+
}) = return_ty.kind()
314314
else {
315315
span_bug!(
316316
tcx.def_span(trait_m_def_id),
@@ -319,7 +319,7 @@ fn report_mismatched_rpitit_signature<'tcx>(
319319
};
320320
let Some(future_output_ty) = tcx
321321
.explicit_item_bounds(future_ty_def_id)
322-
.iter_instantiated_copied(tcx, future_ty.args)
322+
.iter_instantiated_copied(tcx, args)
323323
.find_map(|(clause, _)| match clause.kind().no_bound_vars()? {
324324
ty::ClauseKind::Projection(proj) => proj.term.as_type(),
325325
_ => None,

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,10 @@ impl<'tcx> GATArgsCollector<'tcx> {
773773
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GATArgsCollector<'tcx> {
774774
fn visit_ty(&mut self, t: Ty<'tcx>) {
775775
match t.kind() {
776-
&ty::Alias(p @ ty::AliasTy { kind: ty::Projection { def_id }, .. })
776+
&ty::Alias(ty::AliasTy { kind: ty::Projection { def_id }, args, .. })
777777
if def_id == self.gat =>
778778
{
779-
for (idx, arg) in p.args.iter().enumerate() {
779+
for (idx, arg) in args.iter().enumerate() {
780780
match arg.kind() {
781781
GenericArgKind::Lifetime(lt) if !lt.is_bound() => {
782782
self.regions.insert((lt, idx));

compiler/rustc_hir_analysis/src/collect/item_bounds.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,17 +549,16 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTyToOpaque<'tcx> {
549549
}
550550

551551
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
552-
if let &ty::Alias(
553-
projection_ty @ ty::AliasTy {
554-
kind: ty::Projection { def_id: projection_ty_def_id },
555-
..
556-
},
557-
) = ty.kind()
552+
if let &ty::Alias(ty::AliasTy {
553+
kind: ty::Projection { def_id: projection_ty_def_id },
554+
args,
555+
..
556+
}) = ty.kind()
558557
&& let Some(ty::ImplTraitInTraitData::Trait { fn_def_id, .. }) =
559558
self.tcx.opt_rpitit_info(projection_ty_def_id)
560559
&& fn_def_id == self.fn_def_id
561560
{
562-
self.tcx.type_of(projection_ty_def_id).instantiate(self.tcx, projection_ty.args)
561+
self.tcx.type_of(projection_ty_def_id).instantiate(self.tcx, args)
563562
} else {
564563
ty.super_fold_with(self)
565564
}

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,13 @@ pub(super) fn explicit_predicates_of<'tcx>(
513513
// identity args of the trait.
514514
// * It must be an associated type for this trait (*not* a
515515
// supertrait).
516-
if let &ty::Alias(
517-
projection @ ty::AliasTy {
518-
kind: ty::Projection { def_id: projection_def_id }, ..
519-
},
520-
) = ty.kind()
516+
if let &ty::Alias(ty::AliasTy {
517+
kind: ty::Projection { def_id: projection_def_id },
518+
args,
519+
..
520+
}) = ty.kind()
521521
{
522-
projection.args == trait_identity_args
522+
args == trait_identity_args
523523
// FIXME(return_type_notation): This check should be more robust
524524
&& !tcx.is_impl_trait_in_trait(projection_def_id)
525525
&& tcx.parent(projection_def_id) == def_id.to_def_id()

0 commit comments

Comments
 (0)