Skip to content

Commit 6161e8e

Browse files
committed
Auto merge of rust-lang#132485 - matthiaskrgr:rollup-hz0nnxu, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#125579 (Add `--print host-tuple` to print host target tuple) - rust-lang#132398 (Add a couple of intra-doc links to str) - rust-lang#132453 (Also treat `impl` definition parent as transparent regarding modules) - rust-lang#132457 (Remove needless #![feature(asm_experimental_arch)] from loongarch64 inline assembly test) - rust-lang#132465 (refactor(config): remove FIXME statement in comment of `omit-git-hash`) - rust-lang#132471 (Add a bunch of mailmap entries) Failed merges: - rust-lang#131037 (Move versioned Apple LLVM targets from `rustc_target` to `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ef972a3 + 4691f71 commit 6161e8e

File tree

46 files changed

+285
-179
lines changed

Some content is hidden

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

46 files changed

+285
-179
lines changed

.mailmap

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Alexis Beingessner <a.beingessner@gmail.com>
3131
Alfie John <alfie@alfie.wtf> Alfie John <alfiej@fastmail.fm>
3232
Alona Enraght-Moony <code@alona.page> <nixon.emoony@gmail.com>
3333
Alona Enraght-Moony <code@alona.page> <nixon@caminus.local>
34+
Alona Enraght-Moony <code@alona.page> <contact@alona.page>
3435
Amanda Stjerna <mail@amandastjerna.se> <albin.stjerna@gmail.com>
3536
Amanda Stjerna <mail@amandastjerna.se> <amanda.stjerna@it.uu.se>
3637
Amos Onn <amosonn@gmail.com>
@@ -75,6 +76,7 @@ Benjamin Jackman <ben@jackman.biz>
7576
Benoît Cortier <benoit.cortier@fried-world.eu>
7677
Bheesham Persaud <bheesham123@hotmail.com> Bheesham Persaud <bheesham.persaud@live.ca>
7778
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3@users.noreply.github.com>
79+
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3_gh@protonmail.com>
7880
Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
7981
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
8082
blyxyas <blyxyas@gmail.com> Alejandra González <blyxyas@gmail.com>
@@ -172,6 +174,7 @@ Dzmitry Malyshau <kvarkus@gmail.com>
172174
E. Dunham <edunham@mozilla.com> edunham <edunham@mozilla.com>
173175
Ed Barnard <eabarnard@gmail.com>
174176
Eduard-Mihai Burtescu <edy.burt@gmail.com>
177+
Eduard-Mihai Burtescu <edy.burt@gmail.com> <eddyb@lyken.rs>
175178
Eduardo Bautista <me@eduardobautista.com> <=>
176179
Eduardo Bautista <me@eduardobautista.com> <mail@eduardobautista.com>
177180
Eduardo Broto <ebroto@tutanota.com>
@@ -186,6 +189,7 @@ Erick Tryzelaar <erick.tryzelaar@gmail.com> <etryzelaar@iqt.org>
186189
Erik Desjardins <erikdesjardins@users.noreply.github.com>
187190
Erik Jensen <erikjensen@rkjnsn.net>
188191
Erin Power <xampprocky@gmail.com>
192+
Erin Power <xampprocky@gmail.com> <xampprocky@icloud.com>
189193
Erin Power <xampprocky@gmail.com> <theaaronepower@gmail.com>
190194
Erin Power <xampprocky@gmail.com> <Aaronepower@users.noreply.github.com>
191195
Esteban Küber <esteban@kuber.com.ar>
@@ -198,6 +202,7 @@ F001 <changchun.fan@qq.com>
198202
Fabian Kössel <fkjogu@users.noreply.github.com>
199203
Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
200204
Felix S. Klock II <pnkfelix@pnkfx.org> Felix S Klock II <pnkfelix@pnkfx.org>
205+
Felix S. Klock II <pnkfelix@pnkfx.org> <pnkfelix@mozilla.com>
201206
Félix Saparelli <felix@passcod.name>
202207
Flaper Fesp <flaper87@gmail.com>
203208
Florian Berger <fbergr@gmail.com>
@@ -245,7 +250,7 @@ Irina Popa <irinagpopa@gmail.com>
245250
Ivan Ivaschenko <defuz.net@gmail.com>
246251
ivan tkachenko <me@ratijas.tk>
247252
J. J. Weber <jjweber@gmail.com>
248-
Jack Huey <jack.huey@umassmed.edu>
253+
Jack Huey <jack.huey@umassmed.edu> <jackh726@gmail.com>
249254
Jacob <jacob.macritchie@gmail.com>
250255
Jacob Greenfield <xales@naveria.com>
251256
Jacob Pratt <jacob@jhpratt.dev> <the.z.cuber@gmail.com>
@@ -292,6 +297,7 @@ John Clements <clements@racket-lang.org> <clements@brinckerhoff.org>
292297
John Hodge <acessdev@gmail.com> John Hodge <tpg@mutabah.net>
293298
John Hörnvall <trolledwoods@gmail.com>
294299
John Kåre Alsaker <john.kare.alsaker@gmail.com>
300+
John Kåre Alsaker <john.kare.alsaker@gmail.com> <zoxc32@gmail.com>
295301
John Talling <inrustwetrust@users.noreply.github.com>
296302
John Van Enk <vanenkj@gmail.com>
297303
Jonas Tepe <jonasprogrammer@gmail.com>
@@ -368,6 +374,7 @@ Lukas Lueg <lukas.lueg@gmail.com>
368374
Luke Metz <luke.metz@students.olin.edu>
369375
Luqman Aden <me@luqman.ca> <laden@csclub.uwaterloo.ca>
370376
Luqman Aden <me@luqman.ca> <laden@mozilla.com>
377+
Luqman Aden <me@luqman.ca> <rust@luqman.ca>
371378
Lzu Tao <taolzu@gmail.com>
372379
Maik Klein <maikklein@googlemail.com>
373380
Malo Jaffré <jaffre.malo@gmail.com>
@@ -409,6 +416,7 @@ mental <m3nta1@yahoo.com>
409416
mibac138 <5672750+mibac138@users.noreply.github.com>
410417
Michael Williams <m.t.williams@live.com>
411418
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
419+
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail.com>
412420
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@users.noreply.github.com>
413421
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@posteo.net>
414422
Michael Zhang <hmperson1@gmail.com>
@@ -422,6 +430,7 @@ Ms2ger <ms2ger@gmail.com> <Ms2ger@gmail.com>
422430
msizanoen1 <qtmlabs@protonmail.com>
423431
Mukilan Thiagarajan <mukilanthiagarajan@gmail.com>
424432
Nadrieril Feneanar <Nadrieril@users.noreply.github.com>
433+
Nadrieril Feneanar <Nadrieril@users.noreply.github.com> <nadrieril+git@gmail.com>
425434
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
426435
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
427436
Nathan Ringo <remexre@gmail.com>
@@ -442,6 +451,8 @@ Niclas Schwarzlose <15schnic@gmail.com>
442451
Nicolas Abram <abramlujan@gmail.com>
443452
Nicole Mazzuca <npmazzuca@gmail.com>
444453
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <48135649+Nilstrieb@users.noreply.github.com>
454+
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <nilstrieb@gmail.com>
455+
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <nora@noratrieb.dev>
445456
Nif Ward <nif.ward@gmail.com>
446457
Nika Layzell <nika@thelayzells.com> <michael@thelayzells.com>
447458
NODA Kai <nodakai@gmail.com>
@@ -460,6 +471,7 @@ Oliver Scherer <oli-obk@users.noreply.github.com> <github6541940@oli-obk.de>
460471
Oliver Scherer <oli-obk@users.noreply.github.com> <public.oliver.schneider@kit.edu>
461472
Oliver Scherer <oli-obk@users.noreply.github.com> <oliver.schneider@kit.edu>
462473
Oliver Scherer <oli-obk@users.noreply.github.com> <obk8176014uqher834@olio-obk.de>
474+
Oliver Scherer <oli-obk@users.noreply.github.com> <rustc-contact@oli-obk.de>
463475
Oliver Scherer <oli-obk@users.noreply.github.com>
464476
Onur Özkan <onurozkan.dev@outlook.com> <work@onurozkan.dev>
465477
Onur Özkan <onurozkan.dev@outlook.com>
@@ -496,6 +508,7 @@ Raphaël Huchet <rap2hpoutre@users.noreply.github.com>
496508
rChaser53 <tayoshizawa29@gmail.com>
497509
Rémy Rakic <remy.rakic@gmail.com>
498510
Rémy Rakic <remy.rakic@gmail.com> <remy.rakic+github@gmail.com>
511+
Rémy Rakic <remy.rakic@gmail.com> <remy.rakic+rust@gmail.com>
499512
Renato Riccieri Santos Zannon <renato@rrsz.com.br>
500513
Richard Diamond <wichard@vitalitystudios.com> <wichard@hahbee.co>
501514
Ricky Hosfelt <ricky@hosfelt.io>
@@ -525,6 +538,7 @@ Samuel Tardieu <sam@rfc1149.net>
525538
Santiago Pastorino <spastorino@gmail.com>
526539
Santiago Pastorino <spastorino@gmail.com> <santiago@wyeworks.com>
527540
Scott McMurray <scottmcm@users.noreply.github.com>
541+
Scott McMurray <scottmcm@users.noreply.github.com> <smcmurray@acm.org>
528542
Scott Olson <scott@solson.me> Scott Olson <scott@scott-olson.org>
529543
Sean Gillespie <sean.william.g@gmail.com> swgillespie <sean.william.g@gmail.com>
530544
Seiichi Uchida <seuchida@gmail.com>
@@ -536,6 +550,7 @@ Shyam Sundar B <shyambaskaran@outlook.com>
536550
Simon Barber-Dueck <sbarberdueck@gmail.com> Simon BD <simon@server>
537551
Simon Sapin <simon@exyr.org> <simon.sapin@exyr.org>
538552
Simonas Kazlauskas <git@kazlauskas.me> Simonas Kazlauskas <github@kazlauskas.me>
553+
Simonas Kazlauskas <git@kazlauskas.me> <simonas+t-compiler@kazlauskas.me>
539554
Siva Prasad <sivaauturic@gmail.com>
540555
Smittyvb <me@smitop.com>
541556
Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
@@ -556,6 +571,8 @@ Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
556571
Tau Gärtli <git@tau.garden> <ruben.schmidmeister@icloud.com>
557572
Tero Hänninen <lgvz@users.noreply.github.com> Tero Hänninen <tejohann@kapsi.fi>
558573
The8472 <git@infinite-source.de>
574+
The8472 <git@infinite-source.de> <the8472.rs@infinite-source.de>
575+
The8472 <git@infinite-source.de> <the8472@users.noreply.github.com>
559576
Theo Belaire <theo.belaire@gmail.com> Theo Belaire <tyr.god.of.war.42@gmail.com>
560577
Theodore Luo Wang <wangtheo662@gmail.com>
561578
Thiago Pontes <email@thiago.me> thiagopnts <thiagopnts@gmail.com>
@@ -593,7 +610,8 @@ Waffle Lapkin <waffle.lapkin@tasking.com>
593610
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
594611
whitequark <whitequark@whitequark.org>
595612
William Ting <io@williamting.com> <william.h.ting@gmail.com>
596-
Wim Looman <wim@nemo157.com>
613+
Wim Looman <wim@nemo157.com> <rust-lang@nemo157.com>
614+
Wim Looman <wim@nemo157.com> <git@nemo157.com>
597615
Without Boats <woboats@gmail.com>
598616
Without Boats <woboats@gmail.com> <boats@mozilla.com>
599617
Xinye Tao <xy.tao@outlook.com>

