Skip to content

Commit

Permalink
Merge #23
Browse files Browse the repository at this point in the history
23: Fix divergence from upstream `master` r=tshepang a=pvdrz

* rust-lang/rust#116381
* rust-lang/rust#116360
* rust-lang/rust#116353
* rust-lang/rust#116406
* rust-lang/rust#116408
  * rust-lang/rust#116395
  * rust-lang/rust#116393
  * rust-lang/rust#116388
  * rust-lang/rust#116365
  * rust-lang/rust#116363
  * rust-lang/rust#116146
  * rust-lang/rust#115961
* rust-lang/rust#116386
* rust-lang/rust#116367
* rust-lang/rust#105394
* rust-lang/rust#115301
* rust-lang/rust#116384
  * rust-lang/rust#116379
  * rust-lang/rust#116328
  * rust-lang/rust#116282
  * rust-lang/rust#116261
  * rust-lang/rust#114654
* rust-lang/rust#116376
  * rust-lang/rust#116374
  * rust-lang/rust#116371
  * rust-lang/rust#116358
  * rust-lang/rust#116210
  * rust-lang/rust#115863
* rust-lang/rust#115025
* rust-lang/rust#116372
  * rust-lang/rust#116361
  * rust-lang/rust#116355
  * rust-lang/rust#116351
  * rust-lang/rust#116158
  * rust-lang/rust#115726
  * rust-lang/rust#113053
* rust-lang/rust#116083
* rust-lang/rust#102099
* rust-lang/rust#116356
  * rust-lang/rust#116350
  * rust-lang/rust#116349
  * rust-lang/rust#116289
  * rust-lang/rust#114454
  * rust-lang/rust#114453
* rust-lang/rust#116331
* rust-lang/rust#116346
  * rust-lang/rust#116340
  * rust-lang/rust#116326
  * rust-lang/rust#116313
* rust-lang/rust#116276
* rust-lang/rust#115898
* rust-lang/rust#116325
* rust-lang/rust#116317
* rust-lang/rust#116207
* rust-lang/rust#116281
* rust-lang/rust#116304
* rust-lang/rust#116259
* rust-lang/rust#116228
* rust-lang/rust#116224
* rust-lang/rust#115554
* rust-lang/rust#116311
  * rust-lang/rust#116299
  * rust-lang/rust#116295
  * rust-lang/rust#116292
* rust-lang/rust#116307
* rust-lang/rust#115670
* rust-lang/rust#116225
* rust-lang/rust#116302
* rust-lang/rust#116108
* rust-lang/rust#116160
* rust-lang/rust#116157
* rust-lang/rust#116127
* rust-lang/rust#116286
* rust-lang/rust#116254
* rust-lang/rust#116195
* rust-lang/rust#116280
* rust-lang/rust#115933
* rust-lang/rust#115546
* rust-lang/rust#115368
* rust-lang/rust#116275
  * rust-lang/rust#116263
  * rust-lang/rust#116241
  * rust-lang/rust#116216
  * rust-lang/rust#116030
  * rust-lang/rust#116024
  * rust-lang/rust#112123
* rust-lang/rust#113301
* rust-lang/rust#113797
* rust-lang/rust#115759
* rust-lang/rust#116260
  * rust-lang/rust#116253
  * rust-lang/rust#116245
  * rust-lang/rust#116239
  * rust-lang/rust#116234
  * rust-lang/rust#116231
  * rust-lang/rust#116201
  * rust-lang/rust#116133
* rust-lang/rust#116176
* rust-lang/rust#116089
* rust-lang/rust#115986



Co-authored-by: ouz-a <[email protected]>
Co-authored-by: Jakub Beránek <[email protected]>
Co-authored-by: Federico Stra <[email protected]>
Co-authored-by: bohan <[email protected]>
Co-authored-by: Jason Newcomb <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Co-authored-by: bors <[email protected]>
Co-authored-by: Oli Scherer <[email protected]>
  • Loading branch information
