Skip to content

Commit d37b074

Browse files
committed
Auto merge of #129831 - matthiaskrgr:rollup-befq6zx, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #128523 (Add release notes for 1.81.0) - #129605 (Add missing `needs-llvm-components` directives for run-make tests that need target-specific codegen) - #129650 (Clean up `library/profiler_builtins/build.rs`) - #129651 (skip stage 0 target check if `BOOTSTRAP_SKIP_TARGET_SANITY` is set) - #129684 (Enable Miri to pass pointers through FFI) - #129762 (Update the `wasm-component-ld` binary dependency) - #129782 (couple more crash tests) - #129816 (tidy: say which feature gate has a stability issue mismatch) - #129818 (make the const-unstable-in-stable error more clear) - #129824 (Fix code examples buttons not appearing on click on mobile) - #129826 (library: Fix typo in `core::mem`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d571ae8 + 4151fd4 commit d37b074

File tree

37 files changed

+559
-101
lines changed

37 files changed

+559
-101
lines changed

Cargo.lock

+32-23
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ dependencies = [
24632463
"indexmap",
24642464
"memchr",
24652465
"ruzstd 0.7.0",
2466-
"wasmparser",
2466+
"wasmparser 0.215.0",
24672467
]
24682468

24692469
[[package]]
@@ -3133,7 +3133,7 @@ dependencies = [
31333133
"regex",
31343134
"serde_json",
31353135
"similar",
3136-
"wasmparser",
3136+
"wasmparser 0.216.0",
31373137
]
31383138

31393139
[[package]]
@@ -5779,9 +5779,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
57795779

57805780
[[package]]
57815781
name = "wasi-preview1-component-adapter-provider"
5782-
version = "23.0.2"
5782+
version = "24.0.0"
57835783
source = "registry+https://github.com/rust-lang/crates.io-index"
5784-
checksum = "f91d3d13afef569b9fc80cfbb807c87c16ef49bd3ac1a93285ea6a264b600d2d"
5784+
checksum = "36e6cadfa74538edd5409b6f8c79628436529138e9618b7373bec7aae7805835"
57855785

57865786
[[package]]
57875787
name = "wasm-bindgen"
@@ -5840,16 +5840,16 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
58405840

