Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #130461

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6360287
Fix #128930: Print documentation of CLI options missing their arg
GKFX Aug 11, 2024
ae75a9b
Update expectations
GKFX Aug 11, 2024
13e36cf
add new_cyclic_in for rc
Aug 28, 2024
21cb847
fix fmt
Aug 29, 2024
4abb8e2
fix new_cyclic_in for rc
Aug 29, 2024
2383cc9
improve comments
Aug 29, 2024
68169d3
add new_cyclic_in for Arc
Aug 29, 2024
97df334
remove the Clone requirement
Sep 6, 2024
550e55f
Remove duplicate impl
Sep 6, 2024
9d5d03b
Don't call extern_crate when local crate name is the same as a depend…
compiler-errors Sep 12, 2024
05483d5
Relate receiver invariantly in method probe for Mode::Path
compiler-errors Aug 14, 2024
6e982f5
Don't ICE in opaque_hidden_inferred_bound lint for RPITIT in trait wi…
compiler-errors Sep 16, 2024
062ff4d
Encode coroutine_by_move_body_def_id in crate metadata
compiler-errors Sep 10, 2024
af1ca77
Record synthetic MIR bodies in mir_keys
compiler-errors Sep 10, 2024
6750f04
Update library/alloc/src/sync.rs
matthewpipie Sep 17, 2024
978f10d
tests: allow trunc/select instructions to be missing
durin42 Sep 17, 2024
4beb1cf
Fix a couple more DefKind discrepancies between DefKind::Closure and …
compiler-errors Sep 17, 2024
bdacdfe
Minimize visibilities.
nnethercote Sep 5, 2024
cd3da00
Clean up formatting.
nnethercote Sep 10, 2024
52c5de0
Streamline `bin_op_to_[if]cmp_predicate`.
nnethercote Sep 10, 2024
b3b56d8
Remove unnecessary `cx` argument.
nnethercote Sep 11, 2024
ae1f092
Streamline `coroutine_kind_label`.
nnethercote Sep 11, 2024
3ec2f12
Rename some lifetimes.
nnethercote Sep 11, 2024
c629538
Merge some impl blocks.
nnethercote Sep 13, 2024
9b91d67
Rollup merge of #128961 - GKFX:issue-128930-explain-missing-option, r…
fee1-dead Sep 17, 2024
1f1beb6
Rollup merge of #129073 - compiler-errors:receiver-variance, r=lcnr
fee1-dead Sep 17, 2024
5385303
Rollup merge of #129674 - matthewpipie:rc-arc-new-cyclic-in, r=dtolnay
fee1-dead Sep 17, 2024
8a5f499
Rollup merge of #130201 - compiler-errors:foreign-synthetic-body, r=lcnr
fee1-dead Sep 17, 2024
4922280
Rollup merge of #130275 - compiler-errors:extern-crate, r=lcnr
fee1-dead Sep 17, 2024
4a9fbc3
Rollup merge of #130440 - compiler-errors:rpitit-opaque-hidden, r=jie…
fee1-dead Sep 17, 2024
50a8de3
Rollup merge of #130454 - durin42:llvm-20-notrunc, r=workingjubilee
fee1-dead Sep 17, 2024
50fd6ce
Rollup merge of #130458 - nnethercote:rustc_codegen_ssa-cleanups, r=j…
fee1-dead Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub trait ArchiveBuilderBuilder {
}
}