9 people authored Oct 5, 2023
2 parents 2a5ef32 + 122b741 commit a609d38
Show file tree
Hide file tree
Showing 527 changed files with 6,649 additions and 3,246 deletions.
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ Nilstrieb <[email protected]> nils <48135649+Nilstrieb
Nif Ward <[email protected]>
Nika Layzell <[email protected]> <[email protected]>
NODA Kai <[email protected]>
Oğuz Ağcayazı <[email protected]> <[email protected]>
Oğuz Ağcayazı <[email protected]> <[email protected]>
oliver <[email protected]>
Oliver Middleton <[email protected]> <[email protected]>
Oliver Scherer <[email protected]> <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Files: compiler/*
README.md
RELEASES.md
rustfmt.toml
rust-bors.toml
triagebot.toml
x
x.ps1
Expand Down
39 changes: 27 additions & 12 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2643,9 +2643,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"

[[package]]
name = "jemalloc-sys"
version = "0.5.3+5.3.0-patched"
version = "0.5.4+5.3.0-patched"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9bd5d616ea7ed58b571b2e209a65759664d7fb021a0819d7a790afc67e47ca1"
checksum = "ac6c1946e1cea1788cbfde01c993b52a10e2da07f4bac608228d1bed20bfebf2"
dependencies = [
"cc",
"libc",
Expand Down Expand Up @@ -2768,6 +2768,16 @@ dependencies = [
"winapi",
]

[[package]]
name = "libloading"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161"
dependencies = [
"cfg-if",
"windows-sys 0.48.0",
]

[[package]]
name = "libm"
version = "0.1.4"
Expand Down Expand Up @@ -3043,15 +3053,15 @@ dependencies = [
"lazy_static",
"libc",
"libffi",
"libloading",
"libloading 0.8.1",
"log",
"measureme",
"rand",
"regex",
"rustc_version",
"serde",
"smallvec",
"ui_test 0.11.7",
"ui_test 0.21.2",
]

[[package]]
Expand Down Expand Up @@ -4667,7 +4677,7 @@ dependencies = [
name = "rustc_interface"
version = "0.0.0"
dependencies = [
"libloading",
"libloading 0.7.4",
"rustc-rayon",
"rustc-rayon-core",
"rustc_ast",
Expand Down Expand Up @@ -4798,7 +4808,7 @@ name = "rustc_metadata"
version = "0.0.0"
dependencies = [
"bitflags 1.3.2",
"libloading",
"libloading 0.7.4",
"odht",
"rustc_ast",
"rustc_attr",
Expand Down Expand Up @@ -5013,7 +5023,7 @@ dependencies = [
name = "rustc_plugin_impl"
version = "0.0.0"
dependencies = [
"libloading",
"libloading 0.7.4",
"rustc_ast",
"rustc_errors",
"rustc_fluent_macro",
Expand Down Expand Up @@ -6543,18 +6553,23 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"

[[package]]
name = "ui_test"
version = "0.11.7"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c21899b59f53717dfad29e4f46e5b21a200a1b6888ab86532a07cfc8b48dd78c"
checksum = "bfd8fb9b15c8332cf51bfc2dc4830063b2446a9c9d732421b56f2478024a3971"
dependencies = [
"annotate-snippets",
"anyhow",
"bstr",
"cargo-platform",
"cargo_metadata",
"color-eyre",
"colored",
"comma",
"crossbeam-channel",
"diff",
"indicatif",
"lazy_static",
"levenshtein",
"prettydiff",
"regex",
"rustc_version",
"rustfix",
Expand All @@ -6565,9 +6580,9 @@ dependencies = [

[[package]]
name = "ui_test"
version = "0.20.0"
version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd8fb9b15c8332cf51bfc2dc4830063b2446a9c9d732421b56f2478024a3971"
checksum = "aaf4bf7c184b8dfc7a4d3b90df789b1eb992ee42811cd115f32a7a1eb781058d"
dependencies = [
"annotate-snippets",
"anyhow",
Expand Down
117 changes: 117 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,120 @@
Version 1.73.0 (2023-10-05)
==========================

<a id="1.73.0-Language"></a>

Language
--------

- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.](https://github.com/rust-lang/rust/pull/111717/)
- [Make `noop_method_call` warn by default.](https://github.com/rust-lang/rust/pull/111916/)
- [Support interpolated block for `try` and `async` in macros.](https://github.com/rust-lang/rust/pull/112953/)
- [Make `unconditional_recursion` lint detect recursive drops.](https://github.com/rust-lang/rust/pull/113902/)
- [Future compatibility warning for some impls being incorrectly considered not overlapping.](https://github.com/rust-lang/rust/pull/114023/)
- [The `invalid_reference_casting` lint is now **deny-by-default** (instead of allow-by-default)](https://github.com/rust-lang/rust/pull/112431)

<a id="1.73.0-Compiler"></a>

Compiler
--------

- [Write version information in a `.comment` section like GCC/Clang.](https://github.com/rust-lang/rust/pull/97550/)
- [Add documentation on v0 symbol mangling.](https://github.com/rust-lang/rust/pull/97571/)
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.](https://github.com/rust-lang/rust/pull/114562/)
- [Only check outlives goals on impl compared to trait.](https://github.com/rust-lang/rust/pull/109356/)
- [Infer type in irrefutable slice patterns with fixed length as array.](https://github.com/rust-lang/rust/pull/113199/)
- [Discard default auto trait impls if explicit ones exist.](https://github.com/rust-lang/rust/pull/113312/)
- Add several new tier 3 targets:
- [`aarch64-unknown-teeos`](https://github.com/rust-lang/rust/pull/113480/)
- [`csky-unknown-linux-gnuabiv2`](https://github.com/rust-lang/rust/pull/113658/)
- [`riscv64-linux-android`](https://github.com/rust-lang/rust/pull/112858/)
- [`riscv64gc-unknown-hermit`](https://github.com/rust-lang/rust/pull/114004/)
- [`x86_64-unikraft-linux-musl`](https://github.com/rust-lang/rust/pull/113411/)
- [`x86_64-unknown-linux-ohos`](https://github.com/rust-lang/rust/pull/113061/)
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.](https://github.com/rust-lang/rust/pull/112922/)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

<a id="1.73.0-Libraries"></a>

Libraries
---------

- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.](https://github.com/rust-lang/rust/pull/94748/)
- [Merge functionality of `io::Sink` into `io::Empty`.](https://github.com/rust-lang/rust/pull/98154/)
- [Implement `RefUnwindSafe` for `Backtrace`](https://github.com/rust-lang/rust/pull/100455/)
- [Make `ExitStatus` implement `Default`](https://github.com/rust-lang/rust/pull/106425/)
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`](https://github.com/rust-lang/rust/pull/111081/)
- [Change default panic handler message format.](https://github.com/rust-lang/rust/pull/112849/)
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.](https://github.com/rust-lang/rust/pull/111071/)
- [Correct the (deprecated) Android `stat` struct definitions.](https://github.com/rust-lang/rust/pull/113130/)

<a id="1.73.0-Stabilized-APIs"></a>

Stabilized APIs
---------------

- [Unsigned `{integer}::div_ceil`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.div_ceil)
- [Unsigned `{integer}::next_multiple_of`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
- [Unsigned `{integer}::checked_next_multiple_of`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
- [`std::ffi::FromBytesUntilNulError`](https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
- [`std::os::unix::fs::chown`](https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
- [`std::os::unix::fs::fchown`](https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
- [`std::os::unix::fs::lchown`](https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
- [`LocalKey::<Cell<T>>::get`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
- [`LocalKey::<Cell<T>>::set`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
- [`LocalKey::<Cell<T>>::take`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
- [`LocalKey::<Cell<T>>::replace`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
- [`LocalKey::<RefCell<T>>::with_borrow`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
- [`LocalKey::<RefCell<T>>::with_borrow_mut`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
- [`LocalKey::<RefCell<T>>::set`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
- [`LocalKey::<RefCell<T>>::take`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
- [`LocalKey::<RefCell<T>>::replace`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)

These APIs are now stable in const contexts:

- [`rc::Weak::new`](https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
- [`sync::Weak::new`](https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
- [`NonNull::as_ref`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)

<a id="1.73.0-Cargo"></a>

Cargo
-----

- [Encode URL params correctly for `SourceId` in `Cargo.lock`.](https://github.com/rust-lang/cargo/pull/12280/)
- [Bail out an error when using `cargo::` in custom build script.](https://github.com/rust-lang/cargo/pull/12332/)

<a id="1.73.0-Misc"></a>

Misc
----

<a id="1.73.0-Compatibility-Notes"></a>

Compatibility Notes
-------------------

- [Update the minimum external LLVM to 15.](https://github.com/rust-lang/rust/pull/114148/)
- [Check for non-defining uses of return position `impl Trait`.](https://github.com/rust-lang/rust/pull/112842/)

<a id="1.73.0-Internal-Changes"></a>

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Remove LLVM pointee types, supporting only opaque pointers.](https://github.com/rust-lang/rust/pull/105545/)
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.](https://github.com/rust-lang/rust/pull/112235/)
- [Replace in-tree `rustc_apfloat` with the new version of the crate.](https://github.com/rust-lang/rust/pull/113843/)
- [Update to LLVM 17.](https://github.com/rust-lang/rust/pull/114048/)
- [Add `internal_features` lint for internal unstable features.](https://github.com/rust-lang/rust/pull/108955/)
- [Mention style for new syntax in tracking issue template.](https://github.com/rust-lang/rust/pull/113586/)

Version 1.72.1 (2023-09-19)
===========================

Expand Down
76 changes: 38 additions & 38 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,32 @@ pub trait LayoutCalculator {
kind: StructKind,
) -> Option<LayoutS> {
let layout = univariant(self, dl, fields, repr, kind, NicheBias::Start);
// Enums prefer niches close to the beginning or the end of the variants so that other (smaller)
// data-carrying variants can be packed into the space after/before the niche.
// Enums prefer niches close to the beginning or the end of the variants so that other
// (smaller) data-carrying variants can be packed into the space after/before the niche.
// If the default field ordering does not give us a niche at the front then we do a second
// run and bias niches to the right and then check which one is closer to one of the struct's
// edges.
// run and bias niches to the right and then check which one is closer to one of the
// struct's edges.
if let Some(layout) = &layout {
// Don't try to calculate an end-biased layout for unsizable structs,
// otherwise we could end up with different layouts for
// Foo<Type> and Foo<dyn Trait> which would break unsizing
// Foo<Type> and Foo<dyn Trait> which would break unsizing.
if !matches!(kind, StructKind::MaybeUnsized) {
if let Some(niche) = layout.largest_niche {
let head_space = niche.offset.bytes();
let niche_length = niche.value.size(dl).bytes();
let tail_space = layout.size.bytes() - head_space - niche_length;
let niche_len = niche.value.size(dl).bytes();
let tail_space = layout.size.bytes() - head_space - niche_len;

// This may end up doing redundant work if the niche is already in the last field
// (e.g. a trailing bool) and there is tail padding. But it's non-trivial to get
// the unpadded size so we try anyway.
// This may end up doing redundant work if the niche is already in the last
// field (e.g. a trailing bool) and there is tail padding. But it's non-trivial
// to get the unpadded size so we try anyway.
if fields.len() > 1 && head_space != 0 && tail_space > 0 {
let alt_layout = univariant(self, dl, fields, repr, kind, NicheBias::End)
.expect("alt layout should always work");
let niche = alt_layout
let alt_niche = alt_layout
.largest_niche
.expect("alt layout should have a niche like the regular one");
let alt_head_space = niche.offset.bytes();
let alt_niche_len = niche.value.size(dl).bytes();
let alt_head_space = alt_niche.offset.bytes();
let alt_niche_len = alt_niche.value.size(dl).bytes();
let alt_tail_space =
alt_layout.size.bytes() - alt_head_space - alt_niche_len;

Expand All @@ -93,7 +93,7 @@ pub trait LayoutCalculator {
alt_layout: {}\n",
layout.size.bytes(),
head_space,
niche_length,
niche_len,
tail_space,
alt_head_space,
alt_niche_len,
Expand Down Expand Up @@ -684,7 +684,8 @@ pub trait LayoutCalculator {
// Also do not overwrite any already existing "clever" ABIs.
if variant.fields.count() > 0 && matches!(variant.abi, Abi::Aggregate { .. }) {
variant.abi = abi;
// Also need to bump up the size and alignment, so that the entire value fits in here.
// Also need to bump up the size and alignment, so that the entire value fits
// in here.
variant.size = cmp::max(variant.size, size);
variant.align.abi = cmp::max(variant.align.abi, align.abi);
}
Expand Down Expand Up @@ -868,15 +869,15 @@ fn univariant(

// If `-Z randomize-layout` was enabled for the type definition we can shuffle
// the field ordering to try and catch some code making assumptions about layouts
// we don't guarantee
// we don't guarantee.
if repr.can_randomize_type_layout() && cfg!(feature = "randomize") {
#[cfg(feature = "randomize")]
{
// `ReprOptions.layout_seed` is a deterministic seed that we can use to
// randomize field ordering with
// `ReprOptions.layout_seed` is a deterministic seed we can use to randomize field
// ordering.
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed.as_u64());

// Shuffle the ordering of the fields
// Shuffle the ordering of the fields.
optimizing.shuffle(&mut rng);
}
// Otherwise we just leave things alone and actually optimize the type's fields
Expand All @@ -892,27 +893,26 @@ fn univariant(
.max()
.unwrap_or(0);

// Calculates a sort key to group fields by their alignment or possibly some size-derived
// pseudo-alignment.
// Calculates a sort key to group fields by their alignment or possibly some
// size-derived pseudo-alignment.
let alignment_group_key = |layout: Layout<'_>| {
if let Some(pack) = pack {
// return the packed alignment in bytes
// Return the packed alignment in bytes.
layout.align().abi.min(pack).bytes()
} else {
// returns log2(effective-align).
// This is ok since `pack` applies to all fields equally.
// The calculation assumes that size is an integer multiple of align, except for ZSTs.
//
// Returns `log2(effective-align)`. This is ok since `pack` applies to all
// fields equally. The calculation assumes that size is an integer multiple of
// align, except for ZSTs.
let align = layout.align().abi.bytes();
let size = layout.size().bytes();
let niche_size = layout.largest_niche().map(|n| n.available(dl)).unwrap_or(0);
// group [u8; 4] with align-4 or [u8; 6] with align-2 fields
// Group [u8; 4] with align-4 or [u8; 6] with align-2 fields.
let size_as_align = align.max(size).trailing_zeros();
let size_as_align = if largest_niche_size > 0 {
match niche_bias {
// Given `A(u8, [u8; 16])` and `B(bool, [u8; 16])` we want to bump the array
// to the front in the first case (for aligned loads) but keep the bool in front
// in the second case for its niches.
// Given `A(u8, [u8; 16])` and `B(bool, [u8; 16])` we want to bump the
// array to the front in the first case (for aligned loads) but keep
// the bool in front in the second case for its niches.
NicheBias::Start => max_field_align.trailing_zeros().min(size_as_align),
// When moving niches towards the end of the struct then for
// A((u8, u8, u8, bool), (u8, bool, u8)) we want to keep the first tuple
Expand All @@ -931,14 +931,14 @@ fn univariant(

match kind {
StructKind::AlwaysSized | StructKind::MaybeUnsized => {
// Currently `LayoutS` only exposes a single niche so sorting is usually sufficient
// to get one niche into the preferred position. If it ever supported multiple niches
// then a more advanced pick-and-pack approach could provide better results.
// But even for the single-niche cache it's not optimal. E.g. for
// A(u32, (bool, u8), u16) it would be possible to move the bool to the front
// but it would require packing the tuple together with the u16 to build a 4-byte
// group so that the u32 can be placed after it without padding. This kind
// of packing can't be achieved by sorting.
// Currently `LayoutS` only exposes a single niche so sorting is usually
// sufficient to get one niche into the preferred position. If it ever
// supported multiple niches then a more advanced pick-and-pack approach could
// provide better results. But even for the single-niche cache it's not
// optimal. E.g. for A(u32, (bool, u8), u16) it would be possible to move the
// bool to the front but it would require packing the tuple together with the
// u16 to build a 4-byte group so that the u32 can be placed after it without
// padding. This kind of packing can't be achieved by sorting.
optimizing.sort_by_key(|&x| {
let f = fields[x];
let field_size = f.size().bytes();
Expand Down
Loading

0 comments on commit a609d38

Please sign in to comment.