Skip to content

Commit eae9d7a

Browse files
authored
Merge pull request rust-lang#18431 from lnicola/sync-from-rust
minor: Sync from downstream
2 parents af764db + 49baaf0 commit eae9d7a

File tree

1,216 files changed

+14597
-10326
lines changed

Some content is hidden

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

1,216 files changed

+14597
-10326
lines changed

Diff for: Cargo.lock

+2-1
Original file line numberDiff line numberDiff line change
@@ -4029,6 +4029,7 @@ dependencies = [
40294029
"rustc_hir",
40304030
"rustc_hir_pretty",
40314031
"rustc_index",
4032+
"rustc_lint_defs",
40324033
"rustc_macros",
40334034
"rustc_query_system",
40344035
"rustc_serialize",
@@ -4495,14 +4496,14 @@ name = "rustc_transmute"
44954496
version = "0.0.0"
44964497
dependencies = [
44974498
"itertools",
4499+
"rustc_abi",
44984500
"rustc_ast_ir",
44994501
"rustc_data_structures",
45004502
"rustc_hir",
45014503
"rustc_infer",
45024504
"rustc_macros",
45034505
"rustc_middle",
45044506
"rustc_span",
4505-
"rustc_target",
45064507
"tracing",
45074508
]
45084509

Diff for: RELEASES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ Stabilized APIs
6868
- [`impl Default for std::collections::vec_deque::Iter`](https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.Iter.html#impl-Default-for-Iter%3C'_,+T%3E)
6969
- [`impl Default for std::collections::vec_deque::IterMut`](https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.IterMut.html#impl-Default-for-IterMut%3C'_,+T%3E)
7070
- [`Rc<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit)
71-
- [`Rc<T>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init)
71+
- [`Rc<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init)
7272
- [`Rc<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit_slice)
7373
- [`Rc<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init-1)
7474
- [`Arc<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit)
75-
- [`Arc<T>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init)
75+
- [`Arc<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init)
7676
- [`Arc<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit_slice)
7777
- [`Arc<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init-1)
7878
- [`Box<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit)
79-
- [`Box<T>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init)
79+
- [`Box<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init)
8080
- [`Box<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit_slice)
8181
- [`Box<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init-1)
8282
- [`core::arch::x86_64::_bextri_u64`](https://doc.rust-lang.org/stable/core/arch/x86_64/fn._bextri_u64.html)

Diff for: compiler/rustc_abi/src/layout.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use tracing::debug;
77

88
use crate::{
99
Abi, AbiAndPrefAlign, Align, FieldsShape, HasDataLayout, IndexSlice, IndexVec, Integer,
10-
LayoutS, Niche, NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding,
10+
LayoutData, Niche, NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding,
1111
Variants, WrappingRange,
1212
};
1313

@@ -26,7 +26,7 @@ fn absent<'a, FieldIdx, VariantIdx, F>(fields: &IndexSlice<FieldIdx, F>) -> bool
2626
where
2727
FieldIdx: Idx,
2828
VariantIdx: Idx,
29-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug,
29+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug,
3030
{
3131
let uninhabited = fields.iter().any(|f| f.abi.is_uninhabited());
3232
// We cannot ignore alignment; that might lead us to entirely discard a variant and
@@ -89,7 +89,7 @@ impl<F> LayoutCalculatorError<F> {
8989
}
9090

9191
type LayoutCalculatorResult<FieldIdx, VariantIdx, F> =
92-
Result<LayoutS<FieldIdx, VariantIdx>, LayoutCalculatorError<F>>;
92+
Result<LayoutData<FieldIdx, VariantIdx>, LayoutCalculatorError<F>>;
9393

9494
#[derive(Clone, Copy, Debug)]
9595
pub struct LayoutCalculator<Cx> {
@@ -105,7 +105,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
105105
&self,
106106
a: Scalar,
107107
b: Scalar,
108-
) -> LayoutS<FieldIdx, VariantIdx> {
108+
) -> LayoutData<FieldIdx, VariantIdx> {
109109
let dl = self.cx.data_layout();
110110
let b_align = b.align(dl);
111111
let align = a.align(dl).max(b_align).max(dl.aggregate_align);
@@ -119,7 +119,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
119119
.chain(Niche::from_scalar(dl, Size::ZERO, a))
120120
.max_by_key(|niche| niche.available(dl));
121121

122-
LayoutS {
122+
LayoutData {
123123
variants: Variants::Single { index: VariantIdx::new(0) },
124124
fields: FieldsShape::Arbitrary {
125125
offsets: [Size::ZERO, b_offset].into(),
@@ -138,7 +138,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
138138
'a,
139139
FieldIdx: Idx,
140140
VariantIdx: Idx,
141-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
141+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
142142
>(
143143
&self,
144144
fields: &IndexSlice<FieldIdx, F>,
@@ -211,9 +211,9 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
211211

212212
pub fn layout_of_never_type<FieldIdx: Idx, VariantIdx: Idx>(
213213
&self,
214-
) -> LayoutS<FieldIdx, VariantIdx> {
214+
) -> LayoutData<FieldIdx, VariantIdx> {
215215
let dl = self.cx.data_layout();
216-
LayoutS {
216+
LayoutData {
217217
variants: Variants::Single { index: VariantIdx::new(0) },
218218
fields: FieldsShape::Primitive,
219219
abi: Abi::Uninhabited,
@@ -229,7 +229,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
229229
'a,
230230
FieldIdx: Idx,
231231
VariantIdx: Idx,
232-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
232+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
233233
>(
234234
&self,
235235
repr: &ReprOptions,
@@ -292,7 +292,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
292292
'a,
293293
FieldIdx: Idx,
294294
VariantIdx: Idx,
295-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
295+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
296296
>(
297297
&self,
298298
repr: &ReprOptions,
@@ -384,7 +384,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
384384
return Err(LayoutCalculatorError::EmptyUnion);
385385
};
386386

387-
Ok(LayoutS {
387+
Ok(LayoutData {
388388
variants: Variants::Single { index: only_variant_idx },
389389
fields: FieldsShape::Union(union_field_count),
390390
abi,
@@ -401,7 +401,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
401401
'a,
402402
FieldIdx: Idx,
403403
VariantIdx: Idx,
404-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
404+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
405405
>(
406406
&self,
407407
repr: &ReprOptions,
@@ -501,7 +501,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
501501
'a,
502502
FieldIdx: Idx,
503503
VariantIdx: Idx,
504-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
504+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
505505
>(
506506
&self,
507507
repr: &ReprOptions,
@@ -516,8 +516,8 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
516516
// overall LayoutS. Store the overall LayoutS
517517
// and the variant LayoutSs here until then.
518518
struct TmpLayout<FieldIdx: Idx, VariantIdx: Idx> {
519-
layout: LayoutS<FieldIdx, VariantIdx>,
520-
variants: IndexVec<VariantIdx, LayoutS<FieldIdx, VariantIdx>>,
519+
layout: LayoutData<FieldIdx, VariantIdx>,
520+
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
521521
}
522522

523523
let dl = self.cx.data_layout();
@@ -649,7 +649,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
649649
Abi::Aggregate { sized: true }
650650
};
651651

652-
let layout = LayoutS {
652+
let layout = LayoutData {
653653
variants: Variants::Multiple {
654654
tag: niche_scalar,
655655
tag_encoding: TagEncoding::Niche {
@@ -958,7 +958,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
958958

959959
let largest_niche = Niche::from_scalar(dl, Size::ZERO, tag);
960960

961-
let tagged_layout = LayoutS {
961+
let tagged_layout = LayoutData {
962962
variants: Variants::Multiple {
963963
tag,
964964
tag_encoding: TagEncoding::Direct,
@@ -1013,7 +1013,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
10131013
'a,
10141014
FieldIdx: Idx,
10151015
VariantIdx: Idx,
1016-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
1016+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
10171017
>(
10181018
&self,
10191019
fields: &IndexSlice<FieldIdx, F>,
@@ -1341,7 +1341,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
13411341
unadjusted_abi_align
13421342
};
13431343

1344-
Ok(LayoutS {
1344+
Ok(LayoutData {
13451345
variants: Variants::Single { index: VariantIdx::new(0) },
13461346
fields: FieldsShape::Arbitrary { offsets, memory_index },
13471347
abi,
@@ -1357,10 +1357,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
13571357
'a,
13581358
FieldIdx: Idx,
13591359
VariantIdx: Idx,
1360-
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug,
1360+
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug,
13611361
>(
13621362
&self,
1363-
layout: &LayoutS<FieldIdx, VariantIdx>,
1363+
layout: &LayoutData<FieldIdx, VariantIdx>,
13641364
fields: &IndexSlice<FieldIdx, F>,
13651365
) -> String {
13661366
let dl = self.cx.data_layout();

Diff for: compiler/rustc_abi/src/layout/ty.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ rustc_index::newtype_index! {
5858
}
5959
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
6060
#[rustc_pass_by_value]
61-
pub struct Layout<'a>(pub Interned<'a, LayoutS<FieldIdx, VariantIdx>>);
61+
pub struct Layout<'a>(pub Interned<'a, LayoutData<FieldIdx, VariantIdx>>);
6262

6363
impl<'a> fmt::Debug for Layout<'a> {
6464
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -68,8 +68,8 @@ impl<'a> fmt::Debug for Layout<'a> {
6868
}
6969

7070
impl<'a> Deref for Layout<'a> {
71-
type Target = &'a LayoutS<FieldIdx, VariantIdx>;
72-
fn deref(&self) -> &&'a LayoutS<FieldIdx, VariantIdx> {
71+
type Target = &'a LayoutData<FieldIdx, VariantIdx>;
72+
fn deref(&self) -> &&'a LayoutData<FieldIdx, VariantIdx> {
7373
&self.0.0
7474
}
7575
}
@@ -142,8 +142,8 @@ impl<'a, Ty: fmt::Display> fmt::Debug for TyAndLayout<'a, Ty> {
142142
}
143143

144144
impl<'a, Ty> Deref for TyAndLayout<'a, Ty> {
145-
type Target = &'a LayoutS<FieldIdx, VariantIdx>;
146-
fn deref(&self) -> &&'a LayoutS<FieldIdx, VariantIdx> {
145+
type Target = &'a LayoutData<FieldIdx, VariantIdx>;
146+
fn deref(&self) -> &&'a LayoutData<FieldIdx, VariantIdx> {
147147
&self.layout.0.0
148148
}
149149
}

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
14851485
tag: Scalar,
14861486
tag_encoding: TagEncoding<VariantIdx>,
14871487
tag_field: usize,
1488-
variants: IndexVec<VariantIdx, LayoutS<FieldIdx, VariantIdx>>,
1488+
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
14891489
},
14901490
}
14911491

@@ -1603,7 +1603,7 @@ impl Niche {
16031603
// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage.
16041604
#[derive(PartialEq, Eq, Hash, Clone)]
16051605
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
1606-
pub struct LayoutS<FieldIdx: Idx, VariantIdx: Idx> {
1606+
pub struct LayoutData<FieldIdx: Idx, VariantIdx: Idx> {
16071607
/// Says where the fields are located within the layout.
16081608
pub fields: FieldsShape<FieldIdx>,
16091609

@@ -1643,7 +1643,7 @@ pub struct LayoutS<FieldIdx: Idx, VariantIdx: Idx> {
16431643
pub unadjusted_abi_align: Align,
16441644
}
16451645

1646-
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
1646+
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
16471647
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
16481648
pub fn is_aggregate(&self) -> bool {
16491649
match self.abi {
@@ -1656,7 +1656,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
16561656
let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
16571657
let size = scalar.size(cx);
16581658
let align = scalar.align(cx);
1659-
LayoutS {
1659+
LayoutData {
16601660
variants: Variants::Single { index: VariantIdx::new(0) },
16611661
fields: FieldsShape::Primitive,
16621662
abi: Abi::Scalar(scalar),
@@ -1669,7 +1669,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
16691669
}
16701670
}
16711671

1672-
impl<FieldIdx: Idx, VariantIdx: Idx> fmt::Debug for LayoutS<FieldIdx, VariantIdx>
1672+
impl<FieldIdx: Idx, VariantIdx: Idx> fmt::Debug for LayoutData<FieldIdx, VariantIdx>
16731673
where
16741674
FieldsShape<FieldIdx>: fmt::Debug,
16751675
Variants<FieldIdx, VariantIdx>: fmt::Debug,
@@ -1678,7 +1678,7 @@ where
16781678
// This is how `Layout` used to print before it become
16791679
// `Interned<LayoutS>`. We print it like this to avoid having to update
16801680
// expected output in a lot of tests.
1681-
let LayoutS {
1681+
let LayoutData {
16821682
size,
16831683
align,
16841684
abi,
@@ -1723,7 +1723,7 @@ pub struct PointeeInfo {
17231723
pub safe: Option<PointerKind>,
17241724
}
17251725

1726-
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
1726+
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
17271727
/// Returns `true` if the layout corresponds to an unsized type.
17281728
#[inline]
17291729
pub fn is_unsized(&self) -> bool {

Diff for: compiler/rustc_ast/src/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ impl fmt::Debug for ImplPolarity {
26972697
}
26982698

26992699
/// The polarity of a trait bound.
2700-
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
2700+
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)]
27012701
#[derive(HashStable_Generic)]
27022702
pub enum BoundPolarity {
27032703
/// `Type: Trait`
@@ -2719,7 +2719,7 @@ impl BoundPolarity {
27192719
}
27202720

27212721
/// The constness of a trait bound.
2722-
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
2722+
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)]
27232723
#[derive(HashStable_Generic)]
27242724
pub enum BoundConstness {
27252725
/// `Type: Trait`

Diff for: compiler/rustc_ast/src/attr/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl AttrItem {
223223
self.args.span().map_or(self.path.span, |args_span| self.path.span.to(args_span))
224224
}
225225

226-
fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>> {
226+
pub fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>> {
227227
match &self.args {
228228
AttrArgs::Delimited(args) if args.delim == Delimiter::Parenthesis => {
229229
MetaItemKind::list_from_tokens(args.tokens.clone())

0 commit comments

Comments
 (0)