pub fn create_mingw_dll_import_lib(
fn create_mingw_dll_import_lib(
sess: &Session,
lib_name: &str,
import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
Expand Down
26 changes: 13 additions & 13 deletions compiler/rustc_codegen_ssa/src/back/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{fmt, io, mem};
use rustc_target::spec::LldFlavor;

#[derive(Clone)]
pub struct Command {
pub(crate) struct Command {
program: Program,
args: Vec<OsString>,
env: Vec<(OsString, OsString)>,
Expand All @@ -23,28 +23,28 @@ enum Program {
}

impl Command {
pub fn new<P: AsRef<OsStr>>(program: P) -> Command {
pub(crate) fn new<P: AsRef<OsStr>>(program: P) -> Command {
Command::_new(Program::Normal(program.as_ref().to_owned()))
}

pub fn bat_script<P: AsRef<OsStr>>(program: P) -> Command {
pub(crate) fn bat_script<P: AsRef<OsStr>>(program: P) -> Command {
Command::_new(Program::CmdBatScript(program.as_ref().to_owned()))
}

pub fn lld<P: AsRef<OsStr>>(program: P, flavor: LldFlavor) -> Command {
pub(crate) fn lld<P: AsRef<OsStr>>(program: P, flavor: LldFlavor) -> Command {
Command::_new(Program::Lld(program.as_ref().to_owned(), flavor))
}

fn _new(program: Program) -> Command {
Command { program, args: Vec::new(), env: Vec::new(), env_remove: Vec::new() }
}

pub fn arg<P: AsRef<OsStr>>(&mut self, arg: P) -> &mut Command {
pub(crate) fn arg<P: AsRef<OsStr>>(&mut self, arg: P) -> &mut Command {
self._arg(arg.as_ref());
self
}

pub fn args<I>(&mut self, args: I) -> &mut Command
pub(crate) fn args<I>(&mut self, args: I) -> &mut Command
where
I: IntoIterator<Item: AsRef<OsStr>>,
{
Expand All @@ -58,7 +58,7 @@ impl Command {
self.args.push(arg.to_owned());
}

pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Command
pub(crate) fn env<K, V>(&mut self, key: K, value: V) -> &mut Command
where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
Expand All @@ -71,7 +71,7 @@ impl Command {
self.env.push((key.to_owned(), value.to_owned()));
}

pub fn env_remove<K>(&mut self, key: K) -> &mut Command
pub(crate) fn env_remove<K>(&mut self, key: K) -> &mut Command
where
K: AsRef<OsStr>,
{
Expand All @@ -83,11 +83,11 @@ impl Command {
self.env_remove.push(key.to_owned());
}

pub fn output(&mut self) -> io::Result<Output> {
pub(crate) fn output(&mut self) -> io::Result<Output> {
self.command().output()
}

pub fn command(&self) -> process::Command {
pub(crate) fn command(&self) -> process::Command {
let mut ret = match self.program {
Program::Normal(ref p) => process::Command::new(p),
Program::CmdBatScript(ref p) => {
Expand All @@ -111,17 +111,17 @@ impl Command {

// extensions

pub fn get_args(&self) -> &[OsString] {
pub(crate) fn get_args(&self) -> &[OsString] {
&self.args
}

pub fn take_args(&mut self) -> Vec<OsString> {
pub(crate) fn take_args(&mut self) -> Vec<OsString> {
mem::take(&mut self.args)
}

/// Returns a `true` if we're pretty sure that this'll blow OS spawn limits,
/// or `false` if we should attempt to spawn and see what the OS says.
pub fn very_likely_to_exceed_some_spawn_limit(&self) -> bool {
pub(crate) fn very_likely_to_exceed_some_spawn_limit(&self) -> bool {
// We mostly only care about Windows in this method, on Unix the limits
// can be gargantuan anyway so we're pretty unlikely to hit them
if cfg!(unix) {
Expand Down
54 changes: 31 additions & 23 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::errors;
/// and prevent inspection of linker output in case of errors, which we occasionally do.
/// This should be acceptable because other messages from rustc are in English anyway,
/// and may also be desirable to improve searchability of the linker diagnostics.
pub fn disable_localization(linker: &mut Command) {
pub(crate) fn disable_localization(linker: &mut Command) {
// No harm in setting both env vars simultaneously.
// Unix-style linkers.
linker.env("LC_ALL", "C");
Expand All @@ -41,7 +41,7 @@ pub fn disable_localization(linker: &mut Command) {
/// The third parameter is for env vars, used on windows to set up the
/// path for MSVC to find its DLLs, and gcc to find its bundled
/// toolchain
pub fn get_linker<'a>(
pub(crate) fn get_linker<'a>(
sess: &'a Session,
linker: &Path,
flavor: LinkerFlavor,
Expand Down Expand Up @@ -215,28 +215,36 @@ fn link_or_cc_args<L: Linker + ?Sized>(
macro_rules! generate_arg_methods {
($($ty:ty)*) => { $(
impl $ty {
pub fn verbatim_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
#[allow(unused)]
pub(crate) fn verbatim_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
verbatim_args(self, args)
}
pub fn verbatim_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
#[allow(unused)]
pub(crate) fn verbatim_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
verbatim_args(self, iter::once(arg))
}
pub fn link_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>) -> &mut Self {
#[allow(unused)]
pub(crate) fn link_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>) -> &mut Self {
link_args(self, args)
}
pub fn link_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
#[allow(unused)]
pub(crate) fn link_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
link_args(self, iter::once(arg))
}
pub fn cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
#[allow(unused)]
pub(crate) fn cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
cc_args(self, args)
}
pub fn cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
#[allow(unused)]
pub(crate) fn cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
cc_args(self, iter::once(arg))
}
pub fn link_or_cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
#[allow(unused)]
pub(crate) fn link_or_cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
link_or_cc_args(self, args)
}
pub fn link_or_cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
#[allow(unused)]
pub(crate) fn link_or_cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
link_or_cc_args(self, iter::once(arg))
}
}
Expand All @@ -263,7 +271,7 @@ generate_arg_methods! {
/// represents the meaning of each option being passed down. This trait is then
/// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an
/// MSVC linker (e.g., `link.exe`) is being used.
pub trait Linker {
pub(crate) trait Linker {
fn cmd(&mut self) -> &mut Command;
fn is_cc(&self) -> bool {
false
Expand Down Expand Up @@ -314,12 +322,12 @@ pub trait Linker {
}

impl dyn Linker + '_ {
pub fn take_cmd(&mut self) -> Command {
pub(crate) fn take_cmd(&mut self) -> Command {
mem::replace(self.cmd(), Command::new(""))
}
}

pub struct GccLinker<'a> {
struct GccLinker<'a> {
cmd: Command,
sess: &'a Session,
target_cpu: &'a str,
Expand Down Expand Up @@ -849,7 +857,7 @@ impl<'a> Linker for GccLinker<'a> {
}
}

pub struct MsvcLinker<'a> {
struct MsvcLinker<'a> {
cmd: Command,
sess: &'a Session,
}
Expand Down Expand Up @@ -1103,7 +1111,7 @@ impl<'a> Linker for MsvcLinker<'a> {
}
}

pub struct EmLinker<'a> {
struct EmLinker<'a> {
cmd: Command,
sess: &'a Session,
}
Expand Down Expand Up @@ -1220,7 +1228,7 @@ impl<'a> Linker for EmLinker<'a> {
}
}

pub struct WasmLd<'a> {
struct WasmLd<'a> {
cmd: Command,
sess: &'a Session,
}
Expand Down Expand Up @@ -1404,7 +1412,7 @@ impl<'a> WasmLd<'a> {
}

/// Linker shepherd script for L4Re (Fiasco)
pub struct L4Bender<'a> {
struct L4Bender<'a> {
cmd: Command,
sess: &'a Session,
hinted_static: bool,
Expand Down Expand Up @@ -1510,7 +1518,7 @@ impl<'a> Linker for L4Bender<'a> {
}

impl<'a> L4Bender<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
L4Bender { cmd, sess, hinted_static: false }
}

Expand All @@ -1523,14 +1531,14 @@ impl<'a> L4Bender<'a> {
}

/// Linker for AIX.
pub struct AixLinker<'a> {
struct AixLinker<'a> {
cmd: Command,
sess: &'a Session,
hinted_static: Option<bool>,
}

impl<'a> AixLinker<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> {
fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> {
AixLinker { cmd, sess, hinted_static: None }
}

Expand Down Expand Up @@ -1758,7 +1766,7 @@ pub(crate) fn linked_symbols(

/// Much simplified and explicit CLI for the NVPTX linker. The linker operates
/// with bitcode and uses LLVM backend to generate a PTX assembly.
pub struct PtxLinker<'a> {
struct PtxLinker<'a> {
cmd: Command,
sess: &'a Session,
}
Expand Down Expand Up @@ -1824,7 +1832,7 @@ impl<'a> Linker for PtxLinker<'a> {
}

/// The `self-contained` LLVM bitcode linker
pub struct LlbcLinker<'a> {
struct LlbcLinker<'a> {
cmd: Command,
sess: &'a Session,
}
Expand Down Expand Up @@ -1895,7 +1903,7 @@ impl<'a> Linker for LlbcLinker<'a> {
fn linker_plugin_lto(&mut self) {}
}

pub struct BpfLinker<'a> {
struct BpfLinker<'a> {
cmd: Command,
sess: &'a Session,
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use rustc_target::spec::{ef_avr_arch, RelocModel, Target};
/// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
/// </dl>
#[derive(Debug)]
pub struct DefaultMetadataLoader;
pub(crate) struct DefaultMetadataLoader;

static AIX_METADATA_SYMBOL_NAME: &'static str = "__aix_rust_metadata";

Expand Down Expand Up @@ -416,7 +416,7 @@ fn macho_is_arm64e(target: &Target) -> bool {
target.llvm_target.starts_with("arm64e")
}

pub enum MetadataPosition {
pub(crate) enum MetadataPosition {
First,
Last,
}
Expand Down Expand Up @@ -452,7 +452,7 @@ pub enum MetadataPosition {
/// * ELF - All other targets are similar to Windows in that there's a
/// `SHF_EXCLUDE` flag we can set on sections in an object file to get
/// automatically removed from the final output.
pub fn create_wrapper_file(
pub(crate) fn create_wrapper_file(
sess: &Session,
section_name: String,
data: &[u8],
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/back/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub mod archive;
pub mod command;
pub(crate) mod command;
pub mod link;
pub mod linker;
pub(crate) mod linker;
pub mod lto;
pub mod metadata;
pub mod rpath;
pub(crate) mod rpath;
pub mod symbol_export;
pub mod write;
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_fs_util::try_canonicalize;
use tracing::debug;

pub struct RPathConfig<'a> {
pub(super) struct RPathConfig<'a> {
pub libs: &'a [&'a Path],
pub out_filename: PathBuf,
pub is_like_osx: bool,
pub linker_is_gnu: bool,
}

pub fn get_rpath_flags(config: &RPathConfig<'_>) -> Vec<OsString> {
pub(super) fn get_rpath_flags(config: &RPathConfig<'_>) -> Vec<OsString> {
debug!("preparing the RPATH!");

let rpaths = get_rpaths(config);
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_codegen_ssa/src/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tracing::debug;

use crate::base::allocator_kind_for_codegen;

pub fn threshold(tcx: TyCtxt<'_>) -> SymbolExportLevel {
fn threshold(tcx: TyCtxt<'_>) -> SymbolExportLevel {
crates_export_threshold(tcx.crate_types())
}

Expand Down Expand Up @@ -484,7 +484,7 @@ fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_>, def_id: LocalDefId)
!tcx.reachable_set(()).contains(&def_id)
}

pub fn provide(providers: &mut Providers) {
pub(crate) fn provide(providers: &mut Providers) {
providers.reachable_non_generics = reachable_non_generics_provider;
providers.is_reachable_non_generic = is_reachable_non_generic_provider_local;
providers.exported_symbols = exported_symbols_provider_local;
Expand Down Expand Up @@ -525,7 +525,7 @@ fn symbol_export_level(tcx: TyCtxt<'_>, sym_def_id: DefId) -> SymbolExportLevel
}

/// This is the symbol name of the given instance instantiated in a specific crate.
pub fn symbol_name_for_instance_in_crate<'tcx>(
pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
tcx: TyCtxt<'tcx>,
symbol: ExportedSymbol<'tcx>,
instantiating_crate: CrateNum,
Expand Down Expand Up @@ -582,7 +582,7 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
/// This is the symbol name of the given instance as seen by the linker.
///
/// On 32-bit Windows symbols are decorated according to their calling conventions.
pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
tcx: TyCtxt<'tcx>,
symbol: ExportedSymbol<'tcx>,
instantiating_crate: CrateNum,
Expand Down Expand Up @@ -661,7 +661,7 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
format!("{prefix}{undecorated}{suffix}{args_in_bytes}")
}

pub fn exporting_symbol_name_for_instance_in_crate<'tcx>(
pub(crate) fn exporting_symbol_name_for_instance_in_crate<'tcx>(
tcx: TyCtxt<'tcx>,
symbol: ExportedSymbol<'tcx>,
cnum: CrateNum,
Expand Down
Loading
Loading