compiler/rustc_codegen_cranelift/src/global_asm.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ fn create_section_with_flags_asm(section_name: &str, section_flags: &str, data:
945945
}
946946

947947
fn target_is_apple(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
948-
let triple = cgcx.opts.target_triple.triple();
948+
let triple = cgcx.opts.target_triple.tuple();
949949
triple.contains("-ios")
950950
|| triple.contains("-darwin")
951951
|| triple.contains("-tvos")
@@ -954,7 +954,7 @@ fn target_is_apple(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
954954
}
955955

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

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

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ fn link_natively(
996996
{
997997
let is_vs_installed = windows_registry::find_vs_version().is_ok();
998998
let has_linker = windows_registry::find_tool(
999-
sess.opts.target_triple.triple(),
999+
sess.opts.target_triple.tuple(),
10001000
"link.exe",
10011001
)
10021002
.is_some();
@@ -1322,10 +1322,8 @@ fn link_sanitizer_runtime(
13221322
} else {
13231323
let default_sysroot =
13241324
filesearch::get_or_default_sysroot().expect("Failed finding sysroot");
1325-
let default_tlib = filesearch::make_target_lib_path(
1326-
&default_sysroot,
1327-
sess.opts.target_triple.triple(),
1328-
);
1325+
let default_tlib =
1326+
filesearch::make_target_lib_path(&default_sysroot, sess.opts.target_triple.tuple());
13291327
default_tlib
13301328
}
13311329
}

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 1 deletion
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_driver_impl/src/lib.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
6161
use rustc_span::FileName;
6262
use rustc_span::source_map::FileLoader;
6363
use rustc_target::json::ToJson;
64-
use rustc_target::spec::{Target, TargetTriple};
64+
use rustc_target::spec::{Target, TargetTuple};
6565
use time::OffsetDateTime;
6666
use tracing::trace;
6767

@@ -730,6 +730,7 @@ fn print_crate_info(
730730
targets.sort_unstable();
731731
println_info!("{}", targets.join("\n"));
732732
}
733+
HostTuple => println_info!("{}", rustc_session::config::host_tuple()),
733734
Sysroot => println_info!("{}", sess.sysroot.display()),
734735
TargetLibdir => println_info!("{}", sess.target_tlib_path.dir.display()),
735736
TargetSpec => {
@@ -738,7 +739,7 @@ fn print_crate_info(
738739
AllTargetSpecs => {
739740
let mut targets = BTreeMap::new();
740741
for name in rustc_target::spec::TARGETS {
741-
let triple = TargetTriple::from_triple(name);
742+
let triple = TargetTuple::from_tuple(name);
742743
let target = Target::expect_builtin(&triple);
743744
targets.insert(name, target.to_json());
744745
}
@@ -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

Lines changed: 2 additions & 2 deletions
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_typeck/src/lib.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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_lint/src/non_local_def.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,15 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
151151
// };
152152
// };
153153
// ```
154+
//
155+
// It isn't possible to mix a impl in a module with const-anon, but an item can
156+
// be put inside a module and referenced by a impl so we also have to treat the
157+
// item parent as transparent to module and for consistency we have to do the same
158+
// for impl, otherwise the item-def and impl-def won't have the same parent.
154159
let outermost_impl_parent = peel_parent_while(cx.tcx, parent, |tcx, did| {
155-
tcx.def_kind(did) == DefKind::Const
156-
&& tcx.opt_item_name(did) == Some(kw::Underscore)
160+
tcx.def_kind(did) == DefKind::Mod
161+
|| (tcx.def_kind(did) == DefKind::Const
162+
&& tcx.opt_item_name(did) == Some(kw::Underscore))
157163
});
158164

159165
// 2. We check if any of the paths reference a the `impl`-parent.

compiler/rustc_metadata/src/creader.rs

Lines changed: 3 additions & 3 deletions
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() {

0 commit comments

Comments
 (0)