Skip to content

Commit b17cf41

Browse files
authored
Merge pull request rust-lang#4010 from rust-lang/rustup-2024-11-03
Automatic Rustup
2 parents c67ea44 + b58cbe2 commit b17cf41

File tree

152 files changed

+851
-1525
lines changed

Some content is hidden

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

152 files changed

+851
-1525
lines changed

compiler/rustc_codegen_cranelift/src/global_asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ impl GlobalAsmConfig {
118118
GlobalAsmConfig {
119119
assembler: crate::toolchain::get_toolchain_binary(tcx.sess, "as"),
120120
target: match &tcx.sess.opts.target_triple {
121-
rustc_target::spec::TargetTriple::TargetTriple(triple) => triple.clone(),
122-
rustc_target::spec::TargetTriple::TargetJson { path_for_rustdoc, .. } => {
121+
rustc_target::spec::TargetTuple::TargetTuple(triple) => triple.clone(),
122+
rustc_target::spec::TargetTuple::TargetJson { path_for_rustdoc, .. } => {
123123
path_for_rustdoc.to_str().unwrap().to_owned()
124124
}
125125
},

compiler/rustc_codegen_gcc/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
146146

147147
// Wasm statics with custom link sections get special treatment as they
148148
// go into custom sections of the wasm executable.
149-
if self.tcx.sess.opts.target_triple.triple().starts_with("wasm32") {
149+
if self.tcx.sess.opts.target_triple.tuple().starts_with("wasm32") {
150150
if let Some(_section) = attrs.link_section {
151151
unimplemented!();
152152
}

compiler/rustc_codegen_llvm/src/back/write.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ fn create_section_with_flags_asm(section_name: &str, section_flags: &str, data:
946946
}
947947

948948
fn target_is_apple(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
949-
let triple = cgcx.opts.target_triple.triple();
949+
let triple = cgcx.opts.target_triple.tuple();
950950
triple.contains("-ios")
951951
|| triple.contains("-darwin")
952952
|| triple.contains("-tvos")
@@ -955,7 +955,7 @@ fn target_is_apple(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
955955
}
956956

957957
fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
958-
cgcx.opts.target_triple.triple().contains("-aix")
958+
cgcx.opts.target_triple.tuple().contains("-aix")
959959
}
960960

961961
pub(crate) fn bitcode_section_name(cgcx: &CodegenContext<LlvmCodegenBackend>) -> &'static CStr {
@@ -1031,7 +1031,7 @@ unsafe fn embed_bitcode(
10311031
let is_aix = target_is_aix(cgcx);
10321032
let is_apple = target_is_apple(cgcx);
10331033
unsafe {
1034-
if is_apple || is_aix || cgcx.opts.target_triple.triple().starts_with("wasm") {
1034+
if is_apple || is_aix || cgcx.opts.target_triple.tuple().starts_with("wasm") {
10351035
// We don't need custom section flags, create LLVM globals.
10361036
let llconst = common::bytes_in_context(llcx, bitcode);
10371037
let llglobal = llvm::LLVMAddGlobal(

compiler/rustc_codegen_ssa/src/back/link.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ fn link_natively(
997997
{
998998
let is_vs_installed = windows_registry::find_vs_version().is_ok();
999999
let has_linker = windows_registry::find_tool(
1000-
sess.opts.target_triple.triple(),
1000+
sess.opts.target_triple.tuple(),
10011001
"link.exe",
10021002
)
10031003
.is_some();
@@ -1323,10 +1323,8 @@ fn link_sanitizer_runtime(
13231323
} else {
13241324
let default_sysroot =
13251325
filesearch::get_or_default_sysroot().expect("Failed finding sysroot");
1326-
let default_tlib = filesearch::make_target_lib_path(
1327-
&default_sysroot,
1328-
sess.opts.target_triple.triple(),
1329-
);
1326+
let default_tlib =
1327+
filesearch::make_target_lib_path(&default_sysroot, sess.opts.target_triple.tuple());
13301328
default_tlib
13311329
}
13321330
}

compiler/rustc_codegen_ssa/src/back/linker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(crate) fn get_linker<'a>(
4747
self_contained: bool,
4848
target_cpu: &'a str,
4949
) -> Box<dyn Linker + 'a> {
50-
let msvc_tool = windows_registry::find_tool(sess.opts.target_triple.triple(), "link.exe");
50+
let msvc_tool = windows_registry::find_tool(sess.opts.target_triple.tuple(), "link.exe");
5151

5252
// If our linker looks like a batch script on Windows then to execute this
5353
// we'll need to spawn `cmd` explicitly. This is primarily done to handle

compiler/rustc_const_eval/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
const_eval_address_space_full =
22
there are no more free addresses in the address space
33
4-
const_eval_align_offset_invalid_align =
5-
`align_offset` called with non-power-of-two align: {$target_align}
6-
74
const_eval_alignment_check_failed =
85
{$msg ->
96
[AccessedPtr] accessing memory

compiler/rustc_const_eval/src/const_eval/machine.rs

+6-82
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use std::borrow::{Borrow, Cow};
22
use std::fmt;
33
use std::hash::Hash;
4-
use std::ops::ControlFlow;
54

65
use rustc_ast::Mutability;
76
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry};
87
use rustc_hir::def_id::{DefId, LocalDefId};
98
use rustc_hir::{self as hir, CRATE_HIR_ID, LangItem};
109
use rustc_middle::mir::AssertMessage;
1110
use rustc_middle::query::TyCtxtAt;
12-
use rustc_middle::ty::layout::{FnAbiOf, TyAndLayout};
11+
use rustc_middle::ty::layout::TyAndLayout;
1312
use rustc_middle::ty::{self, Ty, TyCtxt};
1413
use rustc_middle::{bug, mir};
1514
use rustc_span::Span;
@@ -23,9 +22,9 @@ use crate::errors::{LongRunning, LongRunningWarn};
2322
use crate::fluent_generated as fluent;
2423
use crate::interpret::{
2524
self, AllocId, AllocRange, ConstAllocation, CtfeProvenance, FnArg, Frame, GlobalAlloc, ImmTy,
26-
InterpCx, InterpResult, MPlaceTy, OpTy, Pointer, PointerArithmetic, RangeSet, Scalar,
27-
StackPopCleanup, compile_time_machine, interp_ok, throw_exhaust, throw_inval, throw_ub,
28-
throw_ub_custom, throw_unsup, throw_unsup_format,
25+
InterpCx, InterpResult, MPlaceTy, OpTy, Pointer, RangeSet, Scalar, compile_time_machine,
26+
interp_ok, throw_exhaust, throw_inval, throw_ub, throw_ub_custom, throw_unsup,
27+
throw_unsup_format,
2928
};
3029

3130
/// When hitting this many interpreted terminators we emit a deny by default lint
@@ -227,8 +226,8 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
227226
&mut self,
228227
instance: ty::Instance<'tcx>,
229228
args: &[FnArg<'tcx>],
230-
dest: &MPlaceTy<'tcx>,
231-
ret: Option<mir::BasicBlock>,
229+
_dest: &MPlaceTy<'tcx>,
230+
_ret: Option<mir::BasicBlock>,
232231
) -> InterpResult<'tcx, Option<ty::Instance<'tcx>>> {
233232
let def_id = instance.def_id();
234233

@@ -260,85 +259,10 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
260259
);
261260

262261
return interp_ok(Some(new_instance));
263-
} else if self.tcx.is_lang_item(def_id, LangItem::AlignOffset) {
264-
let args = self.copy_fn_args(args);
265-
// For align_offset, we replace the function call if the pointer has no address.
266-
match self.align_offset(instance, &args, dest, ret)? {
267-
ControlFlow::Continue(()) => return interp_ok(Some(instance)),
268-
ControlFlow::Break(()) => return interp_ok(None),
269-
}
270262
}
271263
interp_ok(Some(instance))
272264
}
273265

274-
/// `align_offset(ptr, target_align)` needs special handling in const eval, because the pointer
275-
/// may not have an address.
276-
///
277-
/// If `ptr` does have a known address, then we return `Continue(())` and the function call should
278-
/// proceed as normal.
279-
///
280-
/// If `ptr` doesn't have an address, but its underlying allocation's alignment is at most
281-
/// `target_align`, then we call the function again with an dummy address relative to the
282-
/// allocation.
283-
///
284-
/// If `ptr` doesn't have an address and `target_align` is stricter than the underlying
285-
/// allocation's alignment, then we return `usize::MAX` immediately.
286-
fn align_offset(
287-
&mut self,
288-
instance: ty::Instance<'tcx>,
289-
args: &[OpTy<'tcx>],
290-
dest: &MPlaceTy<'tcx>,
291-
ret: Option<mir::BasicBlock>,
292-
) -> InterpResult<'tcx, ControlFlow<()>> {
293-
assert_eq!(args.len(), 2);
294-
295-
let ptr = self.read_pointer(&args[0])?;
296-
let target_align = self.read_scalar(&args[1])?.to_target_usize(self)?;
297-
298-
if !target_align.is_power_of_two() {
299-
throw_ub_custom!(
300-
fluent::const_eval_align_offset_invalid_align,
301-
target_align = target_align,
302-
);
303-
}
304-
305-
match self.ptr_try_get_alloc_id(ptr, 0) {
306-
Ok((alloc_id, offset, _extra)) => {
307-
let (_size, alloc_align, _kind) = self.get_alloc_info(alloc_id);
308-
309-
if target_align <= alloc_align.bytes() {
310-
// Extract the address relative to the allocation base that is definitely
311-
// sufficiently aligned and call `align_offset` again.
312-
let addr = ImmTy::from_uint(offset.bytes(), args[0].layout).into();
313-
let align = ImmTy::from_uint(target_align, args[1].layout).into();
314-
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty())?;
315-
316-
// Push the stack frame with our own adjusted arguments.
317-
self.init_stack_frame(
318-
instance,
319-
self.load_mir(instance.def, None)?,
320-
fn_abi,
321-
&[FnArg::Copy(addr), FnArg::Copy(align)],
322-
/* with_caller_location = */ false,
323-
dest,
324-
StackPopCleanup::Goto { ret, unwind: mir::UnwindAction::Unreachable },
325-
)?;
326-
interp_ok(ControlFlow::Break(()))
327-
} else {
328-
// Not alignable in const, return `usize::MAX`.
329-
let usize_max = Scalar::from_target_usize(self.target_usize_max(), self);
330-
self.write_scalar(usize_max, dest)?;
331-
self.return_to_block(ret)?;
332-
interp_ok(ControlFlow::Break(()))
333-
}
334-
}
335-
Err(_addr) => {
336-
// The pointer has an address, continue with function call.
337-
interp_ok(ControlFlow::Continue(()))
338-
}
339-
}
340-
}
341-
342266
/// See documentation on the `ptr_guaranteed_cmp` intrinsic.
343267
fn guaranteed_cmp(&mut self, a: Scalar, b: Scalar) -> InterpResult<'tcx, u8> {
344268
interp_ok(match (a, b) {

compiler/rustc_driver_impl/src/lib.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
6262
use rustc_span::FileName;
6363
use rustc_span::source_map::FileLoader;
6464
use rustc_target::json::ToJson;
65-
use rustc_target::spec::{Target, TargetTriple};
65+
use rustc_target::spec::{Target, TargetTuple};
6666
use time::OffsetDateTime;
6767
use tracing::trace;
6868

@@ -731,6 +731,7 @@ fn print_crate_info(
731731
targets.sort_unstable();
732732
println_info!("{}", targets.join("\n"));
733733
}
734+
HostTuple => println_info!("{}", rustc_session::config::host_tuple()),
734735
Sysroot => println_info!("{}", sess.sysroot.display()),
735736
TargetLibdir => println_info!("{}", sess.target_tlib_path.dir.display()),
736737
TargetSpec => {
@@ -739,7 +740,7 @@ fn print_crate_info(
739740
AllTargetSpecs => {
740741
let mut targets = BTreeMap::new();
741742
for name in rustc_target::spec::TARGETS {
742-
let triple = TargetTriple::from_triple(name);
743+
let triple = TargetTuple::from_tuple(name);
743744
let target = Target::expect_builtin(&triple);
744745
targets.insert(name, target.to_json());
745746
}
@@ -918,7 +919,7 @@ pub fn version_at_macro_invocation(
918919
safe_println!("binary: {binary}");
919920
safe_println!("commit-hash: {commit_hash}");
920921
safe_println!("commit-date: {commit_date}");
921-
safe_println!("host: {}", config::host_triple());
922+
safe_println!("host: {}", config::host_tuple());
922923
safe_println!("release: {release}");
923924

924925
let debug_flags = matches.opt_strs("Z");
@@ -1495,7 +1496,7 @@ fn report_ice(
14951496
}
14961497

14971498
let version = util::version_str!().unwrap_or("unknown_version");
1498-
let triple = config::host_triple();
1499+
let tuple = config::host_tuple();
14991500

15001501
static FIRST_PANIC: AtomicBool = AtomicBool::new(true);
15011502

@@ -1505,7 +1506,7 @@ fn report_ice(
15051506
Ok(mut file) => {
15061507
dcx.emit_note(session_diagnostics::IcePath { path: path.clone() });
15071508
if FIRST_PANIC.swap(false, Ordering::SeqCst) {
1508-
let _ = write!(file, "\n\nrustc version: {version}\nplatform: {triple}");
1509+
let _ = write!(file, "\n\nrustc version: {version}\nplatform: {tuple}");
15091510
}
15101511
Some(file)
15111512
}
@@ -1518,12 +1519,12 @@ fn report_ice(
15181519
.map(PathBuf::from)
15191520
.map(|env_var| session_diagnostics::IcePathErrorEnv { env_var }),
15201521
});
1521-
dcx.emit_note(session_diagnostics::IceVersion { version, triple });
1522+
dcx.emit_note(session_diagnostics::IceVersion { version, triple: tuple });
15221523
None
15231524
}
15241525
}
15251526
} else {
1526-
dcx.emit_note(session_diagnostics::IceVersion { version, triple });
1527+
dcx.emit_note(session_diagnostics::IceVersion { version, triple: tuple });
15271528
None
15281529
};
15291530

compiler/rustc_errors/src/diagnostic_impls.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_macros::Subdiagnostic;
1111
use rustc_span::Span;
1212
use rustc_span::edition::Edition;
1313
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
14-
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
14+
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTuple};
1515
use rustc_type_ir::{ClosureKind, FloatTy};
1616
use {rustc_ast as ast, rustc_hir as hir};
1717

@@ -89,7 +89,7 @@ into_diag_arg_using_display!(
8989
MacroRulesNormalizedIdent,
9090
ParseIntError,
9191
StackProtector,
92-
&TargetTriple,
92+
&TargetTuple,
9393
SplitDebuginfo,
9494
ExitStatus,
9595
ErrCode,

compiler/rustc_hir/src/lang_items.rs

-3
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,6 @@ language_item_table! {
348348

349349
MaybeUninit, sym::maybe_uninit, maybe_uninit, Target::Union, GenericRequirement::None;
350350

351-
/// Align offset for stride != 1; must not panic.
352-
AlignOffset, sym::align_offset, align_offset_fn, Target::Fn, GenericRequirement::None;
353-
354351
Termination, sym::termination, termination, Target::Trait, GenericRequirement::None;
355352

356353
Try, sym::Try, try_trait, Target::Trait, GenericRequirement::None;

compiler/rustc_hir_typeck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ fn fatally_break_rust(tcx: TyCtxt<'_>, span: Span) -> ! {
493493
"we would appreciate a joke overview: \
494494
https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675",
495495
);
496-
diag.note(format!("rustc {} running on {}", tcx.sess.cfg_version, config::host_triple(),));
496+
diag.note(format!("rustc {} running on {}", tcx.sess.cfg_version, config::host_tuple(),));
497497
if let Some((flags, excluded_cargo_defaults)) = rustc_session::utils::extra_compiler_flags() {
498498
diag.note(format!("compiler flags: {}", flags.join(" ")));
499499
if excluded_cargo_defaults {

compiler/rustc_interface/src/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_data_structures::sync;
1111
use rustc_metadata::{DylibError, load_symbol_from_dylib};
1212
use rustc_middle::ty::CurrentGcx;
1313
use rustc_parse::validate_attr;
14-
use rustc_session::config::{Cfg, OutFileName, OutputFilenames, OutputTypes, host_triple};
14+
use rustc_session::config::{Cfg, OutFileName, OutputFilenames, OutputTypes, host_tuple};
1515
use rustc_session::filesearch::sysroot_candidates;
1616
use rustc_session::lint::{self, BuiltinLintDiag, LintBuffer};
1717
use rustc_session::output::{CRATE_TYPES, categorize_crate_type};
@@ -310,7 +310,7 @@ fn get_codegen_sysroot(
310310
"cannot load the default codegen backend twice"
311311
);
312312

313-
let target = host_triple();
313+
let target = host_tuple();
314314
let sysroot_candidates = sysroot_candidates();
315315

316316
let sysroot = iter::once(sysroot)

compiler/rustc_metadata/src/creader.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_session::search_paths::PathKind;
3030
use rustc_span::edition::Edition;
3131
use rustc_span::symbol::{Ident, Symbol, sym};
3232
use rustc_span::{DUMMY_SP, Span};
33-
use rustc_target::spec::{PanicStrategy, Target, TargetTriple};
33+
use rustc_target::spec::{PanicStrategy, Target, TargetTuple};
3434
use tracing::{debug, info, trace};
3535

3636
use crate::errors;
@@ -506,7 +506,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
506506
locator.reset();
507507
locator.is_proc_macro = true;
508508
locator.target = &self.sess.host;
509-
locator.triple = TargetTriple::from_triple(config::host_triple());
509+
locator.tuple = TargetTuple::from_tuple(config::host_tuple());
510510
locator.filesearch = self.sess.host_filesearch(path_kind);
511511

512512
let Some(host_result) = self.load(locator)? else {
@@ -635,7 +635,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
635635
// FIXME: why is this condition necessary? It was adding in #33625 but I
636636
// don't know why and the original author doesn't remember ...
637637
let can_reuse_cratenum =
638-
locator.triple == self.sess.opts.target_triple || locator.is_proc_macro;
638+
locator.tuple == self.sess.opts.target_triple || locator.is_proc_macro;
639639
Ok(Some(if can_reuse_cratenum {
640640
let mut result = LoadResult::Loaded(library);
641641
for (cnum, data) in self.cstore.iter_crate_data() {

compiler/rustc_metadata/src/errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_errors::codes::*;
55
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level};
66
use rustc_macros::{Diagnostic, Subdiagnostic};
77
use rustc_span::{Span, Symbol, sym};
8-
use rustc_target::spec::{PanicStrategy, TargetTriple};
8+
use rustc_target::spec::{PanicStrategy, TargetTuple};
99

1010
use crate::fluent_generated as fluent;
1111
use crate::locator::CrateFlavor;
@@ -630,7 +630,7 @@ pub struct CannotFindCrate {
630630
pub current_crate: String,
631631
pub is_nightly_build: bool,
632632
pub profiler_runtime: Symbol,
633-
pub locator_triple: TargetTriple,
633+
pub locator_triple: TargetTuple,
634634
pub is_ui_testing: bool,
635635
}
636636

@@ -641,7 +641,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate {
641641
diag.arg("crate_name", self.crate_name);
642642
diag.arg("current_crate", self.current_crate);
643643
diag.arg("add_info", self.add_info);
644-
diag.arg("locator_triple", self.locator_triple.triple());
644+
diag.arg("locator_triple", self.locator_triple.tuple());
645645
diag.code(E0463);
646646
diag.span(self.span);
647647
if self.crate_name == sym::std || self.crate_name == sym::core {

0 commit comments

Comments
 (0)