Skip to content

Commit 0c9d1a3

Browse files
committed
Auto merge of #2990 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 16cddb3 + 8a3b746 commit 0c9d1a3

File tree

129 files changed

+1917
-1747
lines changed

Some content is hidden

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

129 files changed

+1917
-1747
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 10 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ bitflags! {
4949
}
5050
}
5151

52-
/// Which niches (beyond the `null` niche) are available on references.
53-
#[derive(Default, Copy, Clone, Hash, Debug, Eq, PartialEq)]
54-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
55-
pub struct ReferenceNichePolicy {
56-
pub size: bool,
57-
pub align: bool,
58-
}
59-
6052
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
6153
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
6254
pub enum IntegerType {
@@ -354,33 +346,6 @@ impl TargetDataLayout {
354346
}
355347
}
356348

357-
#[inline]
358-
pub fn target_usize_max(&self) -> u64 {
359-
self.pointer_size.unsigned_int_max().try_into().unwrap()
360-
}
361-
362-
#[inline]
363-
pub fn target_isize_min(&self) -> i64 {
364-
self.pointer_size.signed_int_min().try_into().unwrap()
365-
}
366-
367-
#[inline]
368-
pub fn target_isize_max(&self) -> i64 {
369-
self.pointer_size.signed_int_max().try_into().unwrap()
370-
}
371-
372-
/// Returns the (inclusive) range of possible addresses for an allocation with
373-
/// the given size and alignment.
374-
///
375-
/// Note that this doesn't take into account target-specific limitations.
376-
#[inline]
377-
pub fn address_range_for(&self, size: Size, align: Align) -> (u64, u64) {
378-
let end = Size::from_bytes(self.target_usize_max());
379-
let min = align.bytes();
380-
let max = (end - size).align_down_to(align).bytes();
381-
(min, max)
382-
}
383-
384349
#[inline]
385350
pub fn vector_align(&self, vec_size: Size) -> AbiAndPrefAlign {
386351
for &(size, align) in &self.vector_align {
@@ -508,12 +473,6 @@ impl Size {
508473
Size::from_bytes((self.bytes() + mask) & !mask)
509474
}
510475

511-
#[inline]
512-
pub fn align_down_to(self, align: Align) -> Size {
513-
let mask = align.bytes() - 1;
514-
Size::from_bytes(self.bytes() & !mask)
515-
}
516-
517476
#[inline]
518477
pub fn is_aligned(self, align: Align) -> bool {
519478
let mask = align.bytes() - 1;
@@ -1008,43 +967,6 @@ impl WrappingRange {
1008967
}
1009968
}
1010969

1011-
/// Returns `true` if `range` is contained in `self`.
1012-
#[inline(always)]
1013-
pub fn contains_range<I: Into<u128> + Ord>(&self, range: RangeInclusive<I>) -> bool {
1014-
if range.is_empty() {
1015-
return true;
1016-
}
1017-
1018-
let (vmin, vmax) = range.into_inner();
1019-
let (vmin, vmax) = (vmin.into(), vmax.into());
1020-
1021-
if self.start <= self.end {
1022-
self.start <= vmin && vmax <= self.end
1023-
} else {
1024-
// The last check is needed to cover the following case:
1025-
// `vmin ... start, end ... vmax`. In this special case there is no gap
1026-
// between `start` and `end` so we must return true.
1027-
self.start <= vmin || vmax <= self.end || self.start == self.end + 1
1028-
}
1029-
}
1030-
1031-
/// Returns `true` if `range` has an overlap with `self`.
1032-
#[inline(always)]
1033-
pub fn overlaps_range<I: Into<u128> + Ord>(&self, range: RangeInclusive<I>) -> bool {
1034-
if range.is_empty() {
1035-
return false;
1036-
}
1037-
1038-
let (vmin, vmax) = range.into_inner();
1039-
let (vmin, vmax) = (vmin.into(), vmax.into());
1040-
1041-
if self.start <= self.end {
1042-
self.start <= vmax && vmin <= self.end
1043-
} else {
1044-
self.start <= vmax || vmin <= self.end
1045-
}
1046-
}
1047-
1048970
/// Returns `self` with replaced `start`
1049971
#[inline(always)]
1050972
pub fn with_start(mut self, start: u128) -> Self {
@@ -1062,15 +984,9 @@ impl WrappingRange {
1062984
/// Returns `true` if `size` completely fills the range.
1063985
#[inline]
1064986
pub fn is_full_for(&self, size: Size) -> bool {
1065-
debug_assert!(self.is_in_range_for(size));
1066-
self.start == (self.end.wrapping_add(1) & size.unsigned_int_max())
1067-
}
1068-
1069-
/// Returns `true` if the range is valid for `size`.
1070-
#[inline(always)]
1071-
pub fn is_in_range_for(&self, size: Size) -> bool {
1072987
let max_value = size.unsigned_int_max();
1073-
self.start <= max_value && self.end <= max_value
988+
debug_assert!(self.start <= max_value && self.end <= max_value);
989+
self.start == (self.end.wrapping_add(1) & max_value)
1074990
}
1075991
}
1076992

@@ -1511,21 +1427,16 @@ impl Niche {
15111427

15121428
pub fn reserve<C: HasDataLayout>(&self, cx: &C, count: u128) -> Option<(u128, Scalar)> {
15131429
assert!(count > 0);
1514-
if count > self.available(cx) {
1515-
return None;
1516-
}
15171430

15181431
let Self { value, valid_range: v, .. } = *self;
1519-
let max_value = value.size(cx).unsigned_int_max();
1520-
let distance_end_zero = max_value - v.end;
1432+
let size = value.size(cx);
1433+
assert!(size.bits() <= 128);
1434+
let max_value = size.unsigned_int_max();
15211435

1522-
// Null-pointer optimization. This is guaranteed by Rust (at least for `Option<_>`),
1523-
// and offers better codegen opportunities.
1524-
if count == 1 && matches!(value, Pointer(_)) && !v.contains(0) {
1525-
// Select which bound to move to minimize the number of lost niches.
1526-
let valid_range =
1527-
if v.start - 1 > distance_end_zero { v.with_end(0) } else { v.with_start(0) };
1528-
return Some((0, Scalar::Initialized { value, valid_range }));
1436+
let niche = v.end.wrapping_add(1)..v.start;
1437+
let available = niche.end.wrapping_sub(niche.start) & max_value;
1438+
if count > available {
1439+
return None;
15291440
}
15301441

15311442
// Extend the range of valid values being reserved by moving either `v.start` or `v.end` bound.
@@ -1548,6 +1459,7 @@ impl Niche {
15481459
let end = v.end.wrapping_add(count) & max_value;
15491460
Some((start, Scalar::Initialized { value, valid_range: v.with_end(end) }))
15501461
};
1462+
let distance_end_zero = max_value - v.end;
15511463
if v.start > v.end {
15521464
// zero is unavailable because wrapping occurs
15531465
move_end(v)

compiler/rustc_ast/src/ast.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,12 @@ impl Param {
23532353
/// Builds a `Param` object from `ExplicitSelf`.
23542354
pub fn from_self(attrs: AttrVec, eself: ExplicitSelf, eself_ident: Ident) -> Param {
23552355
let span = eself.span.to(eself_ident.span);
2356-
let infer_ty = P(Ty { id: DUMMY_NODE_ID, kind: TyKind::ImplicitSelf, span, tokens: None });
2356+
let infer_ty = P(Ty {
2357+
id: DUMMY_NODE_ID,
2358+
kind: TyKind::ImplicitSelf,
2359+
span: eself_ident.span,
2360+
tokens: None,
2361+
});
23572362
let (mutbl, ty) = match eself.node {
23582363
SelfKind::Explicit(ty, mutbl) => (mutbl, ty),
23592364
SelfKind::Value(mutbl) => (mutbl, infer_ty),

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414

15-
- name: Install rustfmt
15+
- name: Avoid installing rustc-dev
1616
run: |
17-
rustup component add rustfmt
17+
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain
18+
echo 'profile = "minimal"' >> rust-toolchain
19+
rustfmt -v
1820
1921
- name: Rustfmt
2022
run: |
@@ -127,7 +129,7 @@ jobs:
127129
- uses: actions/checkout@v3
128130

129131
- name: Prepare dependencies
130-
run: ./y.rs prepare
132+
run: ./y.sh prepare
131133

132134
- name: Disable JIT tests
133135
run: |
@@ -136,7 +138,7 @@ jobs:
136138
- name: Test
137139
env:
138140
TARGET_TRIPLE: x86_64-unknown-linux-gnu
139-
run: ./y.rs test --use-backend llvm
141+
run: ./y.sh test --use-backend llvm
140142

141143
bench:
142144
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)