Skip to content

Commit f609b7e

Browse files
committed
Auto merge of rust-lang#130473 - matthiaskrgr:rollup-lf29374, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#128535 (Format `std::env::consts` docstrings with markdown backticks) - rust-lang#128961 (Fix rust-lang#128930: Print documentation of CLI options missing their arg) - rust-lang#129988 (Use `Vec` in `rustc_interface::Config::locale_resources`) - rust-lang#130201 (Encode `coroutine_by_move_body_def_id` in crate metadata) - rust-lang#130275 (Don't call `extern_crate` when local crate name is the same as a dependency and we have a trait error) - rust-lang#130314 (Use the same precedence for all macro-like exprs) - rust-lang#130440 (Don't ICE in `opaque_hidden_inferred_bound` lint for RPITIT in trait with no default method body) - rust-lang#130458 (`rustc_codegen_ssa` cleanups) - rust-lang#130469 (Mark `where_clauses_object_safety` as removed) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e9e13a6 + 065690e commit f609b7e

Some content is hidden

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

58 files changed

+602
-426
lines changed

compiler/rustc_ast/src/ast.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ impl Expr {
12931293
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
12941294
ExprKind::Unary(..) => ExprPrecedence::Unary,
12951295
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) => ExprPrecedence::Lit,
1296-
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
1296+
ExprKind::Cast(..) => ExprPrecedence::Cast,
12971297
ExprKind::Let(..) => ExprPrecedence::Let,
12981298
ExprKind::If(..) => ExprPrecedence::If,
12991299
ExprKind::While(..) => ExprPrecedence::While,
@@ -1317,17 +1317,18 @@ impl Expr {
13171317
ExprKind::Break(..) => ExprPrecedence::Break,
13181318
ExprKind::Continue(..) => ExprPrecedence::Continue,
13191319
ExprKind::Ret(..) => ExprPrecedence::Ret,
1320-
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
1321-
ExprKind::OffsetOf(..) => ExprPrecedence::OffsetOf,
1322-
ExprKind::MacCall(..) => ExprPrecedence::Mac,
13231320
ExprKind::Struct(..) => ExprPrecedence::Struct,
13241321
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
13251322
ExprKind::Paren(..) => ExprPrecedence::Paren,
13261323
ExprKind::Try(..) => ExprPrecedence::Try,
13271324
ExprKind::Yield(..) => ExprPrecedence::Yield,
13281325
ExprKind::Yeet(..) => ExprPrecedence::Yeet,
1329-
ExprKind::FormatArgs(..) => ExprPrecedence::FormatArgs,
13301326
ExprKind::Become(..) => ExprPrecedence::Become,
1327+
ExprKind::InlineAsm(..)
1328+
| ExprKind::Type(..)
1329+
| ExprKind::OffsetOf(..)
1330+
| ExprKind::FormatArgs(..)
1331+
| ExprKind::MacCall(..) => ExprPrecedence::Mac,
13311332
ExprKind::Err(_) | ExprKind::Dummy => ExprPrecedence::Err,
13321333
}
13331334
}

compiler/rustc_ast/src/util/parser.rs

