Skip to content

Commit 81f3919

Browse files
committed
Auto merge of rust-lang#102850 - JohnTitor:rollup-lze1w03, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#101118 (fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD) - rust-lang#102072 (Add `ptr::Alignment` type) - rust-lang#102799 (rustdoc: remove hover gap in file picker) - rust-lang#102820 (Show let-else suggestion on stable.) - rust-lang#102829 (rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`) - rust-lang#102831 (Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty`) - rust-lang#102834 (Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc) - rust-lang#102838 (remove cfg(bootstrap) from Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1b22541 + f59e8af commit 81f3919

File tree

39 files changed

+212
-124
lines changed

39 files changed

+212
-124
lines changed

Diff for: compiler/rustc_ast_lowering/src/item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
908908
|this| match ty {
909909
None => {
910910
let ty = this.arena.alloc(this.ty(i.span, hir::TyKind::Err));
911-
hir::ImplItemKind::TyAlias(ty)
911+
hir::ImplItemKind::Type(ty)
912912
}
913913
Some(ty) => {
914914
let ty = this.lower_ty(ty, &ImplTraitContext::TypeAliasesOpaqueTy);
915-
hir::ImplItemKind::TyAlias(ty)
915+
hir::ImplItemKind::Type(ty)
916916
}
917917
},
918918
)

Diff for: compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ pub enum ImplItemKind<'hir> {
23152315
/// An associated function implementation with the given signature and body.
23162316
Fn(FnSig<'hir>, BodyId),
23172317
/// An associated type.
2318-
TyAlias(&'hir Ty<'hir>),
2318+
Type(&'hir Ty<'hir>),
23192319
}
23202320

23212321
// The name of the associated type for `Fn` return types.

