Skip to content

Commit 4229b80

Browse files
committed
Auto merge of rust-lang#137111 - jhpratt:rollup-izd98sx, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang#135797 (Import initial generated 1.85 relnotes) - rust-lang#135909 (Export kernel descriptor for amdgpu kernels) - rust-lang#136545 (nvptx64: update default alignment to match LLVM 21) - rust-lang#137092 (abi_unsupported_vector_types: say which type is the problem) - rust-lang#137097 (Ignore Self in bounds check for associated types with Self:Sized) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c3fe9e7 + 7884e17 commit 4229b80

22 files changed

+372
-157
lines changed

RELEASES.md

+127
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_codegen_llvm/src/context.rs

+6
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

+1
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

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

+60-32
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use rustc_middle::middle::exported_symbols::{
1010
ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel, metadata_symbol_name,
1111
};
1212
use rustc_middle::query::LocalCrate;
13-
use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, TyCtxt};
13+
use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, Ty, TyCtxt};
1414
use rustc_middle::util::Providers;
1515
use rustc_session::config::{CrateType, OomStrategy};
16+
use rustc_target::callconv::Conv;
1617
use rustc_target::spec::{SanitizerSet, TlsModel};
1718
use tracing::debug;
1819

@@ -584,6 +585,42 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
584585
}
585586
}
586587

588+
fn calling_convention_for_symbol<'tcx>(
589+
tcx: TyCtxt<'tcx>,
590+
symbol: ExportedSymbol<'tcx>,
591+
) -> (Conv, &'tcx [rustc_target::callconv::ArgAbi<'tcx, Ty<'tcx>>]) {
592+
let instance = match symbol {
593+
ExportedSymbol::NonGeneric(def_id) | ExportedSymbol::Generic(def_id, _)
594+
if tcx.is_static(def_id) =>
595+
{
596+
None
597+
}
598+
ExportedSymbol::NonGeneric(def_id) => Some(Instance::mono(tcx, def_id)),
599+
ExportedSymbol::Generic(def_id, args) => Some(Instance::new(def_id, args)),
600+
// DropGlue always use the Rust calling convention and thus follow the target's default
601+
// symbol decoration scheme.
602+
ExportedSymbol::DropGlue(..) => None,
603+
// AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
604+
// target's default symbol decoration scheme.
605+
ExportedSymbol::AsyncDropGlueCtorShim(..) => None,
606+
// NoDefId always follow the target's default symbol decoration scheme.
607+
ExportedSymbol::NoDefId(..) => None,
608+
// ThreadLocalShim always follow the target's default symbol decoration scheme.
609+
ExportedSymbol::ThreadLocalShim(..) => None,
610+
};
611+
612+
instance
613+
.map(|i| {
614+
tcx.fn_abi_of_instance(
615+
ty::TypingEnv::fully_monomorphized().as_query_input((i, ty::List::empty())),
616+
)
617+
.unwrap_or_else(|_| bug!("fn_abi_of_instance({i:?}) failed"))
618+
})
619+
.map(|fnabi| (fnabi.conv, &fnabi.args[..]))
620+
// FIXME(workingjubilee): why don't we know the convention here?
621+
.unwrap_or((Conv::Rust, &[]))
622+
}
623+
587624
/// This is the symbol name of the given instance as seen by the linker.
588625
///
589626
/// On 32-bit Windows symbols are decorated according to their calling conventions.
@@ -592,8 +629,6 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
592629
symbol: ExportedSymbol<'tcx>,
593630
instantiating_crate: CrateNum,
594631
) -> String {
595-
use rustc_target::callconv::Conv;
596-
597632
let mut undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate);
598633

599634
// thread local will not be a function call,
@@ -617,35 +652,7 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
617652
_ => return undecorated,
618653
};
619654

620-
let instance = match symbol {
621-
ExportedSymbol::NonGeneric(def_id) | ExportedSymbol::Generic(def_id, _)
622-
if tcx.is_static(def_id) =>
623-
{
624-
None
625-
}
626-
ExportedSymbol::NonGeneric(def_id) => Some(Instance::mono(tcx, def_id)),
627-
ExportedSymbol::Generic(def_id, args) => Some(Instance::new(def_id, args)),
628-
// DropGlue always use the Rust calling convention and thus follow the target's default
629-
// symbol decoration scheme.
630-
ExportedSymbol::DropGlue(..) => None,
631-
// AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the
632-
// target's default symbol decoration scheme.
633-
ExportedSymbol::AsyncDropGlueCtorShim(..) => None,
634-
// NoDefId always follow the target's default symbol decoration scheme.
635-
ExportedSymbol::NoDefId(..) => None,
636-
// ThreadLocalShim always follow the target's default symbol decoration scheme.
637-
ExportedSymbol::ThreadLocalShim(..) => None,
638-
};
639-
640-
let (conv, args) = instance
641-
.map(|i| {
642-
tcx.fn_abi_of_instance(
643-
ty::TypingEnv::fully_monomorphized().as_query_input((i, ty::List::empty())),
644-
)
645-
.unwrap_or_else(|_| bug!("fn_abi_of_instance({i:?}) failed"))
646-
})
647-
.map(|fnabi| (fnabi.conv, &fnabi.args[..]))
648-
.unwrap_or((Conv::Rust, &[]));
655+
let (conv, args) = calling_convention_for_symbol(tcx, symbol);
649656