-6
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,7 @@ pub enum ExprPrecedence {
265265
Field,
266266
Index,
267267
Try,
268-
InlineAsm,
269-
OffsetOf,
270268
Mac,
271-
FormatArgs,
272269

273270
Array,
274271
Repeat,
@@ -333,17 +330,14 @@ impl ExprPrecedence {
333330
| ExprPrecedence::ConstBlock
334331
| ExprPrecedence::Field
335332
| ExprPrecedence::ForLoop
336-
| ExprPrecedence::FormatArgs
337333
| ExprPrecedence::Gen
338334
| ExprPrecedence::If
339335
| ExprPrecedence::Index
340-
| ExprPrecedence::InlineAsm
341336
| ExprPrecedence::Lit
342337
| ExprPrecedence::Loop
343338
| ExprPrecedence::Mac
344339
| ExprPrecedence::Match
345340
| ExprPrecedence::MethodCall
346-
| ExprPrecedence::OffsetOf
347341
| ExprPrecedence::Paren
348342
| ExprPrecedence::Path
349343
| ExprPrecedence::PostfixMatch

compiler/rustc_codegen_ssa/src/back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub trait ArchiveBuilderBuilder {
157157
}
158158
}
159159

160-
pub fn create_mingw_dll_import_lib(
160+
fn create_mingw_dll_import_lib(
161161
sess: &Session,
162162
lib_name: &str,
163163
import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,

compiler/rustc_codegen_ssa/src/back/command.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{fmt, io, mem};
88
use rustc_target::spec::LldFlavor;
99

1010
#[derive(Clone)]
11-
pub struct Command {
11+
pub(crate) struct Command {
1212
program: Program,
1313
args: Vec<OsString>,
1414
env: Vec<(OsString, OsString)>,
@@ -23,28 +23,28 @@ enum Program {
2323
}
2424

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

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

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

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

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

47-
pub fn args<I>(&mut self, args: I) -> &mut Command
47+
pub(crate) fn args<I>(&mut self, args: I) -> &mut Command
4848
where
4949
I: IntoIterator<Item: AsRef<OsStr>>,
5050
{
@@ -58,7 +58,7 @@ impl Command {
5858
self.args.push(arg.to_owned());
5959
}
6060

61-
pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Command
61+
pub(crate) fn env<K, V>(&mut self, key: K, value: V) -> &mut Command
6262
where
6363
K: AsRef<OsStr>,
6464
V: AsRef<OsStr>,
@@ -71,7 +71,7 @@ impl Command {
7171
self.env.push((key.to_owned(), value.to_owned()));
7272
}
7373

74-
pub fn env_remove<K>(&mut self, key: K) -> &mut Command
74+
pub(crate) fn env_remove<K>(&mut self, key: K) -> &mut Command
7575
where
7676
K: AsRef<OsStr>,
7777
{
@@ -83,11 +83,11 @@ impl Command {
8383
self.env_remove.push(key.to_owned());
8484
}
8585

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

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

112112
// extensions
113113

114-
pub fn get_args(&self) -> &[OsString] {
114+
pub(crate) fn get_args(&self) -> &[OsString] {
115115
&self.args
116116
}
117117

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

122122
/// Returns a `true` if we're pretty sure that this'll blow OS spawn limits,
123123
/// or `false` if we should attempt to spawn and see what the OS says.
124-
pub fn very_likely_to_exceed_some_spawn_limit(&self) -> bool {
124+
pub(crate) fn very_likely_to_exceed_some_spawn_limit(&self) -> bool {
125125
// We mostly only care about Windows in this method, on Unix the limits
126126
// can be gargantuan anyway so we're pretty unlikely to hit them
127127
if cfg!(unix) {

compiler/rustc_codegen_ssa/src/back/linker.rs

+31-23
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::errors;
3030
/// and prevent inspection of linker output in case of errors, which we occasionally do.
3131
/// This should be acceptable because other messages from rustc are in English anyway,
3232
/// and may also be desirable to improve searchability of the linker diagnostics.
33-
pub fn disable_localization(linker: &mut Command) {
33+
pub(crate) fn disable_localization(linker: &mut Command) {
3434
// No harm in setting both env vars simultaneously.
3535
// Unix-style linkers.
3636
linker.env("LC_ALL", "C");
@@ -41,7 +41,7 @@ pub fn disable_localization(linker: &mut Command) {
4141
/// The third parameter is for env vars, used on windows to set up the
4242
/// path for MSVC to find its DLLs, and gcc to find its bundled
4343
/// toolchain
44-
pub fn get_linker<'a>(
44+
pub(crate) fn get_linker<'a>(
4545
sess: &'a Session,
4646
linker: &Path,
4747
flavor: LinkerFlavor,
@@ -215,28 +215,36 @@ fn link_or_cc_args<L: Linker + ?Sized>(
215215
macro_rules! generate_arg_methods {
216216
($($ty:ty)*) => { $(
217217
impl $ty {
218-
pub fn verbatim_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
218+
#[allow(unused)]
219+
pub(crate) fn verbatim_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
219220
verbatim_args(self, args)
220221
}
221-
pub fn verbatim_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
222+
#[allow(unused)]
223+
pub(crate) fn verbatim_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
222224
verbatim_args(self, iter::once(arg))
223225
}
224-
pub fn link_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>) -> &mut Self {
226+
#[allow(unused)]
227+
pub(crate) fn link_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>) -> &mut Self {
225228
link_args(self, args)
226229
}
227-
pub fn link_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
230+
#[allow(unused)]
231+
pub(crate) fn link_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
228232
link_args(self, iter::once(arg))
229233
}
230-
pub fn cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
234+
#[allow(unused)]
235+
pub(crate) fn cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
231236
cc_args(self, args)
232237
}
233-
pub fn cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
238+
#[allow(unused)]
239+
pub(crate) fn cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
234240
cc_args(self, iter::once(arg))
235241
}
236-
pub fn link_or_cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
242+
#[allow(unused)]
243+
pub(crate) fn link_or_cc_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self {
237244
link_or_cc_args(self, args)
238245
}
239-
pub fn link_or_cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
246+
#[allow(unused)]
247+
pub(crate) fn link_or_cc_arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self {
240248
link_or_cc_args(self, iter::once(arg))
241249
}
242250
}
@@ -263,7 +271,7 @@ generate_arg_methods! {
263271
/// represents the meaning of each option being passed down. This trait is then
264272
/// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an
265273
/// MSVC linker (e.g., `link.exe`) is being used.
266-
pub trait Linker {
274+
pub(crate) trait Linker {
267275
fn cmd(&mut self) -> &mut Command;
268276
fn is_cc(&self) -> bool {
269277
false
@@ -314,12 +322,12 @@ pub trait Linker {
314322
}
315323

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

322-
pub struct GccLinker<'a> {
330+
struct GccLinker<'a> {
323331
cmd: Command,
324332
sess: &'a Session,
325333
target_cpu: &'a str,
@@ -849,7 +857,7 @@ impl<'a> Linker for GccLinker<'a> {
849857
}
850858
}
851859

852-
pub struct MsvcLinker<'a> {
860+
struct MsvcLinker<'a> {
853861
cmd: Command,
854862
sess: &'a Session,
855863
}
@@ -1103,7 +1111,7 @@ impl<'a> Linker for MsvcLinker<'a> {
11031111
}
11041112
}
11051113

1106-
pub struct EmLinker<'a> {
1114+
struct EmLinker<'a> {
11071115
cmd: Command,
11081116
sess: &'a Session,
11091117
}
@@ -1220,7 +1228,7 @@ impl<'a> Linker for EmLinker<'a> {
12201228
}
12211229
}
12221230

1223-
pub struct WasmLd<'a> {
1231+
struct WasmLd<'a> {
12241232
cmd: Command,
12251233
sess: &'a Session,
12261234
}
@@ -1404,7 +1412,7 @@ impl<'a> WasmLd<'a> {
14041412
}
14051413

14061414
/// Linker shepherd script for L4Re (Fiasco)
1407-
pub struct L4Bender<'a> {
1415+
struct L4Bender<'a> {
14081416
cmd: Command,
14091417
sess: &'a Session,
14101418
hinted_static: bool,
@@ -1510,7 +1518,7 @@ impl<'a> Linker for L4Bender<'a> {
15101518
}
15111519

15121520
impl<'a> L4Bender<'a> {
1513-
pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
1521+
fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
15141522
L4Bender { cmd, sess, hinted_static: false }
15151523
}
15161524

@@ -1523,14 +1531,14 @@ impl<'a> L4Bender<'a> {
15231531
}
15241532

15251533
/// Linker for AIX.
1526-
pub struct AixLinker<'a> {
1534+
struct AixLinker<'a> {
15271535
cmd: Command,
15281536
sess: &'a Session,
15291537
hinted_static: Option<bool>,
15301538
}
15311539

15321540
impl<'a> AixLinker<'a> {
1533-
pub fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> {
1541+
fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> {
15341542
AixLinker { cmd, sess, hinted_static: None }
15351543
}
15361544

@@ -1758,7 +1766,7 @@ pub(crate) fn linked_symbols(
17581766

17591767
/// Much simplified and explicit CLI for the NVPTX linker. The linker operates
17601768
/// with bitcode and uses LLVM backend to generate a PTX assembly.
1761-
pub struct PtxLinker<'a> {
1769+
struct PtxLinker<'a> {
17621770
cmd: Command,
17631771
sess: &'a Session,
17641772
}
@@ -1824,7 +1832,7 @@ impl<'a> Linker for PtxLinker<'a> {
18241832
}
18251833

18261834
/// The `self-contained` LLVM bitcode linker
1827-
pub struct LlbcLinker<'a> {
1835+
struct LlbcLinker<'a> {
18281836
cmd: Command,
18291837
sess: &'a Session,
18301838
}
@@ -1895,7 +1903,7 @@ impl<'a> Linker for LlbcLinker<'a> {
18951903
fn linker_plugin_lto(&mut self) {}
18961904
}
18971905

1898-
pub struct BpfLinker<'a> {
1906+
struct BpfLinker<'a> {
18991907
cmd: Command,
19001908
sess: &'a Session,
19011909
}

compiler/rustc_codegen_ssa/src/back/metadata.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_target::spec::{ef_avr_arch, RelocModel, Target};
3232
/// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
3333
/// </dl>
3434
#[derive(Debug)]
35-
pub struct DefaultMetadataLoader;
35+
pub(crate) struct DefaultMetadataLoader;
3636

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

@@ -416,7 +416,7 @@ fn macho_is_arm64e(target: &Target) -> bool {
416416
target.llvm_target.starts_with("arm64e")
417417
}
418418

419-
pub enum MetadataPosition {
419+
pub(crate) enum MetadataPosition {
420420
First,
421421
Last,
422422
}
@@ -452,7 +452,7 @@ pub enum MetadataPosition {
452452
/// * ELF - All other targets are similar to Windows in that there's a
453453
/// `SHF_EXCLUDE` flag we can set on sections in an object file to get
454454
/// automatically removed from the final output.
455-
pub fn create_wrapper_file(
455+
pub(crate) fn create_wrapper_file(
456456
sess: &Session,
457457
section_name: String,
458458
data: &[u8],
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
pub mod archive;
2-
pub mod command;
2+
pub(crate) mod command;
33
pub mod link;
4-
pub mod linker;
4+
pub(crate) mod linker;
55
pub mod lto;
66
pub mod metadata;
7-
pub mod rpath;
7+
pub(crate) mod rpath;
88
pub mod symbol_export;
99
pub mod write;

compiler/rustc_codegen_ssa/src/back/rpath.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ use rustc_data_structures::fx::FxHashSet;
66
use rustc_fs_util::try_canonicalize;
77
use tracing::debug;
88

9-
pub struct RPathConfig<'a> {
9+
pub(super) struct RPathConfig<'a> {
1010
pub libs: &'a [&'a Path],
1111
pub out_filename: PathBuf,
1212
pub is_like_osx: bool,
1313
pub linker_is_gnu: bool,
1414
}
1515

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

1919
let rpaths = get_rpaths(config);

0 commit comments

Comments
 (0)