Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 93257e2

Browse files
committedMar 13, 2025·
Auto merge of #138450 - matthiaskrgr:rollup-4im25vf, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #137816 (attempt to support `BinaryFormat::Xcoff` in `naked_asm!`) - #138109 (make precise capturing args in rustdoc Json typed) - #138343 (Enable `f16` tests for `powf`) - #138356 (bump libc to 0.2.171 to fix xous) - #138371 (Update compiletest's `has_asm_support` to match rustc) - #138404 (Cleanup sysroot locating a bit) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a2aba05 + ad23e9d commit 93257e2

File tree

33 files changed

+269
-128
lines changed

33 files changed

+269
-128
lines changed
 

‎compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3838
}
3939
if let Some(asm_arch) = asm_arch {
4040
// Inline assembly is currently only stable for these architectures.
41+
// (See also compiletest's `has_asm_support`.)
4142
let is_stable = matches!(
4243
asm_arch,
4344
asm::InlineAsmArch::X86

‎compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,7 @@ fn link_sanitizer_runtime(
12881288
if path.exists() {
12891289
sess.target_tlib_path.dir.clone()
12901290
} else {
1291-
let default_sysroot =
1292-
filesearch::get_or_default_sysroot().expect("Failed finding sysroot");
1291+
let default_sysroot = filesearch::get_or_default_sysroot();
12931292
let default_tlib =
12941293
filesearch::make_target_lib_path(&default_sysroot, sess.opts.target_triple.tuple());
12951294
default_tlib

‎compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ fn prefix_and_suffix<'tcx>(
125125
// the alignment from a `#[repr(align(<n>))]` is used if it specifies a higher alignment.
126126
// if no alignment is specified, an alignment of 4 bytes is used.
127127
let min_function_alignment = tcx.sess.opts.unstable_opts.min_function_alignment;
128-
let align = Ord::max(min_function_alignment, attrs.alignment).map(|a| a.bytes()).unwrap_or(4);
128+
let align_bytes =
129+
Ord::max(min_function_alignment, attrs.alignment).map(|a| a.bytes()).unwrap_or(4);
129130

130131
// In particular, `.arm` can also be written `.code 32` and `.thumb` as `.code 16`.
131132
let (arch_prefix, arch_suffix) = if is_arm {
@@ -157,12 +158,16 @@ fn prefix_and_suffix<'tcx>(
157158
}
158159
Linkage::LinkOnceAny | Linkage::LinkOnceODR | Linkage::WeakAny | Linkage::WeakODR => {
159160
match asm_binary_format {
160-
BinaryFormat::Elf
161-
| BinaryFormat::Coff
162-
| BinaryFormat::Wasm
163-
| BinaryFormat::Xcoff => {
161+
BinaryFormat::Elf | BinaryFormat::Coff | BinaryFormat::Wasm => {
164162
writeln!(w, ".weak {asm_name}")?;
165163
}
164+
BinaryFormat::Xcoff => {
165+
// FIXME: there is currently no way of defining a weak symbol in inline assembly
166+
// for AIX. See https://github.com/llvm/llvm-project/issues/130269
167+
emit_fatal(
168+
"cannot create weak symbols from inline assembly for this target",
169+
)
170+
}
166171
BinaryFormat::MachO => {
167172
writeln!(w, ".globl {asm_name}")?;
168173
writeln!(w, ".weak_definition {asm_name}")?;
@@ -189,7 +194,7 @@ fn prefix_and_suffix<'tcx>(
189194
let mut begin = String::new();
190195
let mut end = String::new();
191196
match asm_binary_format {
192-
BinaryFormat::Elf | BinaryFormat::Xcoff => {
197+
BinaryFormat::Elf => {
193198
let section = link_section.unwrap_or(format!(".text.{asm_name}"));
194199

195200
let progbits = match is_arm {
@@ -203,7 +208,7 @@ fn prefix_and_suffix<'tcx>(
203208
};
204209

205210
writeln!(begin, ".pushsection {section},\"ax\", {progbits}").unwrap();
206-
writeln!(begin, ".balign {align}").unwrap();
211+
writeln!(begin, ".balign {align_bytes}").unwrap();
207212
write_linkage(&mut begin).unwrap();
208213
if let Visibility::Hidden = item_data.visibility {
209214
writeln!(begin, ".hidden {asm_name}").unwrap();
@@ -224,7 +229,7 @@ fn prefix_and_suffix<'tcx>(
224229
BinaryFormat::MachO => {
225230
let section = link_section.unwrap_or("__TEXT,__text".to_string());
226231
writeln!(begin, ".pushsection {},regular,pure_instructions", section).unwrap();
227-
writeln!(begin, ".balign {align}").unwrap();
232+
writeln!(begin, ".balign {align_bytes}").unwrap();
228233
write_linkage(&mut begin).unwrap();
229234
if let Visibility::Hidden = item_data.visibility {
230235
writeln!(begin, ".private_extern {asm_name}").unwrap();
@@ -240,7 +245,7 @@ fn prefix_and_suffix<'tcx>(
240245
BinaryFormat::Coff => {
241246
let section = link_section.unwrap_or(format!(".text.{asm_name}"));
242247
writeln!(begin, ".pushsection {},\"xr\"", section).unwrap();
243-
writeln!(begin, ".balign {align}").unwrap();
248+
writeln!(begin, ".balign {align_bytes}").unwrap();
244249
write_linkage(&mut begin).unwrap();
245250
writeln!(begin, ".def {asm_name}").unwrap();
246251
writeln!(begin, ".scl 2").unwrap();
@@ -279,6 +284,33 @@ fn prefix_and_suffix<'tcx>(
279284
// .size is ignored for function symbols, so we can skip it
280285
writeln!(end, "end_function").unwrap();
281286
}
287+
BinaryFormat::Xcoff => {
288+
// the LLVM XCOFFAsmParser is extremely incomplete and does not implement many of the
289+
// documented directives.
290+
//
291+
// - https://github.com/llvm/llvm-project/blob/1b25c0c4da968fe78921ce77736e5baef4db75e3/llvm/lib/MC/MCParser/XCOFFAsmParser.cpp
292+
// - https://www.ibm.com/docs/en/ssw_aix_71/assembler/assembler_pdf.pdf
293+
//
294+
// Consequently, we try our best here but cannot do as good a job as for other binary
295+
// formats.
296+
297+
// FIXME: start a section. `.csect` is not currently implemented in LLVM
298+
299+
// fun fact: according to the assembler documentation, .align takes an exponent,
300+
// but LLVM only accepts powers of 2 (but does emit the exponent)
301+
// so when we hand `.align 32` to LLVM, the assembly output will contain `.align 5`
302+
writeln!(begin, ".align {}", align_bytes).unwrap();
303+
304+
write_linkage(&mut begin).unwrap();
305+
if let Visibility::Hidden = item_data.visibility {
306+
// FIXME apparently `.globl {asm_name}, hidden` is valid
307+
// but due to limitations with `.weak` (see above) we can't really use that in general yet
308+
}
309+
writeln!(begin, "{asm_name}:").unwrap();
310+
311+
writeln!(end).unwrap();
312+
// FIXME: end the section?
313+
}
282314
}
283315

284316
(begin, end)

‎compiler/rustc_error_messages/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ impl From<Vec<FluentError>> for TranslationBundleError {
106106
/// (overriding any conflicting messages).
107107
#[instrument(level = "trace")]
108108
pub fn fluent_bundle(
109-
mut user_provided_sysroot: Option<PathBuf>,
110-
mut sysroot_candidates: Vec<PathBuf>,
109+
sysroot: PathBuf,
110+
sysroot_candidates: Vec<PathBuf>,
111111
requested_locale: Option<LanguageIdentifier>,
112112
additional_ftl_path: Option<&Path>,
113113
with_directionality_markers: bool,
@@ -141,7 +141,7 @@ pub fn fluent_bundle(
141141
// If the user requests the default locale then don't try to load anything.
142142
if let Some(requested_locale) = requested_locale {
143143
let mut found_resources = false;
144-
for sysroot in user_provided_sysroot.iter_mut().chain(sysroot_candidates.iter_mut()) {
144+
for mut sysroot in Some(sysroot).into_iter().chain(sysroot_candidates.into_iter()) {
145145
sysroot.push("share");
146146
sysroot.push("locale");
147147
sysroot.push(requested_locale.to_string());

‎compiler/rustc_hir/src/hir.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3373,13 +3373,16 @@ pub struct OpaqueTy<'hir> {
33733373
pub span: Span,
33743374
}
33753375

3376-
#[derive(Debug, Clone, Copy, HashStable_Generic)]
3377-
pub enum PreciseCapturingArg<'hir> {
3378-
Lifetime(&'hir Lifetime),
3376+
#[derive(Debug, Clone, Copy, HashStable_Generic, Encodable, Decodable)]
3377+
pub enum PreciseCapturingArgKind<T, U> {
3378+
Lifetime(T),
33793379
/// Non-lifetime argument (type or const)
3380-
Param(PreciseCapturingNonLifetimeArg),
3380+
Param(U),
33813381
}
33823382

3383+
pub type PreciseCapturingArg<'hir> =
3384+
PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;
3385+
33833386
impl PreciseCapturingArg<'_> {
33843387
pub fn hir_id(self) -> HirId {
33853388
match self {

‎compiler/rustc_hir_analysis/src/collect.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use rustc_errors::{
2828
use rustc_hir::def::DefKind;
2929
use rustc_hir::def_id::{DefId, LocalDefId};
3030
use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt, walk_generics};
31-
use rustc_hir::{self as hir, GenericParamKind, HirId, Node};
31+
use rustc_hir::{self as hir, GenericParamKind, HirId, Node, PreciseCapturingArgKind};
3232
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
3333
use rustc_infer::traits::ObligationCause;
3434
use rustc_middle::hir::nested_filter;
@@ -1791,7 +1791,7 @@ fn opaque_ty_origin<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> hir::OpaqueT
17911791
fn rendered_precise_capturing_args<'tcx>(
17921792
tcx: TyCtxt<'tcx>,
17931793
def_id: LocalDefId,
1794-
) -> Option<&'tcx [Symbol]> {
1794+
) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
17951795
if let Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) =
17961796
tcx.opt_rpitit_info(def_id.to_def_id())
17971797
{
@@ -1800,7 +1800,12 @@ fn rendered_precise_capturing_args<'tcx>(
18001800

18011801
tcx.hir_node_by_def_id(def_id).expect_opaque_ty().bounds.iter().find_map(|bound| match bound {
18021802
hir::GenericBound::Use(args, ..) => {
1803-
Some(&*tcx.arena.alloc_from_iter(args.iter().map(|arg| arg.name())))
1803+
Some(&*tcx.arena.alloc_from_iter(args.iter().map(|arg| match arg {
1804+
PreciseCapturingArgKind::Lifetime(_) => {
1805+
PreciseCapturingArgKind::Lifetime(arg.name())
1806+
}
1807+
PreciseCapturingArgKind::Param(_) => PreciseCapturingArgKind::Param(arg.name()),
1808+
})))
18041809
}
18051810
_ => None,
18061811
})

‎compiler/rustc_interface/src/interface.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_parse::parser::attr::AllowLeadingUnsafe;
1818
use rustc_query_impl::QueryCtxt;
1919
use rustc_query_system::query::print_query_stack;
2020
use rustc_session::config::{self, Cfg, CheckCfg, ExpectedValues, Input, OutFileName};
21-
use rustc_session::filesearch::{self, sysroot_candidates};
21+
use rustc_session::filesearch::sysroot_candidates;
2222
use rustc_session::parse::ParseSess;
2323
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, lint};
2424
use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMapInputs};
@@ -390,7 +390,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
390390

391391
crate::callbacks::setup_callbacks();
392392

393-
let sysroot = filesearch::materialize_sysroot(config.opts.maybe_sysroot.clone());
393+
let sysroot = config.opts.sysroot.clone();
394394
let target = config::build_target_config(&early_dcx, &config.opts.target_triple, &sysroot);
395395
let file_loader = config.file_loader.unwrap_or_else(|| Box::new(RealFileLoader));
396396
let path_mapping = config.opts.file_path_mapping();
@@ -424,7 +424,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
424424
let temps_dir = config.opts.unstable_opts.temps_dir.as_deref().map(PathBuf::from);
425425

426426
let bundle = match rustc_errors::fluent_bundle(
427-
config.opts.maybe_sysroot.clone(),
427+
config.opts.sysroot.clone(),
428428
sysroot_candidates().to_vec(),
429429
config.opts.unstable_opts.translate_lang.clone(),
430430
config.opts.unstable_opts.translate_additional_ftl.as_deref(),

‎compiler/rustc_interface/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_session::config::{
2121
use rustc_session::lint::Level;
2222
use rustc_session::search_paths::SearchPath;
2323
use rustc_session::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
24-
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, filesearch, getopts};
24+
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, getopts};
2525
use rustc_span::edition::{DEFAULT_EDITION, Edition};
2626
use rustc_span::source_map::{RealFileLoader, SourceMapInputs};
2727
use rustc_span::{FileName, SourceFileHashAlgorithm, sym};
@@ -41,7 +41,7 @@ where
4141

4242
let matches = optgroups().parse(args).unwrap();
4343
let sessopts = build_session_options(&mut early_dcx, &matches);
44-
let sysroot = filesearch::materialize_sysroot(sessopts.maybe_sysroot.clone());
44+
let sysroot = sessopts.sysroot.clone();
4545
let target =
4646
rustc_session::config::build_target_config(&early_dcx, &sessopts.target_triple, &sysroot);
4747
let hash_kind = sessopts.unstable_opts.src_hash_algorithm(&target);

‎compiler/rustc_metadata/src/rmeta/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_abi::{FieldIdx, ReprOptions, VariantIdx};
1010
use rustc_ast::expand::StrippedCfgItem;
1111
use rustc_data_structures::fx::FxHashMap;
1212
use rustc_data_structures::svh::Svh;
13+
use rustc_hir::PreciseCapturingArgKind;
1314
use rustc_hir::def::{CtorKind, DefKind, DocLinkResMap};
1415
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIndex, DefPathHash, StableCrateId};
1516
use rustc_hir::definitions::DefKey;
@@ -440,7 +441,7 @@ define_tables! {
440441
coerce_unsized_info: Table<DefIndex, LazyValue<ty::adjustment::CoerceUnsizedInfo>>,
441442
mir_const_qualif: Table<DefIndex, LazyValue<mir::ConstQualifs>>,
442443
rendered_const: Table<DefIndex, LazyValue<String>>,
443-
rendered_precise_capturing_args: Table<DefIndex, LazyArray<Symbol>>,
444+
rendered_precise_capturing_args: Table<DefIndex, LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>,
444445
asyncness: Table<DefIndex, ty::Asyncness>,
445446
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
446447
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,

‎compiler/rustc_middle/src/query/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_hir::def_id::{
2525
CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
2626
};
2727
use rustc_hir::lang_items::{LangItem, LanguageItems};
28-
use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, TraitCandidate};
28+
use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, PreciseCapturingArgKind, TraitCandidate};
2929
use rustc_index::IndexVec;
3030
use rustc_lint_defs::LintId;
3131
use rustc_macros::rustc_queries;
@@ -1424,7 +1424,7 @@ rustc_queries! {
14241424
}
14251425

14261426
/// Gets the rendered precise capturing args for an opaque for use in rustdoc.
1427-
query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [Symbol]> {
1427+
query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
14281428
desc { |tcx| "rendering precise capturing args for `{}`", tcx.def_path_str(def_id) }
14291429
separate_provide_extern
14301430
}

‎compiler/rustc_middle/src/ty/parameterized.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::hash::Hash;
33
use rustc_data_structures::unord::UnordMap;
44
use rustc_hir::def_id::DefIndex;
55
use rustc_index::{Idx, IndexVec};
6+
use rustc_span::Symbol;
67

78
use crate::ty;
89

@@ -96,6 +97,7 @@ trivially_parameterized_over_tcx! {
9697
rustc_hir::def_id::DefIndex,
9798
rustc_hir::definitions::DefKey,
9899
rustc_hir::OpaqueTyOrigin<rustc_hir::def_id::DefId>,
100+
rustc_hir::PreciseCapturingArgKind<Symbol, Symbol>,
99101
rustc_index::bit_set::DenseBitSet<u32>,
100102
rustc_index::bit_set::FiniteBitSet<u32>,
101103
rustc_session::cstore::ForeignModule,

‎compiler/rustc_session/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ impl Default for Options {
12141214
describe_lints: false,
12151215
output_types: OutputTypes(BTreeMap::new()),
12161216
search_paths: vec![],
1217-
maybe_sysroot: None,
1217+
sysroot: filesearch::materialize_sysroot(None),
12181218
target_triple: TargetTuple::from_tuple(host_tuple()),
12191219
test: false,
12201220
incremental: None,
@@ -2618,7 +2618,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
26182618
describe_lints,
26192619
output_types,
26202620
search_paths,
2621-
maybe_sysroot: Some(sysroot),
2621+
sysroot,
26222622
target_triple,
26232623
test,
26242624
incremental,

‎compiler/rustc_session/src/filesearch.rs

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ fn current_dll_path() -> Result<PathBuf, String> {
160160

161161
pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> {
162162
let target = crate::config::host_tuple();
163-
let mut sysroot_candidates: SmallVec<[PathBuf; 2]> =
164-
smallvec![get_or_default_sysroot().expect("Failed finding sysroot")];
163+
let mut sysroot_candidates: SmallVec<[PathBuf; 2]> = smallvec![get_or_default_sysroot()];
165164
let path = current_dll_path().and_then(|s| try_canonicalize(s).map_err(|e| e.to_string()));
166165
if let Ok(dll) = path {
167166
// use `parent` twice to chop off the file name and then also the
@@ -195,12 +194,12 @@ pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> {
195194
/// Returns the provided sysroot or calls [`get_or_default_sysroot`] if it's none.
196195
/// Panics if [`get_or_default_sysroot`] returns an error.
197196
pub fn materialize_sysroot(maybe_sysroot: Option<PathBuf>) -> PathBuf {
198-
maybe_sysroot.unwrap_or_else(|| get_or_default_sysroot().expect("Failed finding sysroot"))
197+
maybe_sysroot.unwrap_or_else(|| get_or_default_sysroot())
199198
}
200199

201200
/// This function checks if sysroot is found using env::args().next(), and if it
202201
/// is not found, finds sysroot from current rustc_driver dll.
203-
pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
202+
pub fn get_or_default_sysroot() -> PathBuf {
204203
// Follow symlinks. If the resolved path is relative, make it absolute.
205204
fn canonicalize(path: PathBuf) -> PathBuf {
206205
let path = try_canonicalize(&path).unwrap_or(path);
@@ -255,30 +254,25 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
255254
// binary able to locate Rust libraries in systems using content-addressable
256255
// storage (CAS).
257256
fn from_env_args_next() -> Option<PathBuf> {
258-
match env::args_os().next() {
259-
Some(first_arg) => {
260-
let mut p = PathBuf::from(first_arg);
261-
262-
// Check if sysroot is found using env::args().next() only if the rustc in argv[0]
263-
// is a symlink (see #79253). We might want to change/remove it to conform with
264-
// https://www.gnu.org/prep/standards/standards.html#Finding-Program-Files in the
265-
// future.
266-
if fs::read_link(&p).is_err() {
267-
// Path is not a symbolic link or does not exist.
268-
return None;
269-
}
270-
271-
// Pop off `bin/rustc`, obtaining the suspected sysroot.
272-
p.pop();
273-
p.pop();
274-
// Look for the target rustlib directory in the suspected sysroot.
275-
let mut rustlib_path = rustc_target::relative_target_rustlib_path(&p, "dummy");
276-
rustlib_path.pop(); // pop off the dummy target.
277-
rustlib_path.exists().then_some(p)
278-
}
279-
None => None,
257+
let mut p = PathBuf::from(env::args_os().next()?);
258+
259+
// Check if sysroot is found using env::args().next() only if the rustc in argv[0]
260+
// is a symlink (see #79253). We might want to change/remove it to conform with
261+
// https://www.gnu.org/prep/standards/standards.html#Finding-Program-Files in the
262+
// future.
263+
if fs::read_link(&p).is_err() {
264+
// Path is not a symbolic link or does not exist.
265+
return None;
280266
}
267+
268+
// Pop off `bin/rustc`, obtaining the suspected sysroot.
269+
p.pop();
270+
p.pop();
271+
// Look for the target rustlib directory in the suspected sysroot.
272+
let mut rustlib_path = rustc_target::relative_target_rustlib_path(&p, "dummy");
273+
rustlib_path.pop(); // pop off the dummy target.
274+
rustlib_path.exists().then_some(p)
281275
}
282276

283-
Ok(from_env_args_next().unwrap_or(default_from_rustc_driver_dll()?))
277+
from_env_args_next().unwrap_or(default_from_rustc_driver_dll().expect("Failed finding sysroot"))
284278
}

‎compiler/rustc_session/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ top_level_options!(
333333
output_types: OutputTypes [TRACKED],
334334
search_paths: Vec<SearchPath> [UNTRACKED],
335335
libs: Vec<NativeLib> [TRACKED],
336-
maybe_sysroot: Option<PathBuf> [UNTRACKED],
336+
sysroot: PathBuf [UNTRACKED],
337337

338338
target_triple: TargetTuple [TRACKED],
339339

‎compiler/rustc_session/src/session.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ pub struct Session {
143143
pub target: Target,
144144
pub host: Target,
145145
pub opts: config::Options,
146-
pub host_tlib_path: Arc<SearchPath>,
147146
pub target_tlib_path: Arc<SearchPath>,
148147
pub psess: ParseSess,
149148
pub sysroot: PathBuf,
@@ -1042,6 +1041,7 @@ pub fn build_session(
10421041

10431042
let host_triple = config::host_tuple();
10441043
let target_triple = sopts.target_triple.tuple();
1044+
// FIXME use host sysroot?
10451045
let host_tlib_path = Arc::new(SearchPath::from_sysroot_and_triple(&sysroot, host_triple));
10461046
let target_tlib_path = if host_triple == target_triple {
10471047
// Use the same `SearchPath` if host and target triple are identical to avoid unnecessary
@@ -1070,7 +1070,6 @@ pub fn build_session(
10701070
target,
10711071
host,
10721072
opts: sopts,
1073-
host_tlib_path,
10741073
target_tlib_path,
10751074
psess,
10761075
sysroot,

‎library/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change

‎library/std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
3535
addr2line = { version = "0.24.0", optional = true, default-features = false }
3636

3737
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
38-
libc = { version = "0.2.170", default-features = false, features = [
38+
libc = { version = "0.2.171", default-features = false, features = [
3939
'rustc-dep-of-std',
4040
], public = true }
4141

‎library/std/tests/floats/f16.rs

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -461,18 +461,16 @@ fn test_recip() {
461461
#[test]
462462
#[cfg(reliable_f16_math)]
463463
fn test_powi() {
464-
// FIXME(llvm19): LLVM misoptimizes `powi.f16`
465-
// <https://github.com/llvm/llvm-project/issues/98665>
466-
// let nan: f16 = f16::NAN;
467-
// let inf: f16 = f16::INFINITY;
468-
// let neg_inf: f16 = f16::NEG_INFINITY;
469-
// assert_eq!(1.0f16.powi(1), 1.0);
470-
// assert_approx_eq!((-3.1f16).powi(2), 9.61, TOL_0);
471-
// assert_approx_eq!(5.9f16.powi(-2), 0.028727, TOL_N2);
472-
// assert_eq!(8.3f16.powi(0), 1.0);
473-
// assert!(nan.powi(2).is_nan());
474-
// assert_eq!(inf.powi(3), inf);
475-
// assert_eq!(neg_inf.powi(2), inf);
464+
let nan: f16 = f16::NAN;
465+
let inf: f16 = f16::INFINITY;
466+
let neg_inf: f16 = f16::NEG_INFINITY;
467+
assert_eq!(1.0f16.powi(1), 1.0);
468+
assert_approx_eq!((-3.1f16).powi(2), 9.61, TOL_0);
469+
assert_approx_eq!(5.9f16.powi(-2), 0.028727, TOL_N2);
470+
assert_eq!(8.3f16.powi(0), 1.0);
471+
assert!(nan.powi(2).is_nan());
472+
assert_eq!(inf.powi(3), inf);
473+
assert_eq!(neg_inf.powi(2), inf);
476474
}
477475

478476
#[test]
@@ -813,21 +811,21 @@ fn test_clamp_max_is_nan() {
813811
}
814812

815813
#[test]
814+
#[cfg(reliable_f16_math)]
816815
fn test_total_cmp() {
817816
use core::cmp::Ordering;
818817

819818
fn quiet_bit_mask() -> u16 {
820819
1 << (f16::MANTISSA_DIGITS - 2)
821820
}
822821

823-
// FIXME(f16_f128): test subnormals when powf is available
824-
// fn min_subnorm() -> f16 {
825-
// f16::MIN_POSITIVE / f16::powf(2.0, f16::MANTISSA_DIGITS as f16 - 1.0)
826-
// }
822+
fn min_subnorm() -> f16 {
823+
f16::MIN_POSITIVE / f16::powf(2.0, f16::MANTISSA_DIGITS as f16 - 1.0)
824+
}
827825

828-
// fn max_subnorm() -> f16 {
829-
// f16::MIN_POSITIVE - min_subnorm()
830-
// }
826+
fn max_subnorm() -> f16 {
827+
f16::MIN_POSITIVE - min_subnorm()
828+
}
831829

832830
fn q_nan() -> f16 {
833831
f16::from_bits(f16::NAN.to_bits() | quiet_bit_mask())
@@ -846,12 +844,12 @@ fn test_total_cmp() {
846844
assert_eq!(Ordering::Equal, (-1.5_f16).total_cmp(&-1.5));
847845
assert_eq!(Ordering::Equal, (-0.5_f16).total_cmp(&-0.5));
848846
assert_eq!(Ordering::Equal, (-f16::MIN_POSITIVE).total_cmp(&-f16::MIN_POSITIVE));
849-
// assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm()));
850-
// assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm()));
847+
assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm()));
848+
assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm()));
851849
assert_eq!(Ordering::Equal, (-0.0_f16).total_cmp(&-0.0));
852850
assert_eq!(Ordering::Equal, 0.0_f16.total_cmp(&0.0));
853-
// assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm()));
854-
// assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm()));
851+
assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm()));
852+
assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm()));
855853
assert_eq!(Ordering::Equal, f16::MIN_POSITIVE.total_cmp(&f16::MIN_POSITIVE));
856854
assert_eq!(Ordering::Equal, 0.5_f16.total_cmp(&0.5));
857855
assert_eq!(Ordering::Equal, 1.0_f16.total_cmp(&1.0));
@@ -870,13 +868,13 @@ fn test_total_cmp() {
870868
assert_eq!(Ordering::Less, (-1.5_f16).total_cmp(&-1.0));
871869
assert_eq!(Ordering::Less, (-1.0_f16).total_cmp(&-0.5));
872870
assert_eq!(Ordering::Less, (-0.5_f16).total_cmp(&-f16::MIN_POSITIVE));
873-
// assert_eq!(Ordering::Less, (-f16::MIN_POSITIVE).total_cmp(&-max_subnorm()));
874-
// assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm()));
875-
// assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0));
871+
assert_eq!(Ordering::Less, (-f16::MIN_POSITIVE).total_cmp(&-max_subnorm()));
872+
assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm()));
873+
assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0));
876874
assert_eq!(Ordering::Less, (-0.0_f16).total_cmp(&0.0));
877-
// assert_eq!(Ordering::Less, 0.0_f16.total_cmp(&min_subnorm()));
878-
// assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm()));
879-
// assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f16::MIN_POSITIVE));
875+
assert_eq!(Ordering::Less, 0.0_f16.total_cmp(&min_subnorm()));
876+
assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm()));
877+
assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f16::MIN_POSITIVE));
880878
assert_eq!(Ordering::Less, f16::MIN_POSITIVE.total_cmp(&0.5));
881879
assert_eq!(Ordering::Less, 0.5_f16.total_cmp(&1.0));
882880
assert_eq!(Ordering::Less, 1.0_f16.total_cmp(&1.5));
@@ -894,13 +892,13 @@ fn test_total_cmp() {
894892
assert_eq!(Ordering::Greater, (-1.0_f16).total_cmp(&-1.5));
895893
assert_eq!(Ordering::Greater, (-0.5_f16).total_cmp(&-1.0));
896894
assert_eq!(Ordering::Greater, (-f16::MIN_POSITIVE).total_cmp(&-0.5));
897-
// assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f16::MIN_POSITIVE));
898-
// assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm()));
899-
// assert_eq!(Ordering::Greater, (-0.0_f16).total_cmp(&-min_subnorm()));
895+
assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f16::MIN_POSITIVE));
896+
assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm()));
897+
assert_eq!(Ordering::Greater, (-0.0_f16).total_cmp(&-min_subnorm()));
900898
assert_eq!(Ordering::Greater, 0.0_f16.total_cmp(&-0.0));
901-
// assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0));
902-
// assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm()));
903-
// assert_eq!(Ordering::Greater, f16::MIN_POSITIVE.total_cmp(&max_subnorm()));
899+
assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0));
900+
assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm()));
901+
assert_eq!(Ordering::Greater, f16::MIN_POSITIVE.total_cmp(&max_subnorm()));
904902
assert_eq!(Ordering::Greater, 0.5_f16.total_cmp(&f16::MIN_POSITIVE));
905903
assert_eq!(Ordering::Greater, 1.0_f16.total_cmp(&0.5));
906904
assert_eq!(Ordering::Greater, 1.5_f16.total_cmp(&1.0));
@@ -918,12 +916,12 @@ fn test_total_cmp() {
918916
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.0));
919917
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.5));
920918
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f16::MIN_POSITIVE));
921-
// assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm()));
922-
// assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm()));
919+
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm()));
920+
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm()));
923921
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.0));
924922
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.0));
925-
// assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm()));
926-
// assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm()));
923+
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm()));
924+
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm()));
927925
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f16::MIN_POSITIVE));
928926
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.5));
929927
assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.0));
@@ -940,12 +938,12 @@ fn test_total_cmp() {
940938
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.0));
941939
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.5));
942940
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f16::MIN_POSITIVE));
943-
// assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm()));
944-
// assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm()));
941+
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm()));
942+
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm()));
945943
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.0));
946944
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.0));
947-
// assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm()));
948-
// assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm()));
945+
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm()));
946+
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm()));
949947
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f16::MIN_POSITIVE));
950948
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.5));
951949
assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.0));