Diff for: compiler/rustc_hir/src/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
979979
impl_item.hir_id(),
980980
);
981981
}
982-
ImplItemKind::TyAlias(ref ty) => {
982+
ImplItemKind::Type(ref ty) => {
983983
visitor.visit_id(impl_item.hir_id());
984984
visitor.visit_ty(ty);
985985
}

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ fn check_impl_items_against_trait<'tcx>(
10621062
opt_trait_span,
10631063
);
10641064
}
1065-
hir::ImplItemKind::TyAlias(impl_ty) => {
1065+
hir::ImplItemKind::Type(impl_ty) => {
10661066
let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id);
10671067
compare_ty_impl(
10681068
tcx,

Diff for: compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ fn check_impl_item(tcx: TyCtxt<'_>, impl_item: &hir::ImplItem<'_>) {
837837
let (method_sig, span) = match impl_item.kind {
838838
hir::ImplItemKind::Fn(ref sig, _) => (Some(sig), impl_item.span),
839839
// Constrain binding and overflow error spans to `<Ty>` in `type foo = <Ty>`.
840-
hir::ImplItemKind::TyAlias(ty) if ty.span != DUMMY_SP => (None, ty.span),
840+
hir::ImplItemKind::Type(ty) if ty.span != DUMMY_SP => (None, ty.span),
841841
_ => (None, impl_item.span),
842842
};
843843

Diff for: compiler/rustc_hir_analysis/src/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) {
738738
hir::ImplItemKind::Fn(..) => {
739739
tcx.ensure().fn_sig(def_id);
740740
}
741-
hir::ImplItemKind::TyAlias(_) => {
741+
hir::ImplItemKind::Type(_) => {
742742
// Account for `type T = _;`
743743
let mut visitor = HirPlaceholderCollector::default();
744744
visitor.visit_impl_item(impl_item);

Diff for: compiler/rustc_hir_analysis/src/collect/generics_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
213213
Node::TraitItem(item) if matches!(item.kind, TraitItemKind::Type(..)) => {
214214
(None, Defaults::Deny)
215215
}
216-
Node::ImplItem(item) if matches!(item.kind, ImplItemKind::TyAlias(..)) => {
216+
Node::ImplItem(item) if matches!(item.kind, ImplItemKind::Type(..)) => {
217217
(None, Defaults::Deny)
218218
}
219219

Diff for: compiler/rustc_hir_analysis/src/collect/type_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
284284
icx.to_ty(ty)
285285
}
286286
}
287-
ImplItemKind::TyAlias(ty) => {
287+
ImplItemKind::Type(ty) => {
288288
if tcx.impl_trait_ref(tcx.hir().get_parent_item(hir_id)).is_none() {
289289
check_feature_inherent_assoc_ty(tcx, item.span);
290290
}

Diff for: compiler/rustc_hir_analysis/src/hir_wf_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn diagnostic_hir_wf_check<'tcx>(
117117
let ty = match loc {
118118
WellFormedLoc::Ty(_) => match hir.get(hir_id) {
119119
hir::Node::ImplItem(item) => match item.kind {
120-
hir::ImplItemKind::TyAlias(ty) => Some(ty),
120+
hir::ImplItemKind::Type(ty) => Some(ty),
121121
hir::ImplItemKind::Const(ty, _) => Some(ty),
122122
ref item => bug!("Unexpected ImplItem {:?}", item),
123123
},

Diff for: compiler/rustc_hir_pretty/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ impl<'a> State<'a> {
887887
self.end(); // need to close a box
888888
self.ann.nested(self, Nested::Body(body));
889889
}
890-
hir::ImplItemKind::TyAlias(ty) => {
890+
hir::ImplItemKind::Type(ty) => {
891891
self.print_associated_type(ii.ident, ii.generics, None, Some(ty));
892892
}
893893
}

Diff for: compiler/rustc_incremental/src/persist/dirty_clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
302302
HirNode::ImplItem(item) => match item.kind {
303303
ImplItemKind::Fn(..) => ("Node::ImplItem", LABELS_FN_IN_IMPL),
304304
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL),
305-
ImplItemKind::TyAlias(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
305+
ImplItemKind::Type(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
306306
},
307307
_ => self.tcx.sess.span_fatal(
308308
attr.span,

Diff for: compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
25982598
for h in self.tcx.hir().parent_iter(param.hir_id) {
25992599
break 'origin match h.1 {
26002600
Node::ImplItem(hir::ImplItem {
2601-
kind: hir::ImplItemKind::TyAlias(..),
2601+
kind: hir::ImplItemKind::Type(..),
26022602
generics,
26032603
..
26042604
})

Diff for: compiler/rustc_middle/src/hir/map/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'hir> Map<'hir> {
241241
Node::ImplItem(item) => match item.kind {
242242
ImplItemKind::Const(..) => DefKind::AssocConst,
243243
ImplItemKind::Fn(..) => DefKind::AssocFn,
244-
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
244+
ImplItemKind::Type(..) => DefKind::AssocTy,
245245
},
246246
Node::Variant(_) => DefKind::Variant,
247247
Node::Ctor(variant_data) => {
@@ -1244,7 +1244,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String {
12441244
format!("assoc const {} in {}{}", ii.ident, path_str(), id_str)
12451245
}
12461246
ImplItemKind::Fn(..) => format!("method {} in {}{}", ii.ident, path_str(), id_str),
1247-
ImplItemKind::TyAlias(_) => {
1247+
ImplItemKind::Type(_) => {
12481248
format!("assoc type {} in {}{}", ii.ident, path_str(), id_str)
12491249
}
12501250
},

Diff for: compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
491491
],
492492
Applicability::HasPlaceholders,
493493
);
494-
if !bindings.is_empty() && cx.tcx.sess.is_nightly_build() {
494+
if !bindings.is_empty() {
495495
err.span_suggestion_verbose(
496496
semi_span.shrink_to_lo(),
497497
&format!(

Diff for: compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub(crate) fn target_from_impl_item<'tcx>(
4949
Target::Method(MethodKind::Inherent)
5050
}
5151
}
52-
hir::ImplItemKind::TyAlias(..) => Target::AssocTy,
52+
hir::ImplItemKind::Type(..) => Target::AssocTy,
5353
}
5454
}
5555

Diff for: compiler/rustc_passes/src/hir_stats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
391391
fn visit_impl_item(&mut self, ii: &'v hir::ImplItem<'v>) {
392392
record_variants!(
393393
(self, ii, ii.kind, Id::Node(ii.hir_id()), hir, ImplItem, ImplItemKind),
394-
[Const, Fn, TyAlias]
394+
[Const, Fn, Type]
395395
);
396396
hir_visit::walk_impl_item(self, ii)
397397
}

Diff for: compiler/rustc_passes/src/reachable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'tcx> ReachableContext<'tcx> {
155155
let impl_did = self.tcx.hir().get_parent_item(hir_id);
156156
method_might_be_inlined(self.tcx, impl_item, impl_did.def_id)
157157
}
158-
hir::ImplItemKind::TyAlias(_) => false,
158+
hir::ImplItemKind::Type(_) => false,
159159
},
160160
Some(_) => false,
161161
None => false, // This will happen for default methods.
@@ -271,7 +271,7 @@ impl<'tcx> ReachableContext<'tcx> {
271271
self.visit_nested_body(body)
272272
}
273273
}
274-
hir::ImplItemKind::TyAlias(_) => {}
274+
hir::ImplItemKind::Type(_) => {}
275275
},
276276
Node::Expr(&hir::Expr {
277277
kind: hir::ExprKind::Closure(&hir::Closure { body, .. }),

Diff for: compiler/rustc_privacy/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
15741574
hir::ImplItemKind::Const(..) | hir::ImplItemKind::Fn(..) => {
15751575
self.access_levels.is_reachable(impl_item_ref.id.def_id.def_id)
15761576
}
1577-
hir::ImplItemKind::TyAlias(_) => false,
1577+
hir::ImplItemKind::Type(_) => false,
15781578
}
15791579
});
15801580

@@ -1596,7 +1596,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
15961596
{
15971597
intravisit::walk_impl_item(self, impl_item)
15981598
}
1599-
hir::ImplItemKind::TyAlias(..) => {
1599+
hir::ImplItemKind::Type(..) => {
16001600
intravisit::walk_impl_item(self, impl_item)
16011601
}
16021602
_ => {}
@@ -1622,7 +1622,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
16221622
// Those in 3. are warned with this call.
16231623
for impl_item_ref in impl_.items {
16241624
let impl_item = self.tcx.hir().impl_item(impl_item_ref.id);
1625-
if let hir::ImplItemKind::TyAlias(ty) = impl_item.kind {
1625+
if let hir::ImplItemKind::Type(ty) = impl_item.kind {
16261626
self.visit_ty(ty);
16271627
}
16281628
}

Diff for: compiler/rustc_resolve/src/late/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
898898
Fn(..) => self.visit_early_late(impl_item.hir_id(), &impl_item.generics, |this| {
899899
intravisit::walk_impl_item(this, impl_item)
900900
}),
901-
TyAlias(ref ty) => {
901+
Type(ref ty) => {
902902
let generics = &impl_item.generics;
903903
let lifetimes: FxIndexMap<LocalDefId, Region> = generics
904904
.params

Diff for: compiler/rustc_save_analysis/src/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ impl<'tcx> DumpVisitor<'tcx> {
10691069
impl_item.span,
10701070
);
10711071
}
1072-
hir::ImplItemKind::TyAlias(ref ty) => {
1072+
hir::ImplItemKind::Type(ref ty) => {
10731073
// FIXME: uses of the assoc type should ideally point to this
10741074
// 'def' and the name here should be a ref to the def in the
10751075
// trait.

Diff for: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
16591659
..
16601660
})
16611661
| hir::Node::ImplItem(hir::ImplItem {
1662-
kind: hir::ImplItemKind::TyAlias(ty),
1662+
kind: hir::ImplItemKind::Type(ty),
16631663
..
16641664
}),
16651665
) => Some((ty.span, format!("type mismatch resolving `{}`", predicate))),

Diff for: compiler/rustc_trait_selection/src/traits/wf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
224224
};
225225
let fix_span =
226226
|impl_item_ref: &hir::ImplItemRef| match tcx.hir().impl_item(impl_item_ref.id).kind {
227-
hir::ImplItemKind::Const(ty, _) | hir::ImplItemKind::TyAlias(ty) => ty.span,
227+
hir::ImplItemKind::Const(ty, _) | hir::ImplItemKind::Type(ty) => ty.span,
228228
_ => impl_item_ref.span,
229229
};
230230

Diff for: compiler/rustc_ty_utils/src/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
161161
}) => hir::Constness::Const,
162162

163163
hir::Node::ImplItem(hir::ImplItem {
164-
kind: hir::ImplItemKind::TyAlias(..) | hir::ImplItemKind::Fn(..),
164+
kind: hir::ImplItemKind::Type(..) | hir::ImplItemKind::Fn(..),
165165
..
166166
}) => {
167167
let parent_hir_id = tcx.hir().get_parent_node(hir_id);

Diff for: library/core/src/alloc/layout.rs

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl Layout {
6464
#[stable(feature = "alloc_layout", since = "1.28.0")]
6565
#[rustc_const_stable(feature = "const_alloc_layout_size_align", since = "1.50.0")]
6666
#[inline]
67+
#[rustc_allow_const_fn_unstable(ptr_alignment_type)]
6768
pub const fn from_size_align(size: usize, align: usize) -> Result<Self, LayoutError> {
6869
if !align.is_power_of_two() {
6970
return Err(LayoutError);
@@ -113,6 +114,7 @@ impl Layout {
113114
#[rustc_const_stable(feature = "const_alloc_layout_unchecked", since = "1.36.0")]
114115
#[must_use]
115116
#[inline]
117+
#[rustc_allow_const_fn_unstable(ptr_alignment_type)]
116118
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
117119
// SAFETY: the caller is required to uphold the preconditions.
118120
unsafe { Layout { size, align: ValidAlign::new_unchecked(align) } }
@@ -133,6 +135,7 @@ impl Layout {
133135
#[must_use = "this returns the minimum alignment, \
134136
without modifying the layout"]
135137
#[inline]
138+
#[rustc_allow_const_fn_unstable(ptr_alignment_type)]
136139
pub const fn align(&self) -> usize {
137140
self.align.as_usize()
138141
}

Diff for: library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
#![feature(core_panic)]
153153
#![feature(duration_consts_float)]
154154
#![feature(maybe_uninit_uninit_array)]
155+
#![feature(ptr_alignment_type)]
155156
#![feature(ptr_metadata)]
156157
#![feature(slice_ptr_get)]
157158
#![feature(slice_split_at_unchecked)]

Diff for: library/core/src/mem/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ mod maybe_uninit;
2121
#[stable(feature = "maybe_uninit", since = "1.36.0")]
2222
pub use maybe_uninit::MaybeUninit;
2323

24-
mod valid_align;
25-
// For now this type is left crate-local. It could potentially make sense to expose
26-
// it publicly, as it would be a nice parameter type for methods which need to take
27-
// alignment as a parameter, such as `Layout::padding_needed_for`.
28-
pub(crate) use valid_align::ValidAlign;
24+
// FIXME: This is left here for now to avoid complications around pending reverts.
25+
// Once <https://github.com/rust-lang/rust/issues/101899> is fully resolved,
26+
// this should be removed and the references in `alloc::Layout` updated.
27+
pub(crate) use ptr::Alignment as ValidAlign;
2928

3029
mod transmutability;
3130
#[unstable(feature = "transmutability", issue = "99571")]

0 commit comments

Comments
 (0)