mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 14:23:45 +00:00
Auto merge of #132497 - matthiaskrgr:rollup-gaskcn0, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #131037 (Move versioned Apple LLVM targets from `rustc_target` to `rustc_codegen_ssa`) - #132170 (Add a Few Codegen Tests) - #132333 (rust_analyzer_helix.toml: add library/ manifest) - #132398 (Add a couple of intra-doc links to str) - #132411 (CI: switch dist-x86_64-musl to free runner) - #132453 (Also treat `impl` definition parent as transparent regarding modules) - #132457 (Remove needless #![feature(asm_experimental_arch)] from loongarch64 inline assembly test) - #132465 (refactor(config): remove FIXME statement in comment of `omit-git-hash`) - #132466 (Account for late-bound depth when capturing all opaque lifetimes.) - #132471 (Add a bunch of mailmap entries) - #132488 (Remove or fix some more `FIXME(async_closure)`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
588a420350
22
.mailmap
22
.mailmap
@ -31,6 +31,7 @@ Alexis Beingessner <a.beingessner@gmail.com>
|
|||||||
Alfie John <alfie@alfie.wtf> Alfie John <alfiej@fastmail.fm>
|
Alfie John <alfie@alfie.wtf> Alfie John <alfiej@fastmail.fm>
|
||||||
Alona Enraght-Moony <code@alona.page> <nixon.emoony@gmail.com>
|
Alona Enraght-Moony <code@alona.page> <nixon.emoony@gmail.com>
|
||||||
Alona Enraght-Moony <code@alona.page> <nixon@caminus.local>
|
Alona Enraght-Moony <code@alona.page> <nixon@caminus.local>
|
||||||
|
Alona Enraght-Moony <code@alona.page> <contact@alona.page>
|
||||||
Amanda Stjerna <mail@amandastjerna.se> <albin.stjerna@gmail.com>
|
Amanda Stjerna <mail@amandastjerna.se> <albin.stjerna@gmail.com>
|
||||||
Amanda Stjerna <mail@amandastjerna.se> <amanda.stjerna@it.uu.se>
|
Amanda Stjerna <mail@amandastjerna.se> <amanda.stjerna@it.uu.se>
|
||||||
Amos Onn <amosonn@gmail.com>
|
Amos Onn <amosonn@gmail.com>
|
||||||
@ -75,6 +76,7 @@ Benjamin Jackman <ben@jackman.biz>
|
|||||||
Benoît Cortier <benoit.cortier@fried-world.eu>
|
Benoît Cortier <benoit.cortier@fried-world.eu>
|
||||||
Bheesham Persaud <bheesham123@hotmail.com> Bheesham Persaud <bheesham.persaud@live.ca>
|
Bheesham Persaud <bheesham123@hotmail.com> Bheesham Persaud <bheesham.persaud@live.ca>
|
||||||
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3@users.noreply.github.com>
|
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3@users.noreply.github.com>
|
||||||
|
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3_gh@protonmail.com>
|
||||||
Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
|
Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
|
||||||
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
|
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
|
||||||
blyxyas <blyxyas@gmail.com> Alejandra González <blyxyas@gmail.com>
|
blyxyas <blyxyas@gmail.com> Alejandra González <blyxyas@gmail.com>
|
||||||
@ -172,6 +174,7 @@ Dzmitry Malyshau <kvarkus@gmail.com>
|
|||||||
E. Dunham <edunham@mozilla.com> edunham <edunham@mozilla.com>
|
E. Dunham <edunham@mozilla.com> edunham <edunham@mozilla.com>
|
||||||
Ed Barnard <eabarnard@gmail.com>
|
Ed Barnard <eabarnard@gmail.com>
|
||||||
Eduard-Mihai Burtescu <edy.burt@gmail.com>
|
Eduard-Mihai Burtescu <edy.burt@gmail.com>
|
||||||
|
Eduard-Mihai Burtescu <edy.burt@gmail.com> <eddyb@lyken.rs>
|
||||||
Eduardo Bautista <me@eduardobautista.com> <=>
|
Eduardo Bautista <me@eduardobautista.com> <=>
|
||||||
Eduardo Bautista <me@eduardobautista.com> <mail@eduardobautista.com>
|
Eduardo Bautista <me@eduardobautista.com> <mail@eduardobautista.com>
|
||||||
Eduardo Broto <ebroto@tutanota.com>
|
Eduardo Broto <ebroto@tutanota.com>
|
||||||
@ -186,6 +189,7 @@ Erick Tryzelaar <erick.tryzelaar@gmail.com> <etryzelaar@iqt.org>
|
|||||||
Erik Desjardins <erikdesjardins@users.noreply.github.com>
|
Erik Desjardins <erikdesjardins@users.noreply.github.com>
|
||||||
Erik Jensen <erikjensen@rkjnsn.net>
|
Erik Jensen <erikjensen@rkjnsn.net>
|
||||||
Erin Power <xampprocky@gmail.com>
|
Erin Power <xampprocky@gmail.com>
|
||||||
|
Erin Power <xampprocky@gmail.com> <xampprocky@icloud.com>
|
||||||
Erin Power <xampprocky@gmail.com> <theaaronepower@gmail.com>
|
Erin Power <xampprocky@gmail.com> <theaaronepower@gmail.com>
|
||||||
Erin Power <xampprocky@gmail.com> <Aaronepower@users.noreply.github.com>
|
Erin Power <xampprocky@gmail.com> <Aaronepower@users.noreply.github.com>
|
||||||
Esteban Küber <esteban@kuber.com.ar>
|
Esteban Küber <esteban@kuber.com.ar>
|
||||||
@ -198,6 +202,7 @@ F001 <changchun.fan@qq.com>
|
|||||||
Fabian Kössel <fkjogu@users.noreply.github.com>
|
Fabian Kössel <fkjogu@users.noreply.github.com>
|
||||||
Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
|
Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
|
||||||
Felix S. Klock II <pnkfelix@pnkfx.org> Felix S Klock II <pnkfelix@pnkfx.org>
|
Felix S. Klock II <pnkfelix@pnkfx.org> Felix S Klock II <pnkfelix@pnkfx.org>
|
||||||
|
Felix S. Klock II <pnkfelix@pnkfx.org> <pnkfelix@mozilla.com>
|
||||||
Félix Saparelli <felix@passcod.name>
|
Félix Saparelli <felix@passcod.name>
|
||||||
Flaper Fesp <flaper87@gmail.com>
|
Flaper Fesp <flaper87@gmail.com>
|
||||||
Florian Berger <fbergr@gmail.com>
|
Florian Berger <fbergr@gmail.com>
|
||||||
@ -245,7 +250,7 @@ Irina Popa <irinagpopa@gmail.com>
|
|||||||
Ivan Ivaschenko <defuz.net@gmail.com>
|
Ivan Ivaschenko <defuz.net@gmail.com>
|
||||||
ivan tkachenko <me@ratijas.tk>
|
ivan tkachenko <me@ratijas.tk>
|
||||||
J. J. Weber <jjweber@gmail.com>
|
J. J. Weber <jjweber@gmail.com>
|
||||||
Jack Huey <jack.huey@umassmed.edu>
|
Jack Huey <jack.huey@umassmed.edu> <jackh726@gmail.com>
|
||||||
Jacob <jacob.macritchie@gmail.com>
|
Jacob <jacob.macritchie@gmail.com>
|
||||||
Jacob Greenfield <xales@naveria.com>
|
Jacob Greenfield <xales@naveria.com>
|
||||||
Jacob Pratt <jacob@jhpratt.dev> <the.z.cuber@gmail.com>
|
Jacob Pratt <jacob@jhpratt.dev> <the.z.cuber@gmail.com>
|
||||||
@ -292,6 +297,7 @@ John Clements <clements@racket-lang.org> <clements@brinckerhoff.org>
|
|||||||
John Hodge <acessdev@gmail.com> John Hodge <tpg@mutabah.net>
|
John Hodge <acessdev@gmail.com> John Hodge <tpg@mutabah.net>
|
||||||
John Hörnvall <trolledwoods@gmail.com>
|
John Hörnvall <trolledwoods@gmail.com>
|
||||||
John Kåre Alsaker <john.kare.alsaker@gmail.com>
|
John Kåre Alsaker <john.kare.alsaker@gmail.com>
|
||||||
|
John Kåre Alsaker <john.kare.alsaker@gmail.com> <zoxc32@gmail.com>
|
||||||
John Talling <inrustwetrust@users.noreply.github.com>
|
John Talling <inrustwetrust@users.noreply.github.com>
|
||||||
John Van Enk <vanenkj@gmail.com>
|
John Van Enk <vanenkj@gmail.com>
|
||||||
Jonas Tepe <jonasprogrammer@gmail.com>
|
Jonas Tepe <jonasprogrammer@gmail.com>
|
||||||
@ -368,6 +374,7 @@ Lukas Lueg <lukas.lueg@gmail.com>
|
|||||||
Luke Metz <luke.metz@students.olin.edu>
|
Luke Metz <luke.metz@students.olin.edu>
|
||||||
Luqman Aden <me@luqman.ca> <laden@csclub.uwaterloo.ca>
|
Luqman Aden <me@luqman.ca> <laden@csclub.uwaterloo.ca>
|
||||||
Luqman Aden <me@luqman.ca> <laden@mozilla.com>
|
Luqman Aden <me@luqman.ca> <laden@mozilla.com>
|
||||||
|
Luqman Aden <me@luqman.ca> <rust@luqman.ca>
|
||||||
Lzu Tao <taolzu@gmail.com>
|
Lzu Tao <taolzu@gmail.com>
|
||||||
Maik Klein <maikklein@googlemail.com>
|
Maik Klein <maikklein@googlemail.com>
|
||||||
Malo Jaffré <jaffre.malo@gmail.com>
|
Malo Jaffré <jaffre.malo@gmail.com>
|
||||||
@ -409,6 +416,7 @@ mental <m3nta1@yahoo.com>
|
|||||||
mibac138 <5672750+mibac138@users.noreply.github.com>
|
mibac138 <5672750+mibac138@users.noreply.github.com>
|
||||||
Michael Williams <m.t.williams@live.com>
|
Michael Williams <m.t.williams@live.com>
|
||||||
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
|
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
|
||||||
|
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail.com>
|
||||||
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@users.noreply.github.com>
|
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@users.noreply.github.com>
|
||||||
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@posteo.net>
|
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@posteo.net>
|
||||||
Michael Zhang <hmperson1@gmail.com>
|
Michael Zhang <hmperson1@gmail.com>
|
||||||
@ -422,6 +430,7 @@ Ms2ger <ms2ger@gmail.com> <Ms2ger@gmail.com>
|
|||||||
msizanoen1 <qtmlabs@protonmail.com>
|
msizanoen1 <qtmlabs@protonmail.com>
|
||||||
Mukilan Thiagarajan <mukilanthiagarajan@gmail.com>
|
Mukilan Thiagarajan <mukilanthiagarajan@gmail.com>
|
||||||
Nadrieril Feneanar <Nadrieril@users.noreply.github.com>
|
Nadrieril Feneanar <Nadrieril@users.noreply.github.com>
|
||||||
|
Nadrieril Feneanar <Nadrieril@users.noreply.github.com> <nadrieril+git@gmail.com>
|
||||||
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
|
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
|
||||||
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
|
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
|
||||||
Nathan Ringo <remexre@gmail.com>
|
Nathan Ringo <remexre@gmail.com>
|
||||||
@ -442,6 +451,8 @@ Niclas Schwarzlose <15schnic@gmail.com>
|
|||||||
Nicolas Abram <abramlujan@gmail.com>
|
Nicolas Abram <abramlujan@gmail.com>
|
||||||
Nicole Mazzuca <npmazzuca@gmail.com>
|
Nicole Mazzuca <npmazzuca@gmail.com>
|
||||||
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <48135649+Nilstrieb@users.noreply.github.com>
|
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <48135649+Nilstrieb@users.noreply.github.com>
|
||||||
|
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <nilstrieb@gmail.com>
|
||||||
|
Noratrieb <48135649+Noratrieb@users.noreply.github.com> <nora@noratrieb.dev>
|
||||||
Nif Ward <nif.ward@gmail.com>
|
Nif Ward <nif.ward@gmail.com>
|
||||||
Nika Layzell <nika@thelayzells.com> <michael@thelayzells.com>
|
Nika Layzell <nika@thelayzells.com> <michael@thelayzells.com>
|
||||||
NODA Kai <nodakai@gmail.com>
|
NODA Kai <nodakai@gmail.com>
|
||||||
@ -460,6 +471,7 @@ Oliver Scherer <oli-obk@users.noreply.github.com> <github6541940@oli-obk.de>
|
|||||||
Oliver Scherer <oli-obk@users.noreply.github.com> <public.oliver.schneider@kit.edu>
|
Oliver Scherer <oli-obk@users.noreply.github.com> <public.oliver.schneider@kit.edu>
|
||||||
Oliver Scherer <oli-obk@users.noreply.github.com> <oliver.schneider@kit.edu>
|
Oliver Scherer <oli-obk@users.noreply.github.com> <oliver.schneider@kit.edu>
|
||||||
Oliver Scherer <oli-obk@users.noreply.github.com> <obk8176014uqher834@olio-obk.de>
|
Oliver Scherer <oli-obk@users.noreply.github.com> <obk8176014uqher834@olio-obk.de>
|
||||||
|
Oliver Scherer <oli-obk@users.noreply.github.com> <rustc-contact@oli-obk.de>
|
||||||
Oliver Scherer <oli-obk@users.noreply.github.com>
|
Oliver Scherer <oli-obk@users.noreply.github.com>
|
||||||
Onur Özkan <onurozkan.dev@outlook.com> <work@onurozkan.dev>
|
Onur Özkan <onurozkan.dev@outlook.com> <work@onurozkan.dev>
|
||||||
Onur Özkan <onurozkan.dev@outlook.com>
|
Onur Özkan <onurozkan.dev@outlook.com>
|
||||||
@ -496,6 +508,7 @@ Raphaël Huchet <rap2hpoutre@users.noreply.github.com>
|
|||||||
rChaser53 <tayoshizawa29@gmail.com>
|
rChaser53 <tayoshizawa29@gmail.com>
|
||||||
Rémy Rakic <remy.rakic@gmail.com>
|
Rémy Rakic <remy.rakic@gmail.com>
|
||||||
Rémy Rakic <remy.rakic@gmail.com> <remy.rakic+github@gmail.com>
|
Rémy Rakic <remy.rakic@gmail.com> <remy.rakic+github@gmail.com>
|
||||||
|
Rémy Rakic <remy.rakic@gmail.com> <remy.rakic+rust@gmail.com>
|
||||||
Renato Riccieri Santos Zannon <renato@rrsz.com.br>
|
Renato Riccieri Santos Zannon <renato@rrsz.com.br>
|
||||||
Richard Diamond <wichard@vitalitystudios.com> <wichard@hahbee.co>
|
Richard Diamond <wichard@vitalitystudios.com> <wichard@hahbee.co>
|
||||||
Ricky Hosfelt <ricky@hosfelt.io>
|
Ricky Hosfelt <ricky@hosfelt.io>
|
||||||
@ -525,6 +538,7 @@ Samuel Tardieu <sam@rfc1149.net>
|
|||||||
Santiago Pastorino <spastorino@gmail.com>
|
Santiago Pastorino <spastorino@gmail.com>
|
||||||
Santiago Pastorino <spastorino@gmail.com> <santiago@wyeworks.com>
|
Santiago Pastorino <spastorino@gmail.com> <santiago@wyeworks.com>
|
||||||
Scott McMurray <scottmcm@users.noreply.github.com>
|
Scott McMurray <scottmcm@users.noreply.github.com>
|
||||||
|
Scott McMurray <scottmcm@users.noreply.github.com> <smcmurray@acm.org>
|
||||||
Scott Olson <scott@solson.me> Scott Olson <scott@scott-olson.org>
|
Scott Olson <scott@solson.me> Scott Olson <scott@scott-olson.org>
|
||||||
Sean Gillespie <sean.william.g@gmail.com> swgillespie <sean.william.g@gmail.com>
|
Sean Gillespie <sean.william.g@gmail.com> swgillespie <sean.william.g@gmail.com>
|
||||||
Seiichi Uchida <seuchida@gmail.com>
|
Seiichi Uchida <seuchida@gmail.com>
|
||||||
@ -536,6 +550,7 @@ Shyam Sundar B <shyambaskaran@outlook.com>
|
|||||||
Simon Barber-Dueck <sbarberdueck@gmail.com> Simon BD <simon@server>
|
Simon Barber-Dueck <sbarberdueck@gmail.com> Simon BD <simon@server>
|
||||||
Simon Sapin <simon@exyr.org> <simon.sapin@exyr.org>
|
Simon Sapin <simon@exyr.org> <simon.sapin@exyr.org>
|
||||||
Simonas Kazlauskas <git@kazlauskas.me> Simonas Kazlauskas <github@kazlauskas.me>
|
Simonas Kazlauskas <git@kazlauskas.me> Simonas Kazlauskas <github@kazlauskas.me>
|
||||||
|
Simonas Kazlauskas <git@kazlauskas.me> <simonas+t-compiler@kazlauskas.me>
|
||||||
Siva Prasad <sivaauturic@gmail.com>
|
Siva Prasad <sivaauturic@gmail.com>
|
||||||
Smittyvb <me@smitop.com>
|
Smittyvb <me@smitop.com>
|
||||||
Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
|
Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
|
||||||
@ -556,6 +571,8 @@ Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
|
|||||||
Tau Gärtli <git@tau.garden> <ruben.schmidmeister@icloud.com>
|
Tau Gärtli <git@tau.garden> <ruben.schmidmeister@icloud.com>
|
||||||
Tero Hänninen <lgvz@users.noreply.github.com> Tero Hänninen <tejohann@kapsi.fi>
|
Tero Hänninen <lgvz@users.noreply.github.com> Tero Hänninen <tejohann@kapsi.fi>
|
||||||
The8472 <git@infinite-source.de>
|
The8472 <git@infinite-source.de>
|
||||||
|
The8472 <git@infinite-source.de> <the8472.rs@infinite-source.de>
|
||||||
|
The8472 <git@infinite-source.de> <the8472@users.noreply.github.com>
|
||||||
Theo Belaire <theo.belaire@gmail.com> Theo Belaire <tyr.god.of.war.42@gmail.com>
|
Theo Belaire <theo.belaire@gmail.com> Theo Belaire <tyr.god.of.war.42@gmail.com>
|
||||||
Theodore Luo Wang <wangtheo662@gmail.com>
|
Theodore Luo Wang <wangtheo662@gmail.com>
|
||||||
Thiago Pontes <email@thiago.me> thiagopnts <thiagopnts@gmail.com>
|
Thiago Pontes <email@thiago.me> thiagopnts <thiagopnts@gmail.com>
|
||||||
@ -593,7 +610,8 @@ Waffle Lapkin <waffle.lapkin@tasking.com>
|
|||||||
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
|
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
|
||||||
whitequark <whitequark@whitequark.org>
|
whitequark <whitequark@whitequark.org>
|
||||||
William Ting <io@williamting.com> <william.h.ting@gmail.com>
|
William Ting <io@williamting.com> <william.h.ting@gmail.com>
|
||||||
Wim Looman <wim@nemo157.com>
|
Wim Looman <wim@nemo157.com> <rust-lang@nemo157.com>
|
||||||
|
Wim Looman <wim@nemo157.com> <git@nemo157.com>
|
||||||
Without Boats <woboats@gmail.com>
|
Without Boats <woboats@gmail.com>
|
||||||
Without Boats <woboats@gmail.com> <boats@mozilla.com>
|
Without Boats <woboats@gmail.com> <boats@mozilla.com>
|
||||||
Xinye Tao <xy.tao@outlook.com>
|
Xinye Tao <xy.tao@outlook.com>
|
||||||
|
@ -40,6 +40,7 @@ use std::sync::Arc;
|
|||||||
use cranelift_codegen::isa::TargetIsa;
|
use cranelift_codegen::isa::TargetIsa;
|
||||||
use cranelift_codegen::settings::{self, Configurable};
|
use cranelift_codegen::settings::{self, Configurable};
|
||||||
use rustc_codegen_ssa::CodegenResults;
|
use rustc_codegen_ssa::CodegenResults;
|
||||||
|
use rustc_codegen_ssa::back::versioned_llvm_target;
|
||||||
use rustc_codegen_ssa::traits::CodegenBackend;
|
use rustc_codegen_ssa::traits::CodegenBackend;
|
||||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||||
use rustc_errors::ErrorGuaranteed;
|
use rustc_errors::ErrorGuaranteed;
|
||||||
@ -260,7 +261,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn target_triple(sess: &Session) -> target_lexicon::Triple {
|
fn target_triple(sess: &Session) -> target_lexicon::Triple {
|
||||||
match sess.target.llvm_target.parse() {
|
// FIXME(madsmtm): Use `sess.target.llvm_target` once target-lexicon supports unversioned macOS.
|
||||||
|
// See <https://github.com/bytecodealliance/target-lexicon/pull/113>
|
||||||
|
match versioned_llvm_target(sess).parse() {
|
||||||
Ok(triple) => triple,
|
Ok(triple) => triple,
|
||||||
Err(err) => sess.dcx().fatal(format!("target not recognized: {}", err)),
|
Err(err) => sess.dcx().fatal(format!("target not recognized: {}", err)),
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ use llvm::{
|
|||||||
LLVMRustLLVMHasZlibCompressionForDebugSymbols, LLVMRustLLVMHasZstdCompressionForDebugSymbols,
|
LLVMRustLLVMHasZlibCompressionForDebugSymbols, LLVMRustLLVMHasZstdCompressionForDebugSymbols,
|
||||||
};
|
};
|
||||||
use rustc_codegen_ssa::back::link::ensure_removed;
|
use rustc_codegen_ssa::back::link::ensure_removed;
|
||||||
|
use rustc_codegen_ssa::back::versioned_llvm_target;
|
||||||
use rustc_codegen_ssa::back::write::{
|
use rustc_codegen_ssa::back::write::{
|
||||||
BitcodeSection, CodegenContext, EmitObj, ModuleConfig, TargetMachineFactoryConfig,
|
BitcodeSection, CodegenContext, EmitObj, ModuleConfig, TargetMachineFactoryConfig,
|
||||||
TargetMachineFactoryFn,
|
TargetMachineFactoryFn,
|
||||||
@ -211,7 +212,7 @@ pub(crate) fn target_machine_factory(
|
|||||||
singlethread = false;
|
singlethread = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let triple = SmallCStr::new(&sess.target.llvm_target);
|
let triple = SmallCStr::new(&versioned_llvm_target(sess));
|
||||||
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
|
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
|
||||||
let features = CString::new(target_features.join(",")).unwrap();
|
let features = CString::new(target_features.join(",")).unwrap();
|
||||||
let abi = SmallCStr::new(&sess.target.llvm_abiname);
|
let abi = SmallCStr::new(&sess.target.llvm_abiname);
|
||||||
|
@ -3,6 +3,7 @@ use std::cell::{Cell, RefCell};
|
|||||||
use std::ffi::{CStr, c_uint};
|
use std::ffi::{CStr, c_uint};
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
|
use rustc_codegen_ssa::back::versioned_llvm_target;
|
||||||
use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh};
|
use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh};
|
||||||
use rustc_codegen_ssa::errors as ssa_errors;
|
use rustc_codegen_ssa::errors as ssa_errors;
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
@ -182,7 +183,7 @@ pub(crate) unsafe fn create_module<'ll>(
|
|||||||
llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr());
|
llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
let llvm_target = SmallCStr::new(&sess.target.llvm_target);
|
let llvm_target = SmallCStr::new(&versioned_llvm_target(sess));
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMRustSetNormalizedTarget(llmod, llvm_target.as_ptr());
|
llvm::LLVMRustSetNormalizedTarget(llmod, llvm_target.as_ptr());
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,12 @@ codegen_ssa_L4Bender_exporting_symbols_unimplemented = exporting symbols not imp
|
|||||||
|
|
||||||
codegen_ssa_add_native_library = failed to add native library {$library_path}: {$error}
|
codegen_ssa_add_native_library = failed to add native library {$library_path}: {$error}
|
||||||
|
|
||||||
|
codegen_ssa_apple_deployment_target_invalid =
|
||||||
|
failed to parse deployment target specified in {$env_var}: {$error}
|
||||||
|
|
||||||
|
codegen_ssa_apple_deployment_target_too_low =
|
||||||
|
deployment target in {$env_var} was set to {$version}, but the minimum supported by `rustc` is {$os_min}
|
||||||
|
|
||||||
codegen_ssa_apple_sdk_error_sdk_path = failed to get {$sdk_name} SDK path: {$error}
|
codegen_ssa_apple_sdk_error_sdk_path = failed to get {$sdk_name} SDK path: {$error}
|
||||||
|
|
||||||
codegen_ssa_archive_build_failure = failed to build archive at `{$path}`: {$error}
|
codegen_ssa_archive_build_failure = failed to build archive at `{$path}`: {$error}
|
||||||
|
171
compiler/rustc_codegen_ssa/src/back/apple.rs
Normal file
171
compiler/rustc_codegen_ssa/src/back/apple.rs
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
use std::env;
|
||||||
|
use std::fmt::{Display, from_fn};
|
||||||
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
|
use rustc_session::Session;
|
||||||
|
use rustc_target::spec::Target;
|
||||||
|
|
||||||
|
use crate::errors::AppleDeploymentTarget;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|
||||||
|
pub(super) fn macho_platform(target: &Target) -> u32 {
|
||||||
|
match (&*target.os, &*target.abi) {
|
||||||
|
("macos", _) => object::macho::PLATFORM_MACOS,
|
||||||
|
("ios", "macabi") => object::macho::PLATFORM_MACCATALYST,
|
||||||
|
("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR,
|
||||||
|
("ios", _) => object::macho::PLATFORM_IOS,
|
||||||
|
("watchos", "sim") => object::macho::PLATFORM_WATCHOSSIMULATOR,
|
||||||
|
("watchos", _) => object::macho::PLATFORM_WATCHOS,
|
||||||
|
("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
|
||||||
|
("tvos", _) => object::macho::PLATFORM_TVOS,
|
||||||
|
("visionos", "sim") => object::macho::PLATFORM_XROSSIMULATOR,
|
||||||
|
("visionos", _) => object::macho::PLATFORM_XROS,
|
||||||
|
_ => unreachable!("tried to get Mach-O platform for non-Apple target"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deployment target or SDK version.
|
||||||
|
///
|
||||||
|
/// The size of the numbers in here are limited by Mach-O's `LC_BUILD_VERSION`.
|
||||||
|
type OSVersion = (u16, u8, u8);
|
||||||
|
|
||||||
|
/// Parse an OS version triple (SDK version or deployment target).
|
||||||
|
fn parse_version(version: &str) -> Result<OSVersion, ParseIntError> {
|
||||||
|
if let Some((major, minor)) = version.split_once('.') {
|
||||||
|
let major = major.parse()?;
|
||||||
|
if let Some((minor, patch)) = minor.split_once('.') {
|
||||||
|
Ok((major, minor.parse()?, patch.parse()?))
|
||||||
|
} else {
|
||||||
|
Ok((major, minor.parse()?, 0))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Ok((version.parse()?, 0, 0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pretty_version(version: OSVersion) -> impl Display {
|
||||||
|
let (major, minor, patch) = version;
|
||||||
|
from_fn(move |f| {
|
||||||
|
write!(f, "{major}.{minor}")?;
|
||||||
|
if patch != 0 {
|
||||||
|
write!(f, ".{patch}")?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Minimum operating system versions currently supported by `rustc`.
|
||||||
|
fn os_minimum_deployment_target(os: &str) -> OSVersion {
|
||||||
|
// When bumping a version in here, remember to update the platform-support docs too.
|
||||||
|
//
|
||||||
|
// NOTE: The defaults may change in future `rustc` versions, so if you are looking for the
|
||||||
|
// default deployment target, prefer:
|
||||||
|
// ```
|
||||||
|
// $ rustc --print deployment-target
|
||||||
|
// ```
|
||||||
|
match os {
|
||||||
|
"macos" => (10, 12, 0),
|
||||||
|
"ios" => (10, 0, 0),
|
||||||
|
"tvos" => (10, 0, 0),
|
||||||
|
"watchos" => (5, 0, 0),
|
||||||
|
"visionos" => (1, 0, 0),
|
||||||
|
_ => unreachable!("tried to get deployment target for non-Apple platform"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The deployment target for the given target.
|
||||||
|
///
|
||||||
|
/// This is similar to `os_minimum_deployment_target`, except that on certain targets it makes sense
|
||||||
|
/// to raise the minimum OS version.
|
||||||
|
///
|
||||||
|
/// This matches what LLVM does, see in part:
|
||||||
|
/// <https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932>
|
||||||
|
fn minimum_deployment_target(target: &Target) -> OSVersion {
|
||||||
|
match (&*target.os, &*target.arch, &*target.abi) {
|
||||||
|
("macos", "aarch64", _) => (11, 0, 0),
|
||||||
|
("ios", "aarch64", "macabi") => (14, 0, 0),
|
||||||
|
("ios", "aarch64", "sim") => (14, 0, 0),
|
||||||
|
("ios", _, _) if target.llvm_target.starts_with("arm64e") => (14, 0, 0),
|
||||||
|
// Mac Catalyst defaults to 13.1 in Clang.
|
||||||
|
("ios", _, "macabi") => (13, 1, 0),
|
||||||
|
("tvos", "aarch64", "sim") => (14, 0, 0),
|
||||||
|
("watchos", "aarch64", "sim") => (7, 0, 0),
|
||||||
|
(os, _, _) => os_minimum_deployment_target(os),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Name of the environment variable used to fetch the deployment target on the given OS.
|
||||||
|
fn deployment_target_env_var(os: &str) -> &'static str {
|
||||||
|
match os {
|
||||||
|
"macos" => "MACOSX_DEPLOYMENT_TARGET",
|
||||||
|
"ios" => "IPHONEOS_DEPLOYMENT_TARGET",
|
||||||
|
"watchos" => "WATCHOS_DEPLOYMENT_TARGET",
|
||||||
|
"tvos" => "TVOS_DEPLOYMENT_TARGET",
|
||||||
|
"visionos" => "XROS_DEPLOYMENT_TARGET",
|
||||||
|
_ => unreachable!("tried to get deployment target env var for non-Apple platform"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the deployment target based on the standard environment variables, or fall back to the
|
||||||
|
/// minimum version supported by `rustc`.
|
||||||
|
pub fn deployment_target(sess: &Session) -> OSVersion {
|
||||||
|
let min = minimum_deployment_target(&sess.target);
|
||||||
|
let env_var = deployment_target_env_var(&sess.target.os);
|
||||||
|
|
||||||
|
if let Ok(deployment_target) = env::var(env_var) {
|
||||||
|
match parse_version(&deployment_target) {
|
||||||
|
Ok(version) => {
|
||||||
|
let os_min = os_minimum_deployment_target(&sess.target.os);
|
||||||
|
// It is common that the deployment target is set a bit too low, for example on
|
||||||
|
// macOS Aarch64 to also target older x86_64. So we only want to warn when variable
|
||||||
|
// is lower than the minimum OS supported by rustc, not when the variable is lower
|
||||||
|
// than the minimum for a specific target.
|
||||||
|
if version < os_min {
|
||||||
|
sess.dcx().emit_warn(AppleDeploymentTarget::TooLow {
|
||||||
|
env_var,
|
||||||
|
version: pretty_version(version).to_string(),
|
||||||
|
os_min: pretty_version(os_min).to_string(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Raise the deployment target to the minimum supported.
|
||||||
|
version.max(min)
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
sess.dcx().emit_err(AppleDeploymentTarget::Invalid { env_var, error });
|
||||||
|
min
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If no deployment target variable is set, default to the minimum found above.
|
||||||
|
min
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn add_version_to_llvm_target(
|
||||||
|
llvm_target: &str,
|
||||||
|
deployment_target: OSVersion,
|
||||||
|
) -> String {
|
||||||
|
let mut components = llvm_target.split("-");
|
||||||
|
let arch = components.next().expect("apple target should have arch");
|
||||||
|
let vendor = components.next().expect("apple target should have vendor");
|
||||||
|
let os = components.next().expect("apple target should have os");
|
||||||
|
let environment = components.next();
|
||||||
|
assert_eq!(components.next(), None, "too many LLVM triple components");
|
||||||
|
|
||||||
|
let (major, minor, patch) = deployment_target;
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
!os.contains(|c: char| c.is_ascii_digit()),
|
||||||
|
"LLVM target must not already be versioned"
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Some(env) = environment {
|
||||||
|
// Insert version into OS, before environment
|
||||||
|
format!("{arch}-{vendor}-{os}{major}.{minor}.{patch}-{env}")
|
||||||
|
} else {
|
||||||
|
format!("{arch}-{vendor}-{os}{major}.{minor}.{patch}")
|
||||||
|
}
|
||||||
|
}
|
21
compiler/rustc_codegen_ssa/src/back/apple/tests.rs
Normal file
21
compiler/rustc_codegen_ssa/src/back/apple/tests.rs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
use super::{add_version_to_llvm_target, parse_version};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_add_version_to_llvm_target() {
|
||||||
|
assert_eq!(
|
||||||
|
add_version_to_llvm_target("aarch64-apple-macosx", (10, 14, 1)),
|
||||||
|
"aarch64-apple-macosx10.14.1"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
add_version_to_llvm_target("aarch64-apple-ios-simulator", (16, 1, 0)),
|
||||||
|
"aarch64-apple-ios16.1.0-simulator"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse_version() {
|
||||||
|
assert_eq!(parse_version("10"), Ok((10, 0, 0)));
|
||||||
|
assert_eq!(parse_version("10.12"), Ok((10, 12, 0)));
|
||||||
|
assert_eq!(parse_version("10.12.6"), Ok((10, 12, 6)));
|
||||||
|
assert_eq!(parse_version("9999.99.99"), Ok((9999, 99, 99)));
|
||||||
|
}
|
@ -40,7 +40,7 @@ use rustc_target::spec::crt_objects::CrtObjects;
|
|||||||
use rustc_target::spec::{
|
use rustc_target::spec::{
|
||||||
Cc, LinkOutputKind, LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFeatures,
|
Cc, LinkOutputKind, LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFeatures,
|
||||||
LinkerFlavor, LinkerFlavorCli, Lld, PanicStrategy, RelocModel, RelroLevel, SanitizerSet,
|
LinkerFlavor, LinkerFlavorCli, Lld, PanicStrategy, RelocModel, RelroLevel, SanitizerSet,
|
||||||
SplitDebuginfo, current_apple_deployment_target,
|
SplitDebuginfo,
|
||||||
};
|
};
|
||||||
use tempfile::Builder as TempFileBuilder;
|
use tempfile::Builder as TempFileBuilder;
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{debug, info, warn};
|
||||||
@ -50,6 +50,7 @@ use super::command::Command;
|
|||||||
use super::linker::{self, Linker};
|
use super::linker::{self, Linker};
|
||||||
use super::metadata::{MetadataPosition, create_wrapper_file};
|
use super::metadata::{MetadataPosition, create_wrapper_file};
|
||||||
use super::rpath::{self, RPathConfig};
|
use super::rpath::{self, RPathConfig};
|
||||||
|
use super::{apple, versioned_llvm_target};
|
||||||
use crate::{
|
use crate::{
|
||||||
CodegenResults, CompiledModule, CrateInfo, NativeLib, common, errors,
|
CodegenResults, CompiledModule, CrateInfo, NativeLib, common, errors,
|
||||||
looks_like_rust_object_file,
|
looks_like_rust_object_file,
|
||||||
@ -2447,7 +2448,7 @@ fn add_order_independent_options(
|
|||||||
if flavor == LinkerFlavor::Llbc {
|
if flavor == LinkerFlavor::Llbc {
|
||||||
cmd.link_args(&[
|
cmd.link_args(&[
|
||||||
"--target",
|
"--target",
|
||||||
sess.target.llvm_target.as_ref(),
|
&versioned_llvm_target(sess),
|
||||||
"--target-cpu",
|
"--target-cpu",
|
||||||
&codegen_results.crate_info.target_cpu,
|
&codegen_results.crate_info.target_cpu,
|
||||||
]);
|
]);
|
||||||
@ -3039,7 +3040,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
|
|||||||
_ => bug!("invalid OS/ABI combination for Apple target: {target_os}, {target_abi}"),
|
_ => bug!("invalid OS/ABI combination for Apple target: {target_os}, {target_abi}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (major, minor, patch) = current_apple_deployment_target(&sess.target);
|
let (major, minor, patch) = apple::deployment_target(sess);
|
||||||
let min_version = format!("{major}.{minor}.{patch}");
|
let min_version = format!("{major}.{minor}.{patch}");
|
||||||
|
|
||||||
// The SDK version is used at runtime when compiling with a newer SDK / version of Xcode:
|
// The SDK version is used at runtime when compiling with a newer SDK / version of Xcode:
|
||||||
@ -3109,7 +3110,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
|
|||||||
|
|
||||||
// The presence of `-mmacosx-version-min` makes CC default to
|
// The presence of `-mmacosx-version-min` makes CC default to
|
||||||
// macOS, and it sets the deployment target.
|
// macOS, and it sets the deployment target.
|
||||||
let (major, minor, patch) = current_apple_deployment_target(&sess.target);
|
let (major, minor, patch) = apple::deployment_target(sess);
|
||||||
// Intentionally pass this as a single argument, Clang doesn't
|
// Intentionally pass this as a single argument, Clang doesn't
|
||||||
// seem to like it otherwise.
|
// seem to like it otherwise.
|
||||||
cmd.cc_arg(&format!("-mmacosx-version-min={major}.{minor}.{patch}"));
|
cmd.cc_arg(&format!("-mmacosx-version-min={major}.{minor}.{patch}"));
|
||||||
@ -3119,7 +3120,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
|
|||||||
//
|
//
|
||||||
// We avoid `-m32`/`-m64`, as this is already encoded by `-arch`.
|
// We avoid `-m32`/`-m64`, as this is already encoded by `-arch`.
|
||||||
} else {
|
} else {
|
||||||
cmd.cc_args(&["-target", &sess.target.llvm_target]);
|
cmd.cc_args(&["-target", &versioned_llvm_target(sess)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3345,7 +3346,7 @@ fn add_lld_args(
|
|||||||
// targeting a different linker flavor on macOS, and that's also always
|
// targeting a different linker flavor on macOS, and that's also always
|
||||||
// the case when targeting WASM.
|
// the case when targeting WASM.
|
||||||
if sess.target.linker_flavor != sess.host.linker_flavor {
|
if sess.target.linker_flavor != sess.host.linker_flavor {
|
||||||
cmd.cc_arg(format!("--target={}", sess.target.llvm_target));
|
cmd.cc_arg(format!("--target={}", versioned_llvm_target(sess)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ use rustc_span::sym;
|
|||||||
use rustc_target::abi::Endian;
|
use rustc_target::abi::Endian;
|
||||||
use rustc_target::spec::{RelocModel, Target, ef_avr_arch};
|
use rustc_target::spec::{RelocModel, Target, ef_avr_arch};
|
||||||
|
|
||||||
|
use super::apple;
|
||||||
|
|
||||||
/// The default metadata loader. This is used by cg_llvm and cg_clif.
|
/// The default metadata loader. This is used by cg_llvm and cg_clif.
|
||||||
///
|
///
|
||||||
/// # Metadata location
|
/// # Metadata location
|
||||||
@ -238,7 +240,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
|
|||||||
file.set_macho_cpu_subtype(object::macho::CPU_SUBTYPE_ARM64E);
|
file.set_macho_cpu_subtype(object::macho::CPU_SUBTYPE_ARM64E);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.set_macho_build_version(macho_object_build_version_for_target(&sess.target))
|
file.set_macho_build_version(macho_object_build_version_for_target(sess))
|
||||||
}
|
}
|
||||||
if binary_format == BinaryFormat::Coff {
|
if binary_format == BinaryFormat::Coff {
|
||||||
// Disable the default mangler to avoid mangling the special "@feat.00" symbol name.
|
// Disable the default mangler to avoid mangling the special "@feat.00" symbol name.
|
||||||
@ -392,7 +394,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
|
|||||||
///
|
///
|
||||||
/// Since Xcode 15, Apple's LD apparently requires object files to use this load command, so this
|
/// Since Xcode 15, Apple's LD apparently requires object files to use this load command, so this
|
||||||
/// returns the `MachOBuildVersion` for the target to do so.
|
/// returns the `MachOBuildVersion` for the target to do so.
|
||||||
fn macho_object_build_version_for_target(target: &Target) -> object::write::MachOBuildVersion {
|
fn macho_object_build_version_for_target(sess: &Session) -> object::write::MachOBuildVersion {
|
||||||
/// The `object` crate demands "X.Y.Z encoded in nibbles as xxxx.yy.zz"
|
/// The `object` crate demands "X.Y.Z encoded in nibbles as xxxx.yy.zz"
|
||||||
/// e.g. minOS 14.0 = 0x000E0000, or SDK 16.2 = 0x00100200
|
/// e.g. minOS 14.0 = 0x000E0000, or SDK 16.2 = 0x00100200
|
||||||
fn pack_version((major, minor, patch): (u16, u8, u8)) -> u32 {
|
fn pack_version((major, minor, patch): (u16, u8, u8)) -> u32 {
|
||||||
@ -400,9 +402,8 @@ fn macho_object_build_version_for_target(target: &Target) -> object::write::Mach
|
|||||||
(major << 16) | (minor << 8) | patch
|
(major << 16) | (minor << 8) | patch
|
||||||
}
|
}
|
||||||
|
|
||||||
let platform =
|
let platform = apple::macho_platform(&sess.target);
|
||||||
rustc_target::spec::current_apple_platform(target).expect("unknown Apple target OS");
|
let min_os = apple::deployment_target(sess);
|
||||||
let min_os = rustc_target::spec::current_apple_deployment_target(target);
|
|
||||||
|
|
||||||
let mut build_version = object::write::MachOBuildVersion::default();
|
let mut build_version = object::write::MachOBuildVersion::default();
|
||||||
build_version.platform = platform;
|
build_version.platform = platform;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
use rustc_session::Session;
|
||||||
|
|
||||||
|
pub mod apple;
|
||||||
pub mod archive;
|
pub mod archive;
|
||||||
pub(crate) mod command;
|
pub(crate) mod command;
|
||||||
pub mod link;
|
pub mod link;
|
||||||
@ -7,3 +12,19 @@ pub mod metadata;
|
|||||||
pub(crate) mod rpath;
|
pub(crate) mod rpath;
|
||||||
pub mod symbol_export;
|
pub mod symbol_export;
|
||||||
pub mod write;
|
pub mod write;
|
||||||
|
|
||||||
|
/// The target triple depends on the deployment target, and is required to
|
||||||
|
/// enable features such as cross-language LTO, and for picking the right
|
||||||
|
/// Mach-O commands.
|
||||||
|
///
|
||||||
|
/// Certain optimizations also depend on the deployment target.
|
||||||
|
pub fn versioned_llvm_target(sess: &Session) -> Cow<'_, str> {
|
||||||
|
if sess.target.is_like_osx {
|
||||||
|
apple::add_version_to_llvm_target(&sess.target.llvm_target, apple::deployment_target(sess))
|
||||||
|
.into()
|
||||||
|
} else {
|
||||||
|
// FIXME(madsmtm): Certain other targets also include a version,
|
||||||
|
// we might want to move that here as well.
|
||||||
|
Cow::Borrowed(&sess.target.llvm_target)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
|
use std::num::ParseIntError;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::ExitStatus;
|
use std::process::ExitStatus;
|
||||||
|
|
||||||
@ -539,6 +540,14 @@ pub(crate) struct UnsupportedArch<'a> {
|
|||||||
pub os: &'a str,
|
pub os: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
pub(crate) enum AppleDeploymentTarget {
|
||||||
|
#[diag(codegen_ssa_apple_deployment_target_invalid)]
|
||||||
|
Invalid { env_var: &'static str, error: ParseIntError },
|
||||||
|
#[diag(codegen_ssa_apple_deployment_target_too_low)]
|
||||||
|
TooLow { env_var: &'static str, version: String, os_min: String },
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
pub(crate) enum AppleSdkRootError<'a> {
|
pub(crate) enum AppleSdkRootError<'a> {
|
||||||
#[diag(codegen_ssa_apple_sdk_error_sdk_path)]
|
#[diag(codegen_ssa_apple_sdk_error_sdk_path)]
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#![doc(rust_logo)]
|
#![doc(rust_logo)]
|
||||||
#![feature(assert_matches)]
|
#![feature(assert_matches)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
|
#![feature(debug_closure_helpers)]
|
||||||
#![feature(file_buffered)]
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
|
@ -33,6 +33,7 @@ use std::time::{Instant, SystemTime};
|
|||||||
use std::{env, str};
|
use std::{env, str};
|
||||||
|
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
|
use rustc_codegen_ssa::back::apple;
|
||||||
use rustc_codegen_ssa::traits::CodegenBackend;
|
use rustc_codegen_ssa::traits::CodegenBackend;
|
||||||
use rustc_codegen_ssa::{CodegenErrors, CodegenResults};
|
use rustc_codegen_ssa::{CodegenErrors, CodegenResults};
|
||||||
use rustc_data_structures::profiling::{
|
use rustc_data_structures::profiling::{
|
||||||
@ -855,12 +856,11 @@ fn print_crate_info(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeploymentTarget => {
|
DeploymentTarget => {
|
||||||
use rustc_target::spec::current_apple_deployment_target;
|
|
||||||
|
|
||||||
if sess.target.is_like_osx {
|
if sess.target.is_like_osx {
|
||||||
let (major, minor, patch) = current_apple_deployment_target(&sess.target);
|
println_info!(
|
||||||
let patch = if patch != 0 { format!(".{patch}") } else { String::new() };
|
"deployment_target={}",
|
||||||
println_info!("deployment_target={major}.{minor}{patch}")
|
apple::pretty_version(apple::deployment_target(sess))
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||||
sess.dcx().fatal("only Apple targets currently support deployment version info")
|
sess.dcx().fatal("only Apple targets currently support deployment version info")
|
||||||
|
@ -571,17 +571,29 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
|
|||||||
// We list scopes outwards, this causes us to see lifetime parameters in reverse
|
// We list scopes outwards, this causes us to see lifetime parameters in reverse
|
||||||
// declaration order. In order to make it consistent with what `generics_of` might
|
// declaration order. In order to make it consistent with what `generics_of` might
|
||||||
// give, we will reverse the IndexMap after early captures.
|
// give, we will reverse the IndexMap after early captures.
|
||||||
|
let mut late_depth = 0;
|
||||||
let mut scope = self.scope;
|
let mut scope = self.scope;
|
||||||
|
let mut crossed_late_boundary = None;
|
||||||
let mut opaque_capture_scopes = vec![(opaque.def_id, &captures)];
|
let mut opaque_capture_scopes = vec![(opaque.def_id, &captures)];
|
||||||
loop {
|
loop {
|
||||||
match *scope {
|
match *scope {
|
||||||
Scope::Binder { ref bound_vars, s, .. } => {
|
Scope::Binder { ref bound_vars, scope_type, s, .. } => {
|
||||||
for (&original_lifetime, &def) in bound_vars.iter().rev() {
|
for (&original_lifetime, &def) in bound_vars.iter().rev() {
|
||||||
|
if let ResolvedArg::LateBound(..) = def
|
||||||
|
&& crossed_late_boundary.is_some()
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if let DefKind::LifetimeParam = self.tcx.def_kind(original_lifetime) {
|
if let DefKind::LifetimeParam = self.tcx.def_kind(original_lifetime) {
|
||||||
|
let def = def.shifted(late_depth);
|
||||||
let ident = lifetime_ident(original_lifetime);
|
let ident = lifetime_ident(original_lifetime);
|
||||||
self.remap_opaque_captures(&opaque_capture_scopes, def, ident);
|
self.remap_opaque_captures(&opaque_capture_scopes, def, ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
match scope_type {
|
||||||
|
BinderScopeType::Normal => late_depth += 1,
|
||||||
|
BinderScopeType::Concatenating => {}
|
||||||
|
}
|
||||||
scope = s;
|
scope = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,6 +614,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
|
|||||||
|
|
||||||
Scope::Opaque { captures, def_id, s } => {
|
Scope::Opaque { captures, def_id, s } => {
|
||||||
opaque_capture_scopes.push((def_id, captures));
|
opaque_capture_scopes.push((def_id, captures));
|
||||||
|
late_depth = 0;
|
||||||
scope = s;
|
scope = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,8 +624,12 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
|
|||||||
|
|
||||||
Scope::ObjectLifetimeDefault { s, .. }
|
Scope::ObjectLifetimeDefault { s, .. }
|
||||||
| Scope::Supertrait { s, .. }
|
| Scope::Supertrait { s, .. }
|
||||||
| Scope::TraitRefBoundary { s, .. }
|
| Scope::TraitRefBoundary { s, .. } => {
|
||||||
| Scope::LateBoundary { s, .. } => {
|
scope = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scope::LateBoundary { s, what, .. } => {
|
||||||
|
crossed_late_boundary = Some(what);
|
||||||
scope = s;
|
scope = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,6 @@ where
|
|||||||
upvar.visit_with(self);
|
upvar.visit_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(async_closures): Is this the right signature to visit here?
|
|
||||||
args.as_coroutine_closure().signature_parts_ty().visit_with(self);
|
args.as_coroutine_closure().signature_parts_ty().visit_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,9 +151,15 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
|
|||||||
// };
|
// };
|
||||||
// };
|
// };
|
||||||
// ```
|
// ```
|
||||||
|
//
|
||||||
|
// It isn't possible to mix a impl in a module with const-anon, but an item can
|
||||||
|
// be put inside a module and referenced by a impl so we also have to treat the
|
||||||
|
// item parent as transparent to module and for consistency we have to do the same
|
||||||
|
// for impl, otherwise the item-def and impl-def won't have the same parent.
|
||||||
let outermost_impl_parent = peel_parent_while(cx.tcx, parent, |tcx, did| {
|
let outermost_impl_parent = peel_parent_while(cx.tcx, parent, |tcx, did| {
|
||||||
tcx.def_kind(did) == DefKind::Const
|
tcx.def_kind(did) == DefKind::Mod
|
||||||
&& tcx.opt_item_name(did) == Some(kw::Underscore)
|
|| (tcx.def_kind(did) == DefKind::Const
|
||||||
|
&& tcx.opt_item_name(did) == Some(kw::Underscore))
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. We check if any of the paths reference a the `impl`-parent.
|
// 2. We check if any of the paths reference a the `impl`-parent.
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::num::ParseIntError;
|
|
||||||
|
|
||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Cc, DebuginfoKind, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, StaticCow,
|
Cc, DebuginfoKind, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, StaticCow,
|
||||||
Target, TargetOptions, cvs,
|
TargetOptions, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -97,9 +96,8 @@ impl TargetAbi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the base target options, LLVM target and `target_arch` from the three
|
/// Get the base target options, unversioned LLVM target and `target_arch` from the three
|
||||||
/// things that uniquely identify Rust's Apple targets: The OS, the
|
/// things that uniquely identify Rust's Apple targets: The OS, the architecture, and the ABI.
|
||||||
/// architecture, and the ABI.
|
|
||||||
pub(crate) fn base(
|
pub(crate) fn base(
|
||||||
os: &'static str,
|
os: &'static str,
|
||||||
arch: Arch,
|
arch: Arch,
|
||||||
@ -155,117 +153,14 @@ pub(crate) fn base(
|
|||||||
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
(opts, llvm_target(os, arch, abi), arch.target_arch())
|
(opts, unversioned_llvm_target(os, arch, abi), arch.target_arch())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn platform(target: &Target) -> Option<u32> {
|
/// Generate part of the LLVM target triple.
|
||||||
Some(match (&*target.os, &*target.abi) {
|
///
|
||||||
("macos", _) => object::macho::PLATFORM_MACOS,
|
/// See `rustc_codegen_ssa::back::versioned_llvm_target` for the full triple passed to LLVM and
|
||||||
("ios", "macabi") => object::macho::PLATFORM_MACCATALYST,
|
/// Clang.
|
||||||
("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR,
|
fn unversioned_llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow<str> {
|
||||||
("ios", _) => object::macho::PLATFORM_IOS,
|
|
||||||
("watchos", "sim") => object::macho::PLATFORM_WATCHOSSIMULATOR,
|
|
||||||
("watchos", _) => object::macho::PLATFORM_WATCHOS,
|
|
||||||
("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
|
|
||||||
("tvos", _) => object::macho::PLATFORM_TVOS,
|
|
||||||
// FIXME: Upgrade to `object-rs` 0.33+ implementation with visionOS platform definition
|
|
||||||
("visionos", "sim") => 12,
|
|
||||||
("visionos", _) => 11,
|
|
||||||
_ => return None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Hack for calling `deployment_target` outside of this module.
|
|
||||||
pub fn deployment_target_for_target(target: &Target) -> (u16, u8, u8) {
|
|
||||||
let arch = if target.llvm_target.starts_with("arm64e") {
|
|
||||||
Arch::Arm64e
|
|
||||||
} else if target.arch == "aarch64" {
|
|
||||||
Arch::Arm64
|
|
||||||
} else {
|
|
||||||
// Dummy architecture, only used by `deployment_target` anyhow
|
|
||||||
Arch::X86_64
|
|
||||||
};
|
|
||||||
let abi = match &*target.abi {
|
|
||||||
"macabi" => TargetAbi::MacCatalyst,
|
|
||||||
"sim" => TargetAbi::Simulator,
|
|
||||||
"" => TargetAbi::Normal,
|
|
||||||
abi => unreachable!("invalid abi '{abi}' for Apple target"),
|
|
||||||
};
|
|
||||||
deployment_target(&target.os, arch, abi)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the deployment target based on the standard environment variables, or
|
|
||||||
/// fall back to a sane default.
|
|
||||||
fn deployment_target(os: &str, arch: Arch, abi: TargetAbi) -> (u16, u8, u8) {
|
|
||||||
// When bumping a version in here, remember to update the platform-support
|
|
||||||
// docs too.
|
|
||||||
//
|
|
||||||
// NOTE: If you are looking for the default deployment target, prefer
|
|
||||||
// `rustc --print deployment-target`, as the default here may change in
|
|
||||||
// future `rustc` versions.
|
|
||||||
|
|
||||||
// Minimum operating system versions currently supported by `rustc`.
|
|
||||||
let os_min = match os {
|
|
||||||
"macos" => (10, 12, 0),
|
|
||||||
"ios" => (10, 0, 0),
|
|
||||||
"tvos" => (10, 0, 0),
|
|
||||||
"watchos" => (5, 0, 0),
|
|
||||||
"visionos" => (1, 0, 0),
|
|
||||||
_ => unreachable!("tried to get deployment target for non-Apple platform"),
|
|
||||||
};
|
|
||||||
|
|
||||||
// On certain targets it makes sense to raise the minimum OS version.
|
|
||||||
//
|
|
||||||
// This matches what LLVM does, see:
|
|
||||||
// <https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932>
|
|
||||||
let min = match (os, arch, abi) {
|
|
||||||
("macos", Arch::Arm64 | Arch::Arm64e, _) => (11, 0, 0),
|
|
||||||
("ios", Arch::Arm64 | Arch::Arm64e, TargetAbi::MacCatalyst) => (14, 0, 0),
|
|
||||||
("ios", Arch::Arm64 | Arch::Arm64e, TargetAbi::Simulator) => (14, 0, 0),
|
|
||||||
("ios", Arch::Arm64e, TargetAbi::Normal) => (14, 0, 0),
|
|
||||||
// Mac Catalyst defaults to 13.1 in Clang.
|
|
||||||
("ios", _, TargetAbi::MacCatalyst) => (13, 1, 0),
|
|
||||||
("tvos", Arch::Arm64 | Arch::Arm64e, TargetAbi::Simulator) => (14, 0, 0),
|
|
||||||
("watchos", Arch::Arm64 | Arch::Arm64e, TargetAbi::Simulator) => (7, 0, 0),
|
|
||||||
_ => os_min,
|
|
||||||
};
|
|
||||||
|
|
||||||
// The environment variable used to fetch the deployment target.
|
|
||||||
let env_var = match os {
|
|
||||||
"macos" => "MACOSX_DEPLOYMENT_TARGET",
|
|
||||||
"ios" => "IPHONEOS_DEPLOYMENT_TARGET",
|
|
||||||
"watchos" => "WATCHOS_DEPLOYMENT_TARGET",
|
|
||||||
"tvos" => "TVOS_DEPLOYMENT_TARGET",
|
|
||||||
"visionos" => "XROS_DEPLOYMENT_TARGET",
|
|
||||||
_ => unreachable!("tried to get deployment target env var for non-Apple platform"),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Ok(deployment_target) = env::var(env_var) {
|
|
||||||
match parse_version(&deployment_target) {
|
|
||||||
// It is common that the deployment target is set too low, e.g. on
|
|
||||||
// macOS Aarch64 to also target older x86_64, the user may set a
|
|
||||||
// lower deployment target than supported.
|
|
||||||
//
|
|
||||||
// To avoid such issues, we silently raise the deployment target
|
|
||||||
// here.
|
|
||||||
// FIXME: We want to show a warning when `version < os_min`.
|
|
||||||
Ok(version) => version.max(min),
|
|
||||||
// FIXME: Report erroneous environment variable to user.
|
|
||||||
Err(_) => min,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
min
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Generate the target triple that we need to pass to LLVM and/or Clang.
|
|
||||||
fn llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow<str> {
|
|
||||||
// The target triple depends on the deployment target, and is required to
|
|
||||||
// enable features such as cross-language LTO, and for picking the right
|
|
||||||
// Mach-O commands.
|
|
||||||
//
|
|
||||||
// Certain optimizations also depend on the deployment target.
|
|
||||||
let (major, minor, patch) = deployment_target(os, arch, abi);
|
|
||||||
let arch = arch.target_name();
|
let arch = arch.target_name();
|
||||||
// Convert to the "canonical" OS name used by LLVM:
|
// Convert to the "canonical" OS name used by LLVM:
|
||||||
// https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L236-L282
|
// https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L236-L282
|
||||||
@ -282,7 +177,7 @@ fn llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow<str> {
|
|||||||
TargetAbi::MacCatalyst => "-macabi",
|
TargetAbi::MacCatalyst => "-macabi",
|
||||||
TargetAbi::Simulator => "-simulator",
|
TargetAbi::Simulator => "-simulator",
|
||||||
};
|
};
|
||||||
format!("{arch}-apple-{os}{major}.{minor}.{patch}{environment}").into()
|
format!("{arch}-apple-{os}{environment}").into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
|
fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
|
||||||
@ -321,20 +216,3 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
|
|||||||
cvs!["MACOSX_DEPLOYMENT_TARGET"]
|
cvs!["MACOSX_DEPLOYMENT_TARGET"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse an OS version triple (SDK version or deployment target).
|
|
||||||
///
|
|
||||||
/// The size of the returned numbers here are limited by Mach-O's
|
|
||||||
/// `LC_BUILD_VERSION`.
|
|
||||||
fn parse_version(version: &str) -> Result<(u16, u8, u8), ParseIntError> {
|
|
||||||
if let Some((major, minor)) = version.split_once('.') {
|
|
||||||
let major = major.parse()?;
|
|
||||||
if let Some((minor, patch)) = minor.split_once('.') {
|
|
||||||
Ok((major, minor.parse()?, patch.parse()?))
|
|
||||||
} else {
|
|
||||||
Ok((major, minor.parse()?, 0))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Ok((version.parse()?, 0, 0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use super::parse_version;
|
|
||||||
use crate::spec::targets::{
|
use crate::spec::targets::{
|
||||||
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_visionos_sim,
|
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_visionos_sim,
|
||||||
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
|
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
|
||||||
@ -40,11 +39,3 @@ fn macos_link_environment_unmodified() {
|
|||||||
],);
|
],);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_version() {
|
|
||||||
assert_eq!(parse_version("10"), Ok((10, 0, 0)));
|
|
||||||
assert_eq!(parse_version("10.12"), Ok((10, 12, 0)));
|
|
||||||
assert_eq!(parse_version("10.12.6"), Ok((10, 12, 6)));
|
|
||||||
assert_eq!(parse_version("9999.99.99"), Ok((9999, 99, 99)));
|
|
||||||
}
|
|
||||||
|
@ -65,10 +65,6 @@ pub mod abi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod base;
|
mod base;
|
||||||
pub use base::apple::{
|
|
||||||
deployment_target_for_target as current_apple_deployment_target,
|
|
||||||
platform as current_apple_platform,
|
|
||||||
};
|
|
||||||
pub use base::avr_gnu::ef_avr_arch;
|
pub use base::avr_gnu::ef_avr_arch;
|
||||||
|
|
||||||
/// Linker is called through a C/C++ compiler.
|
/// Linker is called through a C/C++ compiler.
|
||||||
@ -2009,7 +2005,12 @@ impl TargetWarnings {
|
|||||||
/// Every field here must be specified, and has no default value.
|
/// Every field here must be specified, and has no default value.
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
pub struct Target {
|
pub struct Target {
|
||||||
/// Target triple to pass to LLVM.
|
/// Unversioned target triple to pass to LLVM.
|
||||||
|
///
|
||||||
|
/// Target triples can optionally contain an OS version (notably Apple targets), which rustc
|
||||||
|
/// cannot know without querying the environment.
|
||||||
|
///
|
||||||
|
/// Use `rustc_codegen_ssa::back::versioned_llvm_target` if you need the full LLVM target.
|
||||||
pub llvm_target: StaticCow<str>,
|
pub llvm_target: StaticCow<str>,
|
||||||
/// Metadata about a target, for example the description or tier.
|
/// Metadata about a target, for example the description or tier.
|
||||||
/// Used for generating target documentation.
|
/// Used for generating target documentation.
|
||||||
|
@ -668,8 +668,6 @@
|
|||||||
|
|
||||||
# Flag indicating whether git info will be retrieved from .git automatically.
|
# Flag indicating whether git info will be retrieved from .git automatically.
|
||||||
# Having the git information can cause a lot of rebuilds during development.
|
# Having the git information can cause a lot of rebuilds during development.
|
||||||
#
|
|
||||||
# FIXME(#76720): this can causes bugs if different compilers reuse the same metadata cache.
|
|
||||||
#omit-git-hash = if rust.channel == "dev" { true } else { false }
|
#omit-git-hash = if rust.channel == "dev" { true } else { false }
|
||||||
|
|
||||||
# Whether to create a source tarball by default when running `x dist`.
|
# Whether to create a source tarball by default when running `x dist`.
|
||||||
|
@ -212,7 +212,7 @@ impl str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds the closest `x` not exceeding `index` where `is_char_boundary(x)` is `true`.
|
/// Finds the closest `x` not exceeding `index` where [`is_char_boundary(x)`] is `true`.
|
||||||
///
|
///
|
||||||
/// This method can help you truncate a string so that it's still valid UTF-8, but doesn't
|
/// This method can help you truncate a string so that it's still valid UTF-8, but doesn't
|
||||||
/// exceed a given number of bytes. Note that this is done purely at the character level
|
/// exceed a given number of bytes. Note that this is done purely at the character level
|
||||||
@ -220,6 +220,8 @@ impl str {
|
|||||||
/// split. For example, the emoji 🧑🔬 (scientist) could be split so that the string only
|
/// split. For example, the emoji 🧑🔬 (scientist) could be split so that the string only
|
||||||
/// includes 🧑 (person) instead.
|
/// includes 🧑 (person) instead.
|
||||||
///
|
///
|
||||||
|
/// [`is_char_boundary(x)`]: Self::is_char_boundary
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
@ -248,7 +250,7 @@ impl str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds the closest `x` not below `index` where `is_char_boundary(x)` is `true`.
|
/// Finds the closest `x` not below `index` where [`is_char_boundary(x)`] is `true`.
|
||||||
///
|
///
|
||||||
/// If `index` is greater than the length of the string, this returns the length of the string.
|
/// If `index` is greater than the length of the string, this returns the length of the string.
|
||||||
///
|
///
|
||||||
@ -256,7 +258,7 @@ impl str {
|
|||||||
/// for more details.
|
/// for more details.
|
||||||
///
|
///
|
||||||
/// [`floor_char_boundary`]: str::floor_char_boundary
|
/// [`floor_char_boundary`]: str::floor_char_boundary
|
||||||
///
|
/// [`is_char_boundary(x)`]: Self::is_char_boundary
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -2192,7 +2194,7 @@ impl str {
|
|||||||
/// Returns a string slice with the prefix removed.
|
/// Returns a string slice with the prefix removed.
|
||||||
///
|
///
|
||||||
/// If the string starts with the pattern `prefix`, returns the substring after the prefix,
|
/// If the string starts with the pattern `prefix`, returns the substring after the prefix,
|
||||||
/// wrapped in `Some`. Unlike `trim_start_matches`, this method removes the prefix exactly once.
|
/// wrapped in `Some`. Unlike [`trim_start_matches`], this method removes the prefix exactly once.
|
||||||
///
|
///
|
||||||
/// If the string does not start with `prefix`, returns `None`.
|
/// If the string does not start with `prefix`, returns `None`.
|
||||||
///
|
///
|
||||||
@ -2201,6 +2203,7 @@ impl str {
|
|||||||
///
|
///
|
||||||
/// [`char`]: prim@char
|
/// [`char`]: prim@char
|
||||||
/// [pattern]: self::pattern
|
/// [pattern]: self::pattern
|
||||||
|
/// [`trim_start_matches`]: Self::trim_start_matches
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -2219,7 +2222,7 @@ impl str {
|
|||||||
/// Returns a string slice with the suffix removed.
|
/// Returns a string slice with the suffix removed.
|
||||||
///
|
///
|
||||||
/// If the string ends with the pattern `suffix`, returns the substring before the suffix,
|
/// If the string ends with the pattern `suffix`, returns the substring before the suffix,
|
||||||
/// wrapped in `Some`. Unlike `trim_end_matches`, this method removes the suffix exactly once.
|
/// wrapped in `Some`. Unlike [`trim_end_matches`], this method removes the suffix exactly once.
|
||||||
///
|
///
|
||||||
/// If the string does not end with `suffix`, returns `None`.
|
/// If the string does not end with `suffix`, returns `None`.
|
||||||
///
|
///
|
||||||
@ -2228,6 +2231,7 @@ impl str {
|
|||||||
///
|
///
|
||||||
/// [`char`]: prim@char
|
/// [`char`]: prim@char
|
||||||
/// [pattern]: self::pattern
|
/// [pattern]: self::pattern
|
||||||
|
/// [`trim_end_matches`]: Self::trim_end_matches
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -205,7 +205,7 @@ auto:
|
|||||||
- image: dist-x86_64-musl
|
- image: dist-x86_64-musl
|
||||||
env:
|
env:
|
||||||
CODEGEN_BACKENDS: llvm,cranelift
|
CODEGEN_BACKENDS: llvm,cranelift
|
||||||
<<: *job-linux-8c
|
<<: *job-linux-4c
|
||||||
|
|
||||||
- image: dist-x86_64-netbsd
|
- image: dist-x86_64-netbsd
|
||||||
<<: *job-linux-4c
|
<<: *job-linux-4c
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
[language-server.rust-analyzer.config]
|
[language-server.rust-analyzer.config]
|
||||||
linkedProjects = [
|
linkedProjects = [
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
"src/tools/x/Cargo.toml",
|
"compiler/rustc_codegen_cranelift/Cargo.toml",
|
||||||
|
"compiler/rustc_codegen_gcc/Cargo.toml",
|
||||||
|
"library/Cargo.toml",
|
||||||
"src/bootstrap/Cargo.toml",
|
"src/bootstrap/Cargo.toml",
|
||||||
"src/tools/rust-analyzer/Cargo.toml",
|
"src/tools/rust-analyzer/Cargo.toml",
|
||||||
"compiler/rustc_codegen_cranelift/Cargo.toml",
|
"src/tools/x/Cargo.toml",
|
||||||
"compiler/rustc_codegen_gcc/Cargo.toml"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[language-server.rust-analyzer.config.check]
|
[language-server.rust-analyzer.config.check]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//@ compile-flags: -Zmerge-functions=disabled
|
//@ compile-flags: -Zmerge-functions=disabled
|
||||||
//@ needs-llvm-components: loongarch
|
//@ needs-llvm-components: loongarch
|
||||||
|
|
||||||
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
|
#![feature(no_core, lang_items, rustc_attrs)]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
#![allow(asm_sub_register, non_camel_case_types)]
|
#![allow(asm_sub_register, non_camel_case_types)]
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
//! Test for https://github.com/rust-lang/rust/issues/64219
|
||||||
|
//! Check if `noreturn` attribute is applied on calls to
|
||||||
|
//! function pointers returning `!` (never type).
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static FOO: fn() -> !;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK-LABEL: @foo
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe fn foo() {
|
||||||
|
// CHECK: call
|
||||||
|
// CHECK-SAME: [[NUM:#[0-9]+$]]
|
||||||
|
FOO();
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK: attributes [[NUM]] = {{{.*}} noreturn {{.*}}}
|
@ -0,0 +1,26 @@
|
|||||||
|
//@ compile-flags: -O
|
||||||
|
//! Test for https://github.com/rust-lang/rust/issues/86109
|
||||||
|
//! Check LLVM can eliminate the impossible division by zero check by
|
||||||
|
//! ensuring there is no call (to panic) instruction.
|
||||||
|
//!
|
||||||
|
//! This has been fixed since `rustc 1.70.0`.
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
type T = i16;
|
||||||
|
|
||||||
|
// CHECK-LABEL: @foo
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn foo(start: T) -> T {
|
||||||
|
// CHECK-NOT: panic
|
||||||
|
if start <= 0 {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
let mut count = 0;
|
||||||
|
for i in start..10_000 {
|
||||||
|
if 752 % i != 0 {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count
|
||||||
|
}
|
@ -5,9 +5,6 @@
|
|||||||
//@[v0] compile-flags: -Csymbol-mangling-version=v0
|
//@[v0] compile-flags: -Csymbol-mangling-version=v0
|
||||||
//@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options
|
//@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options
|
||||||
|
|
||||||
// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
|
|
||||||
//@ ignore-pass (test emits codegen-time warnings)
|
|
||||||
|
|
||||||
#![feature(async_closure, noop_waker)]
|
#![feature(async_closure, noop_waker)]
|
||||||
|
|
||||||
extern crate block_on;
|
extern crate block_on;
|
||||||
|
@ -38,7 +38,10 @@ fn through_field_and_ref<'a>(x: &S<'a>) {
|
|||||||
|
|
||||||
let c = async move || { println!("{}", *x.0); };
|
let c = async move || { println!("{}", *x.0); };
|
||||||
outlives::<'a>(c());
|
outlives::<'a>(c());
|
||||||
// outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails
|
|
||||||
|
// outlives::<'a>(call_once(c));
|
||||||
|
// The above fails b/c the by-move coroutine of `c` captures `x` in its entirety.
|
||||||
|
// Since we have not asserted that the borrow for `&S<'a>` outlives `'a`, it'll fail.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -9,7 +9,7 @@ fn main() {
|
|||||||
|
|
||||||
let mut x = 1;
|
let mut x = 1;
|
||||||
needs_fn(async || {
|
needs_fn(async || {
|
||||||
//~^ ERROR async closure does not implement `FnMut` because it captures state from its environment
|
//~^ ERROR async closure does not implement `FnMut` because it captures state from its environment
|
||||||
x += 1;
|
x += 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ async fn async_main() {
|
|||||||
{
|
{
|
||||||
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
||||||
let c = guidance!(async move || {
|
let c = guidance!(async move || {
|
||||||
// s.a = 2; // FIXME(async_closures): Figure out why this fails
|
s.a = 2;
|
||||||
drop(s.b);
|
drop(s.b);
|
||||||
});
|
});
|
||||||
s.c.0 = "uncaptured";
|
s.c.0 = "uncaptured";
|
||||||
@ -141,7 +141,7 @@ async fn async_main() {
|
|||||||
{
|
{
|
||||||
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
||||||
let c = guidance!(async move || {
|
let c = guidance!(async move || {
|
||||||
// s.a = 2; // FIXME(async_closures): Figure out why this fails
|
s.a = 2;
|
||||||
drop(s.b);
|
drop(s.b);
|
||||||
});
|
});
|
||||||
s.c.0 = "uncaptured";
|
s.c.0 = "uncaptured";
|
||||||
|
@ -38,10 +38,12 @@ fn through_field_and_ref<'a>(x: &S<'a>) {
|
|||||||
let c = async || { println!("{}", *x.0); }; //~ ERROR `x` does not live long enough
|
let c = async || { println!("{}", *x.0); }; //~ ERROR `x` does not live long enough
|
||||||
outlives::<'a>(c());
|
outlives::<'a>(c());
|
||||||
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x`
|
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn through_field_and_ref_move<'a>(x: &S<'a>) {
|
||||||
let c = async move || { println!("{}", *x.0); };
|
let c = async move || { println!("{}", *x.0); };
|
||||||
outlives::<'a>(c()); //~ ERROR `c` does not live long enough
|
outlives::<'a>(c()); //~ ERROR `c` does not live long enough
|
||||||
// outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails
|
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -100,7 +100,6 @@ LL | let c = async || { println!("{}", *x.0); };
|
|||||||
LL | outlives::<'a>(c());
|
LL | outlives::<'a>(c());
|
||||||
LL | outlives::<'a>(call_once(c));
|
LL | outlives::<'a>(call_once(c));
|
||||||
| ------------ argument requires that `x` is borrowed for `'a`
|
| ------------ argument requires that `x` is borrowed for `'a`
|
||||||
...
|
|
||||||
LL | }
|
LL | }
|
||||||
| - `x` dropped here while still borrowed
|
| - `x` dropped here while still borrowed
|
||||||
|
|
||||||
@ -114,11 +113,10 @@ LL | outlives::<'a>(call_once(c));
|
|||||||
| ^^^^^^^^^^^^ lifetime `'a` required
|
| ^^^^^^^^^^^^ lifetime `'a` required
|
||||||
|
|
||||||
error[E0597]: `c` does not live long enough
|
error[E0597]: `c` does not live long enough
|
||||||
--> $DIR/without-precise-captures-we-are-powerless.rs:43:20
|
--> $DIR/without-precise-captures-we-are-powerless.rs:45:20
|
||||||
|
|
|
|
||||||
LL | fn through_field_and_ref<'a>(x: &S<'a>) {
|
LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
|
||||||
| -- lifetime `'a` defined here
|
| -- lifetime `'a` defined here
|
||||||
...
|
|
||||||
LL | let c = async move || { println!("{}", *x.0); };
|
LL | let c = async move || { println!("{}", *x.0); };
|
||||||
| - binding `c` declared here
|
| - binding `c` declared here
|
||||||
LL | outlives::<'a>(c());
|
LL | outlives::<'a>(c());
|
||||||
@ -126,11 +124,20 @@ LL | outlives::<'a>(c());
|
|||||||
| |
|
| |
|
||||||
| borrowed value does not live long enough
|
| borrowed value does not live long enough
|
||||||
| argument requires that `c` is borrowed for `'a`
|
| argument requires that `c` is borrowed for `'a`
|
||||||
LL | // outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails
|
LL | outlives::<'a>(call_once(c));
|
||||||
LL | }
|
LL | }
|
||||||
| - `c` dropped here while still borrowed
|
| - `c` dropped here while still borrowed
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
error[E0621]: explicit lifetime required in the type of `x`
|
||||||
|
--> $DIR/without-precise-captures-we-are-powerless.rs:46:20
|
||||||
|
|
|
||||||
|
LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
|
||||||
|
| ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>`
|
||||||
|
...
|
||||||
|
LL | outlives::<'a>(call_once(c));
|
||||||
|
| ^^^^^^^^^^^^ lifetime `'a` required
|
||||||
|
|
||||||
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0505, E0597, E0621.
|
Some errors have detailed explanations: E0505, E0597, E0621.
|
||||||
For more information about an error, try `rustc --explain E0505`.
|
For more information about an error, try `rustc --explain E0505`.
|
||||||
|
13
tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs
Normal file
13
tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Test for issue #132429
|
||||||
|
//@compile-flags: -Zunstable-options --edition=2024
|
||||||
|
//@check-pass
|
||||||
|
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
trait Test {
|
||||||
|
fn foo<'a>(&'a self) -> Box<dyn Future<Output = impl IntoIterator<Item = u32>>> {
|
||||||
|
Box::new(async { [] })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
64
tests/ui/lint/non-local-defs/convoluted-locals-132427.rs
Normal file
64
tests/ui/lint/non-local-defs/convoluted-locals-132427.rs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Regression tests for https://github.com/rust-lang/rust/issues/132427
|
||||||
|
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
// original
|
||||||
|
mod auth {
|
||||||
|
const _: () = {
|
||||||
|
pub enum ArbitraryContext {}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
impl ArbitraryContext {}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
mod z {
|
||||||
|
pub enum ArbitraryContext {}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
const _: () = {
|
||||||
|
impl ArbitraryContext {}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
mod auth {
|
||||||
|
const _: () = {
|
||||||
|
pub enum ArbitraryContext {}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
impl ArbitraryContext {}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mod a {
|
||||||
|
mod b {
|
||||||
|
const _: () = {
|
||||||
|
pub enum ArbitraryContext {}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
impl ArbitraryContext {}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mod foo {
|
||||||
|
const _: () = {
|
||||||
|
mod auth {
|
||||||
|
const _: () = {
|
||||||
|
pub enum ArbitraryContext {}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
impl ArbitraryContext {}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user