‎src/librustdoc/clean/mod.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ fn clean_generic_bound<'tcx>(
231231
GenericBound::TraitBound(clean_poly_trait_ref(t, cx), t.modifiers)
232232
}
233233
hir::GenericBound::Use(args, ..) => {
234-
GenericBound::Use(args.iter().map(|arg| arg.name()).collect())
234+
GenericBound::Use(args.iter().map(|arg| clean_precise_capturing_arg(arg, cx)).collect())
235235
}
236236
})
237237
}
@@ -286,6 +286,18 @@ fn clean_lifetime(lifetime: &hir::Lifetime, cx: &DocContext<'_>) -> Lifetime {
286286
Lifetime(lifetime.ident.name)
287287
}
288288

289+
pub(crate) fn clean_precise_capturing_arg(
290+
arg: &hir::PreciseCapturingArg<'_>,
291+
cx: &DocContext<'_>,
292+
) -> PreciseCapturingArg {
293+
match arg {
294+
hir::PreciseCapturingArg::Lifetime(lt) => {
295+
PreciseCapturingArg::Lifetime(clean_lifetime(lt, cx))
296+
}
297+
hir::PreciseCapturingArg::Param(param) => PreciseCapturingArg::Param(param.ident.name),
298+
}
299+
}
300+
289301
pub(crate) fn clean_const<'tcx>(
290302
constant: &hir::ConstArg<'tcx>,
291303
_cx: &mut DocContext<'tcx>,
@@ -2364,7 +2376,18 @@ fn clean_middle_opaque_bounds<'tcx>(
23642376
}
23652377