650657
// Decorate symbols with prefixes, suffixes and total number of bytes of arguments.
651658
// Reference: https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170
@@ -677,6 +684,27 @@ pub(crate) fn exporting_symbol_name_for_instance_in_crate<'tcx>(
677684
maybe_emutls_symbol_name(tcx, symbol, &undecorated).unwrap_or(undecorated)
678685
}
679686

687+
/// On amdhsa, `gpu-kernel` functions have an associated metadata object with a `.kd` suffix.
688+
/// Add it to the symbols list for all kernel functions, so that it is exported in the linked
689+
/// object.
690+
pub(crate) fn extend_exported_symbols<'tcx>(
691+
symbols: &mut Vec<String>,
692+
tcx: TyCtxt<'tcx>,
693+
symbol: ExportedSymbol<'tcx>,
694+
instantiating_crate: CrateNum,
695+
) {
696+
let (conv, _) = calling_convention_for_symbol(tcx, symbol);
697+
698+
if conv != Conv::GpuKernel || tcx.sess.target.os != "amdhsa" {
699+
return;
700+
}
701+
702+
let undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate);
703+
704+
// Add the symbol for the kernel descriptor (with .kd suffix)
705+
symbols.push(format!("{undecorated}.kd"));
706+
}
707+
680708
fn maybe_emutls_symbol_name<'tcx>(
681709
tcx: TyCtxt<'tcx>,
682710
symbol: ExportedSymbol<'tcx>,

compiler/rustc_monomorphize/messages.ftl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
monomorphize_abi_error_disabled_vector_type_call =
2-
this function call uses a SIMD vector type that (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled in the caller
2+
this function call uses SIMD vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled in the caller
33
.label = function called here
44
.help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`)
55
monomorphize_abi_error_disabled_vector_type_def =
6-
this function definition uses a SIMD vector type that (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled
6+
this function definition uses SIMD vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled
77
.label = function defined here
88
.help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`)
99
1010
monomorphize_abi_error_unsupported_vector_type_call =
11-
this function call uses a SIMD vector type that is not currently supported with the chosen ABI
11+
this function call uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI
1212
.label = function called here
1313
monomorphize_abi_error_unsupported_vector_type_def =
14-
this function definition uses a SIMD vector type that is not currently supported with the chosen ABI
14+
this function definition uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI
1515
.label = function defined here
1616
1717
monomorphize_couldnt_dump_mono_stats =

compiler/rustc_monomorphize/src/errors.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::path::PathBuf;
22

33
use rustc_macros::{Diagnostic, LintDiagnostic};
4+
use rustc_middle::ty::Ty;
45
use rustc_span::{Span, Symbol};
56

67
#[derive(Diagnostic)]
@@ -75,6 +76,7 @@ pub(crate) struct AbiErrorDisabledVectorTypeDef<'a> {
7576
#[label]
7677
pub span: Span,
7778
pub required_feature: &'a str,
79+
pub ty: Ty<'a>,
7880
}
7981

8082
#[derive(LintDiagnostic)]
@@ -84,18 +86,21 @@ pub(crate) struct AbiErrorDisabledVectorTypeCall<'a> {
8486
#[label]
8587
pub span: Span,
8688
pub required_feature: &'a str,
89+
pub ty: Ty<'a>,
8790
}
8891

8992
#[derive(LintDiagnostic)]
9093
#[diag(monomorphize_abi_error_unsupported_vector_type_def)]
91-
pub(crate) struct AbiErrorUnsupportedVectorTypeDef {
94+
pub(crate) struct AbiErrorUnsupportedVectorTypeDef<'a> {
9295
#[label]
9396
pub span: Span,
97+
pub ty: Ty<'a>,
9498
}
9599

96100
#[derive(LintDiagnostic)]
97101
#[diag(monomorphize_abi_error_unsupported_vector_type_call)]
98-
pub(crate) struct AbiErrorUnsupportedVectorTypeCall {
102+
pub(crate) struct AbiErrorUnsupportedVectorTypeCall<'a> {
99103
#[label]
100104
pub span: Span,
105+
pub ty: Ty<'a>,
101106
}

0 commit comments

Comments
 (0)