Skip to content

Commit 8e7fd55

Browse files
committed
Auto merge of #114604 - matthiaskrgr:rollup-o1jltfn, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #114376 (Avoid exporting __rust_alloc_error_handler_should_panic more than once.) - #114413 (Warn when #[macro_export] is applied on decl macros) - #114497 (Revert #98333 "Re-enable atomic loads and stores for all RISC-V targets") - #114500 (Remove arm crypto target feature) - #114566 (Store the laziness of type aliases in their `DefKind`) - #114594 (Structurally normalize weak and inherent in new solver) - #114596 (Rename method in `opt-dist`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 443c316 + 07b2c97 commit 8e7fd55

File tree

75 files changed

+321
-165
lines changed

Some content is hidden

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

75 files changed

+321
-165
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
516516
// be the same as those of the ADT.
517517
// FIXME: We should be able to do something similar to
518518
// match_adt_and_segment in this case.
519-
Res::Def(DefKind::TyAlias, _) => (),
519+
Res::Def(DefKind::TyAlias { .. }, _) => (),
520520
_ => {
521521
if let Some(last_segment) = path.segments.last() {
522522
if let Some(highlight) = self.match_adt_and_segment(

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,6 @@ fn exported_symbols_provider_local(
233233
));
234234
}
235235

236-
symbols.push((
237-
ExportedSymbol::NoDefId(SymbolName::new(tcx, OomStrategy::SYMBOL)),
238-
SymbolExportInfo {
239-
level: SymbolExportLevel::Rust,
240-
kind: SymbolExportKind::Text,
241-
used: false,
242-
},
243-
));
244-
245236
let exported_symbol =
246237
ExportedSymbol::NoDefId(SymbolName::new(tcx, NO_ALLOC_SHIM_IS_UNSTABLE));
247238
symbols.push((

compiler/rustc_codegen_ssa/src/target_features.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
2929
("aclass", Some(sym::arm_target_feature)),
3030
("aes", Some(sym::arm_target_feature)),
3131
("crc", Some(sym::arm_target_feature)),
32-
("crypto", Some(sym::arm_target_feature)),
3332
("d32", Some(sym::arm_target_feature)),
3433
("dotprod", Some(sym::arm_target_feature)),
3534
("dsp", Some(sym::arm_target_feature)),

compiler/rustc_hir/src/def.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ pub enum DefKind {
6161
Variant,
6262
Trait,
6363
/// Type alias: `type Foo = Bar;`
64-
TyAlias,
64+
TyAlias {
65+
lazy: bool,
66+
},
6567
/// Type from an `extern` block.
6668
ForeignTy,
6769
/// Trait alias: `trait IntIterator = Iterator<Item = i32>;`
@@ -141,7 +143,7 @@ impl DefKind {
141143
DefKind::Ctor(CtorOf::Struct, CtorKind::Fn) => "tuple struct",
142144
DefKind::Ctor(CtorOf::Struct, CtorKind::Const) => "unit struct",
143145
DefKind::OpaqueTy => "opaque type",
144-
DefKind::TyAlias => "type alias",
146+
DefKind::TyAlias { .. } => "type alias",
145147
DefKind::TraitAlias => "trait alias",
146148
DefKind::AssocTy => "associated type",
147149
DefKind::Union => "union",
@@ -197,7 +199,7 @@ impl DefKind {
197199
| DefKind::Variant
198200
| DefKind::Trait
199201
| DefKind::OpaqueTy
200-
| DefKind::TyAlias
202+
| DefKind::TyAlias { .. }
201203
| DefKind::ForeignTy
202204
| DefKind::TraitAlias
203205
| DefKind::AssocTy
@@ -248,7 +250,7 @@ impl DefKind {
248250
| DefKind::Enum
249251
| DefKind::Variant
250252
| DefKind::Trait
251-
| DefKind::TyAlias
253+
| DefKind::TyAlias { .. }
252254
| DefKind::ForeignTy
253255
| DefKind::TraitAlias
254256
| DefKind::AssocTy

compiler/rustc_hir/src/target.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Target {
101101
DefKind::Mod => Target::Mod,
102102
DefKind::ForeignMod => Target::ForeignMod,
103103
DefKind::GlobalAsm => Target::GlobalAsm,
104-
DefKind::TyAlias => Target::TyAlias,
104+
DefKind::TyAlias { .. } => Target::TyAlias,
105105
DefKind::OpaqueTy => Target::OpaqueTy,
106106
DefKind::Enum => Target::Enum,
107107
DefKind::Struct => Target::Struct,

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -907,19 +907,21 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
907907
did: DefId,
908908
item_segment: &hir::PathSegment<'_>,
909909
) -> Ty<'tcx> {
910+
let tcx = self.tcx();
910911
let args = self.ast_path_args_for_ty(span, did, item_segment);
911-
let ty = self.tcx().at(span).type_of(did);
912+
let ty = tcx.at(span).type_of(did);
912913

913-
if matches!(self.tcx().def_kind(did), DefKind::TyAlias)
914-
&& (ty.skip_binder().has_opaque_types() || self.tcx().features().lazy_type_alias)
914+
if let DefKind::TyAlias { lazy } = tcx.def_kind(did)
915+
&& (lazy || ty.skip_binder().has_opaque_types())
915916
{
916917
// Type aliases referring to types that contain opaque types (but aren't just directly
917-
// referencing a single opaque type) get encoded as a type alias that normalization will
918+
// referencing a single opaque type) as well as those defined in crates that have the
919+
// feature `lazy_type_alias` enabled get encoded as a type alias that normalization will
918920
// then actually instantiate the where bounds of.
919-
let alias_ty = self.tcx().mk_alias_ty(did, args);
920-
Ty::new_alias(self.tcx(), ty::Weak, alias_ty)
921+
let alias_ty = tcx.mk_alias_ty(did, args);
922+
Ty::new_alias(tcx, ty::Weak, alias_ty)
921923
} else {
922-
ty.instantiate(self.tcx(), args)
924+
ty.instantiate(tcx, args)
923925
}
924926
}
925927

@@ -2158,7 +2160,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
21582160
}
21592161
Res::Def(
21602162
DefKind::Enum
2161-
| DefKind::TyAlias
2163+
| DefKind::TyAlias { .. }
21622164
| DefKind::Struct
21632165
| DefKind::Union
21642166
| DefKind::ForeignTy,

compiler/rustc_hir_analysis/src/autoderef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
7474
// we have some type like `&<Ty as Trait>::Assoc`, since users of
7575
// autoderef expect this type to have been structurally normalized.
7676
if self.infcx.next_trait_solver()
77-
&& let ty::Alias(ty::Projection, _) = ty.kind()
77+
&& let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _) = ty.kind()
7878
{
7979
let (normalized_ty, obligations) = self.structurally_normalize(ty)?;
8080
self.state.obligations.extend(obligations);

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
728728
check_opaque(tcx, id);
729729
}
730730
}
731-
DefKind::TyAlias => {
731+
DefKind::TyAlias { .. } => {
732732
let pty_ty = tcx.type_of(id.owner_id).instantiate_identity();
733733
let generics = tcx.generics_of(id.owner_id);
734734
check_type_params_are_used(tcx, &generics, pty_ty);

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
14801480
DefKind::Struct
14811481
| DefKind::Union
14821482
| DefKind::Enum
1483-
| DefKind::TyAlias
1483+
| DefKind::TyAlias { .. }
14841484
| DefKind::Trait,
14851485
def_id,
14861486
) if depth == 0 => Some(def_id),
@@ -1990,7 +1990,7 @@ fn is_late_bound_map(
19901990

19911991
hir::TyKind::Path(hir::QPath::Resolved(
19921992
None,
1993-
hir::Path { res: Res::Def(DefKind::TyAlias, alias_def), segments, span },
1993+
hir::Path { res: Res::Def(DefKind::TyAlias { .. }, alias_def), segments, span },
19941994
)) => {
19951995
// See comments on `ConstrainedCollectorPostAstConv` for why this arm does not just consider
19961996
// args to be unconstrained.

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ pub fn add_constraints_from_crate<'a, 'tcx>(
7878
}
7979
}
8080
DefKind::Fn | DefKind::AssocFn => constraint_cx.build_constraints_for_item(def_id),
81-
DefKind::TyAlias
82-
if tcx.features().lazy_type_alias
83-
|| tcx.type_of(def_id).instantiate_identity().has_opaque_types() =>
81+
DefKind::TyAlias { lazy }
82+
if lazy || tcx.type_of(def_id).instantiate_identity().has_opaque_types() =>
8483
{
8584
constraint_cx.build_constraints_for_item(def_id)
8685
}
@@ -111,8 +110,8 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
111110

112111
// The type as returned by `type_of` is the underlying type and generally not a weak projection.
113112
// Therefore we need to check the `DefKind` first.
114-
if let DefKind::TyAlias = tcx.def_kind(def_id)
115-
&& (tcx.features().lazy_type_alias || ty.has_opaque_types())
113+
if let DefKind::TyAlias { lazy } = tcx.def_kind(def_id)
114+
&& (lazy || ty.has_opaque_types())
116115
{
117116
self.add_constraints_from_ty(current_item, ty, self.covariant);
118117
return;

0 commit comments

Comments
 (0)