Skip to content

Commit 703154d

Browse files
committed
Merge from rustc
2 parents acdf913 + d0e7bfd commit 703154d

File tree

130 files changed

+4404
-3361
lines changed

Some content is hidden

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

130 files changed

+4404
-3361
lines changed

Cargo.lock

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6195,16 +6195,11 @@ dependencies = [
61956195

61966196
[[package]]
61976197
name = "windows-bindgen"
6198-
version = "0.58.0"
6198+
version = "0.59.0"
61996199
source = "registry+https://github.com/rust-lang/crates.io-index"
6200-
checksum = "91cd28d93c692351f3a6e5615567c56756e330bee1c99c6bdd57bfc5ab15f589"
6200+
checksum = "9b7fb600834d7e868f6e5bb748a86101427330fafbf9485c331b9d5f562d54a5"
62016201
dependencies = [
6202-
"proc-macro2",
62036202
"rayon",
6204-
"serde",
6205-
"serde_json",
6206-
"syn 2.0.96",
6207-
"windows-metadata",
62086203
]
62096204

62106205
[[package]]
@@ -6285,12 +6280,6 @@ dependencies = [
62856280
"syn 2.0.96",
62866281
]
62876282

6288-
[[package]]
6289-
name = "windows-metadata"
6290-
version = "0.58.0"
6291-
source = "registry+https://github.com/rust-lang/crates.io-index"
6292-
checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809"
6293-
62946283
[[package]]
62956284
name = "windows-result"
62966285
version = "0.1.2"

RELEASES.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,130 @@
1+
Version 1.85.0 (2025-02-20)
2+
==========================
3+
4+
<a id="1.85.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [The 2024 Edition is now stable.](https://github.com/rust-lang/rust/pull/133349)
9+
See [the edition guide](https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html) for more details.
10+
- [Stabilize async closures](https://github.com/rust-lang/rust/pull/132706)
11+
See [RFC 3668](https://rust-lang.github.io/rfcs/3668-async-closures.html) for more details.
12+
- [Stabilize `#[diagnostic::do_not_recommend]`](https://github.com/rust-lang/rust/pull/132056)
13+
- [Add `unpredictable_function_pointer_comparisons` lint to warn against function pointer comparisons](https://github.com/rust-lang/rust/pull/118833)
14+
- [Lint on combining `#[no_mangle]` and `#[export_name]` attributes.](https://github.com/rust-lang/rust/pull/131558)
15+
16+
<a id="1.85.0-Compiler"></a>
17+
18+
Compiler
19+
--------
20+
- [The unstable flag `-Zpolymorphize` has been removed](https://github.com/rust-lang/rust/pull/133883), see https://github.com/rust-lang/compiler-team/issues/810 for some background.
21+
22+
<a id="1.85.0-Platform-Support"></a>
23+
24+
Platform Support
25+
----------------
26+
- [Promote `powerpc64le-unknown-linux-musl` to tier 2 with host tools](https://github.com/rust-lang/rust/pull/133801)
27+
28+
Refer to Rust's [platform support page][platform-support-doc]
29+
for more information on Rust's tiered platform support.
30+
31+
<a id="1.85.0-Libraries"></a>
32+
33+
Libraries
34+
---------
35+
- [Panics in the standard library now have a leading `library/` in their path](https://github.com/rust-lang/rust/pull/132390)
36+
- [`std::env::home_dir()` on Windows now ignores the non-standard `$HOME` environment variable](https://github.com/rust-lang/rust/pull/132515)
37+
It will be un-deprecated in a subsequent release.
38+
- [Add `AsyncFn*` to the prelude in all editions.](https://github.com/rust-lang/rust/pull/132611)
39+
40+
<a id="1.85.0-Stabilized-APIs"></a>
41+
42+
Stabilized APIs
43+
---------------
44+
45+
- [`BuildHasherDefault::new`](https://doc.rust-lang.org/stable/std/hash/struct.BuildHasherDefault.html#method.new)
46+
- [`ptr::fn_addr_eq`](https://doc.rust-lang.org/std/ptr/fn.fn_addr_eq.html)
47+
- [`io::ErrorKind::QuotaExceeded`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.QuotaExceeded)
48+
- [`io::ErrorKind::CrossesDevices`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.CrossesDevices)
49+
- [`{float}::midpoint`](https://doc.rust-lang.org/core/primitive.f32.html#method.midpoint)
50+
- [Unsigned `{integer}::midpoint`](https://doc.rust-lang.org/std/primitive.u64.html#method.midpoint)
51+
- [`NonZeroU*::midpoint`](https://doc.rust-lang.org/std/num/type.NonZeroU32.html#method.midpoint)
52+
- [impl `std::iter::Extend` for tuples with arity 1 through 12](https://doc.rust-lang.org/stable/std/iter/trait.Extend.html#impl-Extend%3C(A,)%3E-for-(EA,))
53+
- [`FromIterator<(A, ...)>` for tuples with arity 1 through 12](https://doc.rust-lang.org/stable/std/iter/trait.FromIterator.html#impl-FromIterator%3C(EA,)%3E-for-(A,))
54+
- [`std::task::Waker::noop`](https://doc.rust-lang.org/stable/std/task/struct.Waker.html#method.noop)
55+
56+
These APIs are now stable in const contexts:
57+
58+
- [`mem::size_of_val`](https://doc.rust-lang.org/stable/std/mem/fn.size_of_val.html)
59+
- [`mem::align_of_val`](https://doc.rust-lang.org/stable/std/mem/fn.align_of_val.html)
60+
- [`Layout::for_value`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.for_value)
61+
- [`Layout::align_to`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.align_to)
62+
- [`Layout::pad_to_align`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.pad_to_align)
63+
- [`Layout::extend`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.extend)
64+
- [`Layout::array`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.array)
65+
- [`std::mem::swap`](https://doc.rust-lang.org/stable/std/mem/fn.swap.html)
66+
- [`std::ptr::swap`](https://doc.rust-lang.org/stable/std/ptr/fn.swap.html)
67+
- [`NonNull::new`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.new)
68+
- [`HashMap::with_hasher`](https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html#method.with_hasher)
69+
- [`HashSet::with_hasher`](https://doc.rust-lang.org/stable/std/collections/struct.HashSet.html#method.with_hasher)
70+
- [`BuildHasherDefault::new`](https://doc.rust-lang.org/stable/std/hash/struct.BuildHasherDefault.html#method.new)
71+
- [`<float>::recip`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.recip)
72+
- [`<float>::to_degrees`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.to_degrees)
73+
- [`<float>::to_radians`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.to_radians)
74+
- [`<float>::max`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.max)
75+
- [`<float>::min`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.min)
76+
- [`<float>::clamp`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.clamp)
77+
- [`<float>::abs`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.abs)
78+
- [`<float>::signum`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.signum)
79+
- [`<float>::copysign`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.copysign)
80+
- [`MaybeUninit::write`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.write)
81+
82+
<a id="1.85.0-Cargo"></a>
83+
84+
Cargo
85+
-----
86+
- [Add future-incompatibility warning against keywords in cfgs and add raw-idents](https://github.com/rust-lang/cargo/pull/14671/)
87+
- [Stabilize higher precedence trailing flags](https://github.com/rust-lang/cargo/pull/14900/)
88+
- [Pass `CARGO_CFG_FEATURE` to build scripts](https://github.com/rust-lang/cargo/pull/14902/)
89+
90+
<a id="1.85.0-Rustdoc"></a>
91+
92+
Rustdoc
93+
-----
94+
- [Doc comment on impl blocks shows the first line, even when the impl block is collapsed](https://github.com/rust-lang/rust/pull/132155)
95+
96+
<a id="1.85.0-Compatibility-Notes"></a>
97+
98+
Compatibility Notes
99+
-------------------
100+
- [`rustc` no longer treats the `test` cfg as a well known check-cfg](https://github.com/rust-lang/rust/pull/131729), instead it is up to the build systems and users of `--check-cfg`[^check-cfg] to set it as a well known cfg using `--check-cfg=cfg(test)`.
101+
This is done to enable build systems like Cargo to set it conditionally, as not all source files are suitable for unit tests.
102+
[Cargo (for now) unconditionally sets the `test` cfg as a well known cfg](https://github.com/rust-lang/cargo/pull/14963).
103+
[^check-cfg]: https://doc.rust-lang.org/nightly/rustc/check-cfg.html
104+
- [Disable potentially incorrect type inference if there are trivial and non-trivial where-clauses](https://github.com/rust-lang/rust/pull/132325)
105+
- `std::env::home_dir()` has been deprecated for years, because it can give surprising results in some Windows configurations if the `HOME` environment variable is set (which is not the normal configuration on Windows). We had previously avoided changing its behavior, out of concern for compatibility with code depending on this non-standard configuration. Given how long this function has been deprecated, we're now fixing its behavior as a bugfix. A subsequent release will remove the deprecation for this function.
106+
- [Make `core::ffi::c_char` signedness more closely match that of the platform-default `char`](https://github.com/rust-lang/rust/pull/132975)
107+
This changed `c_char` from an `i8` to `u8` or vice versa on many Tier 2 and 3
108+
targets (mostly Arm and RISC-V embedded targets). The new definition may
109+
result in compilation failures but fixes compatibility issues with C.
110+
The `libc` crate matches this change as of its 0.2.169 release.
111+
- [When compiling a nested `macro_rules` macro from an external crate, the content of the inner `macro_rules` is now built with the edition of the external crate, not the local crate.](https://github.com/rust-lang/rust/pull/133274)
112+
- [Increase `sparcv9-sun-solaris` and `x86_64-pc-solaris` Solaris baseline to 11.4.](https://github.com/rust-lang/rust/pull/133293)
113+
- [Show `abi_unsupported_vector_types` lint in future breakage reports](https://github.com/rust-lang/rust/pull/133374)
114+
- [Error if multiple super-trait instantiations of `dyn Trait` need associated types to be specified but only one is provided](https://github.com/rust-lang/rust/pull/133392)
115+
- [Change `powerpc64-ibm-aix` default `codemodel` to large](https://github.com/rust-lang/rust/pull/133811)
116+
117+
<a id="1.85.0-Internal-Changes"></a>
118+
119+
Internal Changes
120+
----------------
121+
122+
These changes do not affect any public interfaces of Rust, but they represent
123+
significant improvements to the performance or internals of rustc and related
124+
tools.
125+
126+
- [Build `x86_64-unknown-linux-gnu` with LTO for C/C++ code (e.g., `jemalloc`)](https://github.com/rust-lang/rust/pull/134690)
127+
1128
Version 1.84.1 (2025-01-30)
2129
==========================
3130

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,20 +424,23 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
424424
self.ann_post(ident)
425425
}
426426

427-
fn strsep<T, F>(
427+
fn strsep<'x, T: 'x, F, I>(
428428
&mut self,
429429
sep: &'static str,
430430
space_before: bool,
431431
b: Breaks,
432-
elts: &[T],
432+
elts: I,
433433
mut op: F,
434434
) where
435435
F: FnMut(&mut Self, &T),
436+
I: IntoIterator<Item = &'x T>,
436437
{
438+
let mut it = elts.into_iter();
439+
437440
self.rbox(0, b);
438-
if let Some((first, rest)) = elts.split_first() {
441+
if let Some(first) = it.next() {
439442
op(self, first);
440-
for elt in rest {
443+
for elt in it {
441444
if space_before {
442445
self.space();
443446
}
@@ -448,9 +451,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
448451
self.end();
449452
}
450453

451-
fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F)
454+
fn commasep<'x, T: 'x, F, I>(&mut self, b: Breaks, elts: I, op: F)
452455
where
453456
F: FnMut(&mut Self, &T),
457+
I: IntoIterator<Item = &'x T>,
454458
{
455459
self.strsep(",", false, b, elts, op)
456460
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ jobs:
188188
fail-fast: false
189189
matrix:
190190
include:
191-
# FIXME update at some point in the future once most distros use a newer glibc
192-
- os: ubuntu-20.04
191+
# Intentionally using an older ubuntu version to lower the glibc requirements of the distributed cg_clif
192+
- os: ubuntu-22.04
193193
env:
194194
TARGET_TRIPLE: x86_64-unknown-linux-gnu
195195
- os: macos-latest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2025-02-07"
2+
channel = "nightly-2025-02-15"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
44
profile = "minimal"

compiler/rustc_codegen_cranelift/rustfmt.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ ignore = [
33
]
44

55
# Matches rustfmt.toml of rustc
6-
version = "Two"
6+
style_edition = "2024"
77
use_small_heuristics = "Max"
88
merge_derives = false
99
group_imports = "StdExternalCrate"
1010
imports_granularity = "Module"
11+
use_field_init_shorthand = true

compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ pub(super) fn from_casted_value<'tcx>(
195195
// It may also be smaller for example when the type is a wrapper around an integer with a
196196
// larger alignment than the integer.
197197
std::cmp::max(abi_param_size, layout_size),
198-
u32::try_from(layout.align.pref.bytes()).unwrap(),
198+
u32::try_from(layout.align.abi.bytes()).unwrap(),
199199
);
200200
let mut offset = 0;
201201
let mut block_params_iter = block_params.iter().copied();

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
382382
}
383383

384384
pub(crate) fn create_stack_slot(&mut self, size: u32, align: u32) -> Pointer {
385+
assert!(
386+
size % align == 0,
387+
"size must be a multiple of alignment (size={size}, align={align})"
388+
);
389+
385390
let abi_align = if self.tcx.sess.target.arch == "s390x" { 8 } else { 16 };
386391
if align <= abi_align {
387392
let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData {
@@ -403,7 +408,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
403408
align_shift: 4,
404409
});
405410
let base_ptr = self.bcx.ins().stack_addr(self.pointer_type, stack_slot, 0);
406-
let misalign_offset = self.bcx.ins().urem_imm(base_ptr, i64::from(align));
411+
let misalign_offset = self.bcx.ins().band_imm(base_ptr, i64::from(align - 1));
407412
let realign_offset = self.bcx.ins().irsub_imm(misalign_offset, i64::from(align));
408413
Pointer::new(self.bcx.ins().iadd(base_ptr, realign_offset))
409414
}

compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl DebugContext {
304304
entry.set(gimli::DW_AT_decl_file, AttributeValue::FileIndex(Some(file_id)));
305305
entry.set(gimli::DW_AT_decl_line, AttributeValue::Udata(line));
306306

307-
entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(static_layout.align.pref.bytes()));
307+
entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(static_layout.align.abi.bytes()));
308308

309309
let mut expr = Expression::new();
310310
expr.op_addr(address_for_data(data_id));

compiler/rustc_codegen_cranelift/src/debuginfo/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl DebugContext {
166166
let tuple_entry = self.dwarf.unit.get_mut(tuple_type_id);
167167
tuple_entry.set(gimli::DW_AT_name, AttributeValue::StringRef(self.dwarf.strings.add(name)));
168168
tuple_entry.set(gimli::DW_AT_byte_size, AttributeValue::Udata(layout.size.bytes()));
169-
tuple_entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(layout.align.pref.bytes()));
169+
tuple_entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(layout.align.abi.bytes()));
170170

171171
for (i, (ty, dw_ty)) in components.into_iter().enumerate() {
172172
let member_id = self.dwarf.unit.add(tuple_type_id, gimli::DW_TAG_member);
@@ -179,7 +179,7 @@ impl DebugContext {
179179
member_entry.set(
180180
gimli::DW_AT_alignment,
181181
AttributeValue::Udata(
182-
FullyMonomorphizedLayoutCx(tcx).layout_of(ty).align.pref.bytes(),
182+
FullyMonomorphizedLayoutCx(tcx).layout_of(ty).align.abi.bytes(),
183183
),
184184
);
185185
member_entry.set(

compiler/rustc_codegen_cranelift/src/inline_asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,8 @@ fn call_inline_asm<'tcx>(
871871
inputs: Vec<(Size, Value)>,
872872
outputs: Vec<(Size, CPlace<'tcx>)>,
873873
) {
874-
let stack_slot = fx.create_stack_slot(u32::try_from(slot_size.bytes()).unwrap(), 16);
874+
let stack_slot =
875+
fx.create_stack_slot(u32::try_from(slot_size.bytes().next_multiple_of(16)).unwrap(), 16);
875876

876877
let inline_asm_func = fx
877878
.module

compiler/rustc_codegen_cranelift/src/value_and_place.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'tcx> CValue<'tcx> {
101101
/// The is represented by a dangling pointer of suitable alignment.
102102
pub(crate) fn zst(layout: TyAndLayout<'tcx>) -> CValue<'tcx> {
103103
assert!(layout.is_zst());
104-
CValue::by_ref(crate::Pointer::dangling(layout.align.pref), layout)
104+
CValue::by_ref(crate::Pointer::dangling(layout.align.abi), layout)
105105
}
106106

107107
pub(crate) fn layout(&self) -> TyAndLayout<'tcx> {
@@ -392,7 +392,7 @@ impl<'tcx> CPlace<'tcx> {
392392
assert!(layout.is_sized());
393393
if layout.size.bytes() == 0 {
394394
return CPlace {
395-
inner: CPlaceInner::Addr(Pointer::dangling(layout.align.pref), None),
395+
inner: CPlaceInner::Addr(Pointer::dangling(layout.align.abi), None),
396396
layout,
397397
};
398398
}
@@ -405,7 +405,7 @@ impl<'tcx> CPlace<'tcx> {
405405

406406
let stack_slot = fx.create_stack_slot(
407407
u32::try_from(layout.size.bytes()).unwrap(),
408-
u32::try_from(layout.align.pref.bytes()).unwrap(),
408+
u32::try_from(layout.align.abi.bytes()).unwrap(),
409409
);
410410
CPlace { inner: CPlaceInner::Addr(stack_slot, None), layout }
411411
}

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ pub(crate) unsafe fn create_module<'ll>(
194194
target_data_layout = target_data_layout.replace("-i128:128", "");
195195
}
196196
}
197+
if llvm_version < (21, 0, 0) {
198+
if sess.target.arch == "nvptx64" {
199+
// LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961
200+
target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
201+
}
202+
}
197203

198204
// Ensure the data-layout values hardcoded remain the defaults.
199205
{

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,7 @@ fn exported_symbols_for_non_proc_macro(tcx: TyCtxt<'_>, crate_type: CrateType) -
17761776
symbols.push(symbol_export::exporting_symbol_name_for_instance_in_crate(
17771777
tcx, symbol, cnum,
17781778
));
1779+
symbol_export::extend_exported_symbols(&mut symbols, tcx, symbol, cnum);
17791780
}
17801781
});
17811782

0 commit comments

Comments
 (0)