23662378
if let Some(args) = cx.tcx.rendered_precise_capturing_args(impl_trait_def_id) {
2367-
bounds.push(GenericBound::Use(args.to_vec()));
2379+
bounds.push(GenericBound::Use(
2380+
args.iter()
2381+
.map(|arg| match arg {
2382+
hir::PreciseCapturingArgKind::Lifetime(lt) => {
2383+
PreciseCapturingArg::Lifetime(Lifetime(*lt))
2384+
}
2385+
hir::PreciseCapturingArgKind::Param(param) => {
2386+
PreciseCapturingArg::Param(*param)
2387+
}
2388+
})
2389+
.collect(),
2390+
));
23682391
}
23692392

23702393
ImplTrait(bounds)

‎src/librustdoc/clean/types.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ pub(crate) enum GenericBound {
12401240
TraitBound(PolyTrait, hir::TraitBoundModifiers),
12411241
Outlives(Lifetime),
12421242
/// `use<'a, T>` precise-capturing bound syntax
1243-
Use(Vec<Symbol>),
1243+
Use(Vec<PreciseCapturingArg>),
12441244
}
12451245

12461246
impl GenericBound {
@@ -1304,6 +1304,21 @@ impl Lifetime {
13041304
}
13051305
}
13061306

1307+
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
1308+
pub(crate) enum PreciseCapturingArg {
1309+
Lifetime(Lifetime),
1310+
Param(Symbol),
1311+
}
1312+
1313+
impl PreciseCapturingArg {
1314+
pub(crate) fn name(self) -> Symbol {
1315+
match self {
1316+
PreciseCapturingArg::Lifetime(lt) => lt.0,
1317+
PreciseCapturingArg::Param(param) => param,
1318+
}
1319+
}
1320+
}
1321+
13071322
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
13081323
pub(crate) enum WherePredicate {
13091324
BoundPredicate { ty: Type, bounds: Vec<GenericBound>, bound_params: Vec<GenericParamDef> },

‎src/librustdoc/config.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ pub(crate) struct Options {
103103
/// compiling doctests from the crate.
104104
pub(crate) edition: Edition,
105105
/// The path to the sysroot. Used during the compilation process.
106+
pub(crate) sysroot: PathBuf,
107+
/// Has the same value as `sysroot` except is `None` when the user didn't pass `---sysroot`.
106108
pub(crate) maybe_sysroot: Option<PathBuf>,
107109
/// Lint information passed over the command-line.
108110
pub(crate) lint_opts: Vec<(String, Level)>,
@@ -202,6 +204,7 @@ impl fmt::Debug for Options {
202204
.field("unstable_options", &"...")
203205
.field("target", &self.target)
204206
.field("edition", &self.edition)
207+
.field("sysroot", &self.sysroot)
205208
.field("maybe_sysroot", &self.maybe_sysroot)
206209
.field("lint_opts", &self.lint_opts)
207210
.field("describe_lints", &self.describe_lints)
@@ -729,12 +732,7 @@ impl Options {
729732
let target = parse_target_triple(early_dcx, matches);
730733
let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from);
731734

732-
let sysroot = match &maybe_sysroot {
733-
Some(s) => s.clone(),
734-
None => {
735-
rustc_session::filesearch::get_or_default_sysroot().expect("Failed finding sysroot")
736-
}
737-
};
735+
let sysroot = rustc_session::filesearch::materialize_sysroot(maybe_sysroot.clone());
738736

739737
let libs = matches
740738
.opt_strs("L")
@@ -834,6 +832,7 @@ impl Options {
834832
unstable_opts_strs,
835833
target,
836834
edition,
835+
sysroot,
837836
maybe_sysroot,
838837
lint_opts,
839838
describe_lints,

‎src/librustdoc/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub(crate) fn create_config(
210210
unstable_opts,
211211
target,
212212
edition,
213-
maybe_sysroot,
213+
sysroot,
214214
lint_opts,
215215
describe_lints,
216216
lint_cap,
@@ -253,7 +253,7 @@ pub(crate) fn create_config(
253253
let test = scrape_examples_options.map(|opts| opts.scrape_tests).unwrap_or(false);
254254
// plays with error output here!
255255
let sessopts = config::Options {
256-
maybe_sysroot,
256+
sysroot,
257257
search_paths: libs,
258258
crate_types,
259259
lint_opts,

‎src/librustdoc/doctest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
158158
if options.proc_macro_crate { vec![CrateType::ProcMacro] } else { vec![CrateType::Rlib] };
159159

160160
let sessopts = config::Options {
161-
maybe_sysroot: options.maybe_sysroot.clone(),
161+
sysroot: options.sysroot.clone(),
162162
search_paths: options.libs.clone(),
163163
crate_types,
164164
lint_opts,

‎src/librustdoc/html/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl clean::GenericBound {
283283
} else {
284284
f.write_str("use&lt;")?;
285285
}
286-
args.iter().joined(", ", f)?;
286+
args.iter().map(|arg| arg.name()).joined(", ", f)?;
287287
if f.alternate() { f.write_str(">") } else { f.write_str("&gt;") }
288288
}
289289
})

‎src/librustdoc/json/conversions.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,18 @@ impl FromClean<clean::GenericBound> for GenericBound {
486486
}
487487
}
488488
Outlives(lifetime) => GenericBound::Outlives(convert_lifetime(lifetime)),
489-
Use(args) => GenericBound::Use(args.into_iter().map(|arg| arg.to_string()).collect()),
489+
Use(args) => GenericBound::Use(
490+
args.iter()
491+
.map(|arg| match arg {
492+
clean::PreciseCapturingArg::Lifetime(lt) => {
493+
PreciseCapturingArg::Lifetime(convert_lifetime(*lt))
494+
}
495+
clean::PreciseCapturingArg::Param(param) => {
496+
PreciseCapturingArg::Param(param.to_string())
497+
}
498+
})
499+
.collect(),
500+
),
490501
}
491502
}
492503
}

‎src/rustdoc-json-types/lib.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc
3030
/// This integer is incremented with every breaking change to the API,
3131
/// and is returned along with the JSON blob as [`Crate::format_version`].
3232
/// Consuming code should assert that this value matches the format version(s) that it supports.
33-
pub const FORMAT_VERSION: u32 = 40;
33+
pub const FORMAT_VERSION: u32 = 41;
3434

3535
/// The root of the emitted JSON blob.
3636
///
@@ -909,7 +909,7 @@ pub enum GenericBound {
909909
/// ```
910910
Outlives(String),
911911
/// `use<'a, T>` precise-capturing bound syntax
912-
Use(Vec<String>),
912+
Use(Vec<PreciseCapturingArg>),
913913
}
914914

915915
/// A set of modifiers applied to a trait.
@@ -927,6 +927,22 @@ pub enum TraitBoundModifier {
927927
MaybeConst,
928928
}
929929

930+
/// One precise capturing argument. See [the rust reference](https://doc.rust-lang.org/reference/types/impl-trait.html#precise-capturing).
931+
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
932+
#[serde(rename_all = "snake_case")]
933+
pub enum PreciseCapturingArg {
934+
/// A lifetime.
935+
/// ```rust
936+
/// pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}
937+
/// // ^^
938+
Lifetime(String),
939+
/// A type or constant parameter.
940+
/// ```rust
941+
/// pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}
942+
/// // ^ ^
943+
Param(String),
944+
}
945+
930946
/// Either a type or a constant, usually stored as the right-hand side of an equation in places like
931947
/// [`AssocItemConstraint`]
932948
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]

