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 7 pull requests #128999

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
03ee7b5
Move verbose help parsing to `main`
Kobzol Aug 9, 2024
5431a93
Pass `Flags` to `Config::parse` explicitly
Kobzol Aug 9, 2024
ed7bdbb
Store do_not_recommend-ness in impl header
compiler-errors Aug 10, 2024
20a16bb
Add test
compiler-errors Aug 10, 2024
f83b085
rustc_attr: remove redundant `#[allow(rustc::untranslatable_diagnosti…
GrigorenkoPV Aug 7, 2024
43f3a21
rustc_const_eval: remove redundant `#[allow(rustc::untranslatable_dia…
GrigorenkoPV Aug 7, 2024
3a18c6b
rustc_const_eval: make message about "const stable" translatable
GrigorenkoPV Aug 7, 2024
a11922d
rustc_const_eval: make LazyLock suggestion translatable
GrigorenkoPV Aug 7, 2024
c36b21a
rustc_attr: make "compact `cfg(target(..))` is unstable" translatable
GrigorenkoPV Aug 7, 2024
334a097
rustc_ast_lowering: make "using `_` for array lengths is unstable" tr…
GrigorenkoPV Aug 7, 2024
290df4f
rustc_ast_lowering: make "yield syntax is experimental" translatable
GrigorenkoPV Aug 7, 2024
6760298
rustc_ast_lowering: make asm-related unstability messages translatable
GrigorenkoPV Aug 7, 2024
48413cf
rustc_borrowck: make dereference suggestion translatable
GrigorenkoPV Aug 8, 2024
446e03e
rustc_borrowck: make suggestion to move closure translatable
GrigorenkoPV Aug 8, 2024
1b6cc24
rustc_borrowck: make some suggestion about static lifetimes translatable
GrigorenkoPV Aug 8, 2024
1481ab3
rustc_borrowck: make "implicit static" suff translatable
GrigorenkoPV Aug 8, 2024
f43cdce
rustc_borrowck: fmt
GrigorenkoPV Aug 8, 2024
fbc2459
rustc_expand: remove some redundant `#[allow(rustc::untranslatable_di…
GrigorenkoPV Aug 8, 2024
1373074
rustc_expand: make a message translatable
GrigorenkoPV Aug 8, 2024
cbae581
rustc_interface: remove a redundant `#[allow(rustc::untranslatable_di…
GrigorenkoPV Aug 8, 2024
2babab6
rustc_lint: remove some redundant `#[allow(rustc::untranslatable_diag…
GrigorenkoPV Aug 8, 2024
d548636
rustc_metadata: remove a redundant `#[allow(rustc::untranslatable_dia…
GrigorenkoPV Aug 8, 2024
007cc2c
rustc_metadata: make "link {arg,cfg} is unstable" translatable
GrigorenkoPV Aug 8, 2024
fcdb374
rustc_passes: remove a redundant `#[allow(rustc::untranslatable_diagn…
GrigorenkoPV Aug 9, 2024
f09a2b0
rustc_passes: make some messages in check_attr translatable
GrigorenkoPV Aug 9, 2024
4f8042e
Support reading thin archives in ArArchiveBuilder
bjorn3 Aug 10, 2024
a57f73d
Add test for thin archive reading support
bjorn3 Aug 10, 2024
c1f5350
Use ArArchiveBuilder with the LLVM backend too
bjorn3 Aug 10, 2024
141d9dc
remove unused imports from rmake tests
lqd Aug 10, 2024
f4cb0de
remove other warnings from rmake tests
lqd Aug 10, 2024
d63a067
Add fixme for removing LlvmArchiveBuilder in the future
bjorn3 Aug 10, 2024
dcd6170
use `rfs` in rustdoc io rmake test
lqd Aug 11, 2024
db68a19
Fix review comments and other improvements
bjorn3 Aug 11, 2024
c361c92
Use assert_matches around the compiler
compiler-errors Aug 11, 2024
c5205e9
Normalize struct tail properly in borrowck and hir typeck
compiler-errors Aug 11, 2024
b5d2079
Rename normalization functions to raw
compiler-errors Aug 11, 2024
f15997f
Remove struct_tail_no_normalization
compiler-errors Aug 11, 2024
712dbe9
Rollup merge of #128712 - compiler-errors:normalize-borrowck, r=lcnr
matthiaskrgr Aug 12, 2024
a383ddc
Rollup merge of #128878 - Kobzol:refactor-flags, r=onur-ozkan
matthiaskrgr Aug 12, 2024
c444654
Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=n…
matthiaskrgr Aug 12, 2024
e42f8b6
Rollup merge of #128912 - compiler-errors:do-not-recommend-impl, r=lcnr
matthiaskrgr Aug 12, 2024
f73d4d8
Rollup merge of #128936 - bjorn3:fix_thin_archive_reading, r=jieyouxu
matthiaskrgr Aug 12, 2024
fb00ffa
Rollup merge of #128937 - lqd:clean-rmake-tests, r=jieyouxu
matthiaskrgr Aug 12, 2024
7004267
Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu
matthiaskrgr Aug 12, 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
Next Next commit
Move verbose help parsing to main
To remove a side effect (process exit) when parsing config.
  • Loading branch information
Kobzol committed Aug 9, 2024
commit 03ee7b59991a107b08d4a2da50b1654dba48e225
6 changes: 5 additions & 1 deletion src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ use std::str::FromStr;
use std::{env, process};

use bootstrap::{
find_recent_config_change_ids, human_readable_changes, t, Build, Config, Subcommand,
find_recent_config_change_ids, human_readable_changes, t, Build, Config, Flags, Subcommand,
CONFIG_CHANGE_HISTORY,
};

fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
let config = Config::parse(&args);

if Flags::try_parse_verbose_help(&args) {
return;
}

let mut build_lock;
let _build_lock_guard;

Expand Down
24 changes: 17 additions & 7 deletions src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ pub struct Flags {
}

impl Flags {
pub fn parse(args: &[String]) -> Self {
let first = String::from("x.py");
let it = std::iter::once(&first).chain(args.iter());
/// Check if `<cmd> -h -v` was passed.
/// If yes, print the available paths and return `true`.
pub fn try_parse_verbose_help(args: &[String]) -> bool {
// We need to check for `<cmd> -h -v`, in which case we list the paths
#[derive(Parser)]
#[command(disable_help_flag(true))]
Expand All @@ -198,24 +198,34 @@ impl Flags {
cmd: Kind,
}
if let Ok(HelpVerboseOnly { help: true, verbose: 1.., cmd: subcommand }) =
HelpVerboseOnly::try_parse_from(it.clone())
HelpVerboseOnly::try_parse_from(normalize_args(args))
{
println!("NOTE: updating submodules before printing available paths");
let config = Config::parse(&[String::from("build")]);
let config = Config::parse(Self::parse(&[String::from("build")]));
let build = Build::new(config);
let paths = Builder::get_help(&build, subcommand);
if let Some(s) = paths {
println!("{s}");
} else {
panic!("No paths available for subcommand `{}`", subcommand.as_str());
}
crate::exit!(0);
true
} else {
false
}
}

Flags::parse_from(it)
pub fn parse(args: &[String]) -> Self {
Flags::parse_from(normalize_args(args))
}
}

fn normalize_args(args: &[String]) -> Vec<String> {
let first = String::from("x.py");
let it = std::iter::once(first).chain(args.iter().cloned());
it.collect()
}

#[derive(Debug, Clone, Default, clap::Subcommand)]
pub enum Subcommand {
#[command(aliases = ["b"], long_about = "\n
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[allow(clippy::module_inception)]
mod config;
pub(crate) mod flags;
pub mod flags;
#[cfg(test)]
mod tests;

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mod core;
mod utils;

pub use core::builder::PathSet;
pub use core::config::flags::Subcommand;
pub use core::config::flags::{Flags, Subcommand};
pub use core::config::Config;

pub use utils::change_tracker::{
Expand Down