58415841
[[package]]
58425842
name = "wasm-component-ld"
5843-
version = "0.5.6"
5843+
version = "0.5.7"
58445844
source = "registry+https://github.com/rust-lang/crates.io-index"
5845-
checksum = "51449c63d1ce69f92b8465a084ed5b91f1a7eb583fa95796650a6bfcffc4f9cb"
5845+
checksum = "13261270d3ac58ffae0219ae34f297a7e24f9ee3b13b29be579132c588a83519"
58465846
dependencies = [
58475847
"anyhow",
58485848
"clap",
58495849
"lexopt",
58505850
"tempfile",
58515851
"wasi-preview1-component-adapter-provider",
5852-
"wasmparser",
5852+
"wasmparser 0.216.0",
58535853
"wat",
58545854
"wit-component",
58555855
"wit-parser",
@@ -5864,19 +5864,19 @@ dependencies = [
58645864

58655865
[[package]]
58665866
name = "wasm-encoder"
5867-
version = "0.215.0"
5867+
version = "0.216.0"
58685868
source = "registry+https://github.com/rust-lang/crates.io-index"
5869-
checksum = "4fb56df3e06b8e6b77e37d2969a50ba51281029a9aeb3855e76b7f49b6418847"
5869+
checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88"
58705870
dependencies = [
58715871
"leb128",
5872-
"wasmparser",
5872+
"wasmparser 0.216.0",
58735873
]
58745874

58755875
[[package]]
58765876
name = "wasm-metadata"
5877-
version = "0.215.0"
5877+
version = "0.216.0"
58785878
source = "registry+https://github.com/rust-lang/crates.io-index"
5879-
checksum = "0c6bb07c5576b608f7a2a9baa2294c1a3584a249965d695a9814a496cb6d232f"
5879+
checksum = "47c8154d703a6b0e45acf6bd172fa002fc3c7058a9f7615e517220aeca27c638"
58805880
dependencies = [
58815881
"anyhow",
58825882
"indexmap",
@@ -5885,14 +5885,23 @@ dependencies = [
58855885
"serde_json",
58865886
"spdx",
58875887
"wasm-encoder",
5888-
"wasmparser",
5888+
"wasmparser 0.216.0",
58895889
]
58905890

58915891
[[package]]
58925892
name = "wasmparser"
58935893
version = "0.215.0"
58945894
source = "registry+https://github.com/rust-lang/crates.io-index"
58955895
checksum = "53fbde0881f24199b81cf49b6ff8f9c145ac8eb1b7fc439adb5c099734f7d90e"
5896+
dependencies = [
5897+
"bitflags 2.6.0",
5898+
]
5899+
5900+
[[package]]
5901+
name = "wasmparser"
5902+
version = "0.216.0"
5903+
source = "registry+https://github.com/rust-lang/crates.io-index"
5904+
checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3"
58965905
dependencies = [
58975906
"ahash",
58985907
"bitflags 2.6.0",
@@ -5904,9 +5913,9 @@ dependencies = [
59045913

59055914
[[package]]
59065915
name = "wast"
5907-
version = "215.0.0"
5916+
version = "216.0.0"
59085917
source = "registry+https://github.com/rust-lang/crates.io-index"
5909-
checksum = "1ff1d00d893593249e60720be04a7c1f42f1c4dc3806a2869f4e66ab61eb54cb"
5918+
checksum = "f7eb1f2eecd913fdde0dc6c3439d0f24530a98ac6db6cb3d14d92a5328554a08"
59105919
dependencies = [
59115920
"bumpalo",
59125921
"leb128",
@@ -5917,9 +5926,9 @@ dependencies = [
59175926

59185927
[[package]]
59195928
name = "wat"
5920-
version = "1.215.0"
5929+
version = "1.216.0"
59215930
source = "registry+https://github.com/rust-lang/crates.io-index"
5922-
checksum = "670bf4d9c8cf76ae242d70ded47c546525b6dafaa6871f9bcb065344bf2b4e3d"
5931+
checksum = "ac0409090fb5154f95fb5ba3235675fd9e579e731524d63b6a2f653e1280c82a"
59235932
dependencies = [
59245933
"wast",
59255934
]
@@ -6206,9 +6215,9 @@ dependencies = [
62066215

62076216
[[package]]
62086217
name = "wit-component"
6209-
version = "0.215.0"
6218+
version = "0.216.0"
62106219
source = "registry+https://github.com/rust-lang/crates.io-index"
6211-
checksum = "f725e3885fc5890648be5c5cbc1353b755dc932aa5f1aa7de968b912a3280743"
6220+
checksum = "7e2ca3ece38ea2447a9069b43074ba73d96dde1944cba276c54e41371745f9dc"
62126221
dependencies = [
62136222
"anyhow",
62146223
"bitflags 2.6.0",
@@ -6219,15 +6228,15 @@ dependencies = [
62196228
"serde_json",
62206229
"wasm-encoder",
62216230
"wasm-metadata",
6222-
"wasmparser",
6231+
"wasmparser 0.216.0",
62236232
"wit-parser",
62246233
]
62256234

62266235
[[package]]
62276236
name = "wit-parser"
6228-
version = "0.215.0"
6237+
version = "0.216.0"
62296238
source = "registry+https://github.com/rust-lang/crates.io-index"
6230-
checksum = "935a97eaffd57c3b413aa510f8f0b550a4a9fe7d59e79cd8b89a83dcb860321f"
6239+
checksum = "a4d108165c1167a4ccc8a803dcf5c28e0a51d6739fd228cc7adce768632c764c"
62316240
dependencies = [
62326241
"anyhow",
62336242
"id-arena",
@@ -6238,7 +6247,7 @@ dependencies = [
62386247
"serde_derive",
62396248
"serde_json",
62406249
"unicode-xid",
6241-
"wasmparser",
6250+
"wasmparser 0.216.0",
62426251
]
62436252

62446253
[[package]]

RELEASES.md

+114
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,117 @@
1+
Version 1.81.0 (2024-09-05)
2+
==========================
3+
4+
<a id="1.81.0-Language"></a>
5+
6+
Language
7+
--------
8+
9+
- [Abort on uncaught panics in `extern "C"` functions.](https://github.com/rust-lang/rust/pull/116088/)
10+
- [Fix ambiguous cases of multiple `&` in elided self lifetimes.](https://github.com/rust-lang/rust/pull/117967/)
11+
- [Stabilize `#[expect]` for lints (RFC 2383),](https://github.com/rust-lang/rust/pull/120924/) like `#[allow]` with a warning if the lint is _not_ fulfilled.
12+
- [Change method resolution to constrain hidden types instead of rejecting method candidates.](https://github.com/rust-lang/rust/pull/123962/)
13+
- [Bump `elided_lifetimes_in_associated_constant` to deny.](https://github.com/rust-lang/rust/pull/124211/)
14+
- [`offset_from`: always allow pointers to point to the same address.](https://github.com/rust-lang/rust/pull/124921/)
15+
- [Allow constraining opaque types during subtyping in the trait system.](https://github.com/rust-lang/rust/pull/125447/)
16+
- [Allow constraining opaque types during various unsizing casts.](https://github.com/rust-lang/rust/pull/125610/)
17+
- [Deny keyword lifetimes pre-expansion.](https://github.com/rust-lang/rust/pull/126762/)
18+
19+
<a id="1.81.0-Compiler"></a>
20+
21+
Compiler
22+
--------
23+
24+
- [Make casts of pointers to trait objects stricter.](https://github.com/rust-lang/rust/pull/120248/)
25+
- [Check alias args for well-formedness even if they have escaping bound vars.](https://github.com/rust-lang/rust/pull/123737/)
26+
- [Deprecate no-op codegen option `-Cinline-threshold=...`.](https://github.com/rust-lang/rust/pull/124712/)
27+
- [Re-implement a type-size based limit.](https://github.com/rust-lang/rust/pull/125507/)
28+
- [Properly account for alignment in `transmute` size checks.](https://github.com/rust-lang/rust/pull/125740/)
29+
- [Remove the `box_pointers` lint.](https://github.com/rust-lang/rust/pull/126018/)
30+
- [Ensure the interpreter checks bool/char for validity when they are used in a cast.](https://github.com/rust-lang/rust/pull/126265/)
31+
- [Improve coverage instrumentation for functions containing nested items.](https://github.com/rust-lang/rust/pull/127199/)
32+
- Target changes:
33+
- [Add Tier 3 `no_std` Xtensa targets:](https://github.com/rust-lang/rust/pull/125141/) `xtensa-esp32-none-elf`, `xtensa-esp32s2-none-elf`, `xtensa-esp32s3-none-elf`
34+
- [Add Tier 3 `std` Xtensa targets:](https://github.com/rust-lang/rust/pull/126380/) `xtensa-esp32-espidf`, `xtensa-esp32s2-espidf`, `xtensa-esp32s3-espidf`
35+
- [Add Tier 3 i686 Redox OS target:](https://github.com/rust-lang/rust/pull/126192/) `i686-unknown-redox`
36+
- [Promote `arm64ec-pc-windows-msvc` to Tier 2.](https://github.com/rust-lang/rust/pull/126039/)
37+
- [Promote `wasm32-wasip2` to Tier 2.](https://github.com/rust-lang/rust/pull/126967/)
38+
- [Promote `loongarch64-unknown-linux-musl` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/126298/)
39+
- [Enable full tools and profiler for LoongArch Linux targets.](https://github.com/rust-lang/rust/pull/127078/)
40+
- [Unconditionally warn on usage of `wasm32-wasi`.](https://github.com/rust-lang/rust/pull/126662/) (see compatibility note below)
41+
- Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
42+
43+
<a id="1.81.0-Libraries"></a>
44+
45+
Libraries
46+
---------
47+
48+
- [Split core's `PanicInfo` and std's `PanicInfo`.](https://github.com/rust-lang/rust/pull/115974/) (see compatibility note below)
49+
- [Generalize `{Rc,Arc}::make_mut()` to unsized types.](https://github.com/rust-lang/rust/pull/116113/)
50+
- [Replace sort implementations with stable `driftsort` and unstable `ipnsort`.](https://github.com/rust-lang/rust/pull/124032/) All `slice::sort*` and `slice::select_nth*` methods are expected to see significant performance improvements. See the [research project](https://github.com/Voultapher/sort-research-rs) for more details.
51+
- [Document behavior of `create_dir_all` with respect to empty paths.](https://github.com/rust-lang/rust/pull/125112/)
52+
- [Fix interleaved output in the default panic hook when multiple threads panic simultaneously.](https://github.com/rust-lang/rust/pull/127397/)
53+
54+
<a id="1.81.0-Stabilized-APIs"></a>
55+
56+
Stabilized APIs
57+
---------------
58+
59+
- [`core::error`](https://doc.rust-lang.org/stable/core/error/index.html)
60+
- [`hint::assert_unchecked`](https://doc.rust-lang.org/stable/core/hint/fn.assert_unchecked.html)
61+
- [`fs::exists`](https://doc.rust-lang.org/stable/std/fs/fn.exists.html)
62+
- [`AtomicBool::fetch_not`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.fetch_not)
63+
- [`Duration::abs_diff`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.abs_diff)
64+
- [`IoSlice::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance)
65+
- [`IoSlice::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance_slices)
66+
- [`IoSliceMut::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance)
67+
- [`IoSliceMut::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance_slices)
68+
- [`PanicHookInfo`](https://doc.rust-lang.org/stable/std/panic/struct.PanicHookInfo.html)
69+
- [`PanicInfo::message`](https://doc.rust-lang.org/stable/core/panic/struct.PanicInfo.html#method.message)
70+
- [`PanicMessage`](https://doc.rust-lang.org/stable/core/panic/struct.PanicMessage.html)
71+
72+
These APIs are now stable in const contexts:
73+
74+
- [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/char/fn.from_u32_unchecked.html) (function)
75+
- [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.from_u32_unchecked) (method)
76+
- [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes)
77+
- [`CStr::from_ptr`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.from_ptr)
78+
79+
<a id="1.81.0-Cargo"></a>
80+
81+
Cargo
82+
-----
83+
84+
- [Generated `.cargo_vcs_info.json` is always included, even when `--allow-dirty` is passed.](https://github.com/rust-lang/cargo/pull/13960/)
85+
- [Disallow `package.license-file` and `package.readme` pointing to non-existent files during packaging.](https://github.com/rust-lang/cargo/pull/13921/)
86+
- [Disallow passing `--release`/`--debug` flag along with the `--profile` flag.](https://github.com/rust-lang/cargo/pull/13971/)
87+
- [Remove `lib.plugin` key support in `Cargo.toml`. Rust plugin support has been deprecated for four years and was removed in 1.75.0.](https://github.com/rust-lang/cargo/pull/13902/)
88+
89+
<a id="1.81.0-Compatibility-Notes"></a>
90+
91+
Compatibility Notes
92+
-------------------
93+
94+
* Usage of the `wasm32-wasi` target will now issue a compiler warning and request users switch to the `wasm32-wasip1` target instead. Both targets are the same, `wasm32-wasi` is only being renamed, and this [change to the WASI target](https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) is being done to enable removing `wasm32-wasi` in January 2025.
95+
96+
* We have renamed `std::panic::PanicInfo` to `std::panic::PanicHookInfo`. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0.
97+
98+
`core::panic::PanicInfo` will remain unchanged, however, as this is now a *different type*.
99+
100+
The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`.
101+
102+
* The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
103+
104+
<a id="1.81.0-Internal-Changes"></a>
105+
106+
Internal Changes
107+
----------------
108+
109+
These changes do not affect any public interfaces of Rust, but they represent
110+
significant improvements to the performance or internals of rustc and related
111+
tools.
112+
113+
- [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)
114+
1115
Version 1.80.0 (2024-07-25)
2116
==========================
3117

compiler/rustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ tempfile = "3.2"
4141
thin-vec = "0.2.12"
4242
thorin-dwp = "0.7"
4343
tracing = "0.1"
44-
wasm-encoder = "0.215.0"
44+
wasm-encoder = "0.216.0"
4545
# tidy-alphabetical-end
4646

4747
[target.'cfg(unix)'.dependencies]

compiler/rustc_const_eval/messages.ftl

+2-2
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
415415
416416
const_eval_unstable_in_stable =
417417
const-stable function cannot use `#[feature({$gate})]`
418-
.unstable_sugg = if it is not part of the public API, make this function unstably const
419-
.bypass_sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
418+
.unstable_sugg = if the function is not (yet) meant to be stable, make this function unstably const
419+
.bypass_sugg = otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
420420
421421
const_eval_unterminated_c_string =
422422
reading a null-terminated string starting at {$pointer} with no null found before end of allocation

compiler/rustc_const_eval/src/interpret/machine.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -362,17 +362,7 @@ pub trait Machine<'tcx>: Sized {
362362
ecx: &InterpCx<'tcx, Self>,
363363
id: AllocId,
364364
alloc: &'b Allocation,
365-
) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>>>
366-
{
367-
// The default implementation does a copy; CTFE machines have a more efficient implementation
368-
// based on their particular choice for `Provenance`, `AllocExtra`, and `Bytes`.
369-
let kind = Self::GLOBAL_KIND
370-
.expect("if GLOBAL_KIND is None, adjust_global_allocation must be overwritten");
371-
let alloc = alloc.adjust_from_tcx(&ecx.tcx, |ptr| ecx.global_root_pointer(ptr))?;
372-
let extra =
373-
Self::init_alloc_extra(ecx, id, MemoryKind::Machine(kind), alloc.size(), alloc.align)?;
374-
Ok(Cow::Owned(alloc.with_extra(extra)))
375-
}
365+
) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>>>;
376366

377367
/// Initialize the extra state of an allocation.
378368
///

compiler/rustc_middle/src/mir/interpret/allocation.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,11 @@ impl Allocation {
358358
pub fn adjust_from_tcx<Prov: Provenance, Bytes: AllocBytes, Err>(
359359
&self,
360360
cx: &impl HasDataLayout,
361+
mut alloc_bytes: impl FnMut(&[u8], Align) -> Result<Bytes, Err>,
361362
mut adjust_ptr: impl FnMut(Pointer<CtfeProvenance>) -> Result<Pointer<Prov>, Err>,
362363
) -> Result<Allocation<Prov, (), Bytes>, Err> {
363364
// Copy the data.
364-
let mut bytes = Bytes::from_bytes(Cow::Borrowed(&*self.bytes), self.align);
365+
let mut bytes = alloc_bytes(&*self.bytes, self.align)?;
365366
// Adjust provenance of pointers stored in this allocation.
366367
let mut new_provenance = Vec::with_capacity(self.provenance.ptrs().len());
367368
let ptr_size = cx.data_layout().pointer_size.bytes_usize();

compiler/rustc_passes/src/stability.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,8 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
544544
let is_stable =
545545
self.tcx.lookup_stability(def_id).is_some_and(|stability| stability.level.is_stable());
546546
let missing_const_stability_attribute = self.tcx.lookup_const_stability(def_id).is_none();
547-
let is_reachable = self.effective_visibilities.is_reachable(def_id);
548547

549-
if is_const && is_stable && missing_const_stability_attribute && is_reachable {
548+
if is_const && is_stable && missing_const_stability_attribute {
550549
let descr = self.tcx.def_descr(def_id.to_def_id());
551550
self.tcx.dcx().emit_err(errors::MissingConstStabAttr { span, descr });
552551
}

library/core/src/mem/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ pub const fn needs_drop<T: ?Sized>() -> bool {
612612
///
613613
/// There is no guarantee that an all-zero byte-pattern represents a valid value
614614
/// of some type `T`. For example, the all-zero byte-pattern is not a valid value
615-
/// for reference types (`&T`, `&mut T`) and functions pointers. Using `zeroed`
615+
/// for reference types (`&T`, `&mut T`) and function pointers. Using `zeroed`
616616
/// on such types causes immediate [undefined behavior][ub] because [the Rust
617617
/// compiler assumes][inv] that there always is a valid value in a variable it
618618
/// considers initialized.

0 commit comments

Comments
 (0)