‎src/tools/compiletest/src/common.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,17 @@ impl Config {
481481
}
482482

483483
pub fn has_asm_support(&self) -> bool {
484+
// This should match the stable list in `LoweringContext::lower_inline_asm`.
484485
static ASM_SUPPORTED_ARCHS: &[&str] = &[
485-
"x86", "x86_64", "arm", "aarch64", "riscv32",
486+
"x86",
487+
"x86_64",
488+
"arm",
489+
"aarch64",
490+
"arm64ec",
491+
"riscv32",
486492
"riscv64",
493+
"loongarch64",
494+
"s390x",
487495
// These targets require an additional asm_experimental_arch feature.
488496
// "nvptx64", "hexagon", "mips", "mips64", "spirv", "wasm32",
489497
];

‎tests/assembly/naked-functions/aix.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//@ revisions: elfv1-be aix
2+
//@ add-core-stubs
3+
//@ assembly-output: emit-asm
4+
//
5+
//@[elfv1-be] compile-flags: --target powerpc64-unknown-linux-gnu
6+
//@[elfv1-be] needs-llvm-components: powerpc
7+
//
8+
//@[aix] compile-flags: --target powerpc64-ibm-aix
9+
//@[aix] needs-llvm-components: powerpc
10+
11+
#![crate_type = "lib"]
12+
#![feature(no_core, naked_functions, asm_experimental_arch, f128, linkage, fn_align)]
13+
#![no_core]
14+
15+
// tests that naked functions work for the `powerpc64-ibm-aix` target.
16+
//
17+
// This target is special because it uses the XCOFF binary format
18+
// It is tested alongside an elf powerpc target to pin down commonalities and differences.
19+
//
20+
// https://doc.rust-lang.org/rustc/platform-support/aix.html
21+
// https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format
22+
23+
extern crate minicore;
24+
use minicore::*;
25+
26+
// elfv1-be: .p2align 2
27+
// aix: .align 2
28+
// CHECK: .globl blr
29+
// CHECK-LABEL: blr:
30+
// CHECK: blr
31+
#[no_mangle]
32+
#[naked]
33+
unsafe extern "C" fn blr() {
34+
naked_asm!("blr")
35+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0]" \"\'a\"
2-
//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1]" \"T\"
3-
//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2]" \"N\"
1+
//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0].lifetime" \"\'a\"
2+
//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1].param" \"T\"
3+
//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2].param" \"N\"
44
pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}

‎tests/ui-fulldeps/run-compiler-twice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn main() {
4646
fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path>) {
4747
let mut opts = Options::default();
4848
opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);
49-
opts.maybe_sysroot = Some(sysroot);
49+
opts.sysroot = sysroot;
5050

5151
if let Some(linker) = linker {
5252
opts.cg.linker = Some(linker.to_owned());

0 commit comments

Comments
 (0)
Please sign in to comment.