Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cdd02e9

Browse files
committedApr 27, 2024
Auto merge of #124452 - matthiaskrgr:rollup-psvo04i, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #123942 (`x vendor`) - #124165 (add test for incremental ICE: slice-pattern-const.rs #83085) - #124210 (Abort a process when FD ownership is violated) - #124242 (bootstrap: Describe build_steps modules) - #124406 (Remove unused `[patch]` for clippy_lints) - #124429 (bootstrap: Document `struct Builder` and its fields) - #124447 (Unconditionally call `really_init` on GNU/Linux) r? `@ghost` `@rustbot` modify labels: rollup
2 parents aed2187 + 0b5e173 commit cdd02e9

25 files changed

+489
-32
lines changed
 

‎Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,3 @@ strip = true
112112
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
113113
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
114114
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
115-
116-
[patch."https://github.com/rust-lang/rust-clippy"]
117-
clippy_lints = { path = "src/tools/clippy/clippy_lints" }

‎library/core/src/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2767,7 +2767,7 @@ pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) {
27672767
#[unstable(feature = "core_intrinsics", issue = "none")]
27682768
#[inline(always)]
27692769
#[cfg_attr(not(bootstrap), rustc_intrinsic)] // just make it a regular fn in bootstrap
2770-
pub(crate) const fn ub_checks() -> bool {
2770+
pub const fn ub_checks() -> bool {
27712771
cfg!(debug_assertions)
27722772
}
27732773

‎library/core/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
#![feature(str_split_inclusive_remainder)]
194194
#![feature(str_split_remainder)]
195195
#![feature(strict_provenance)]
196+
#![feature(ub_checks)]
196197
#![feature(unchecked_shifts)]
197198
#![feature(utf16_extra)]
198199
#![feature(utf16_extra_const)]
@@ -370,7 +371,8 @@ pub mod hint;
370371
pub mod intrinsics;
371372
pub mod mem;
372373
pub mod ptr;
373-
mod ub_checks;
374+
#[unstable(feature = "ub_checks", issue = "none")]
375+
pub mod ub_checks;
374376

375377
/* Core language traits */
376378

‎library/core/src/ub_checks.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ use crate::intrinsics::{self, const_eval_select};
4646
/// variables cannot be optimized out in MIR, an innocent-looking `let` can produce enough
4747
/// debuginfo to have a measurable compile-time impact on debug builds.
4848
#[allow_internal_unstable(const_ub_checks)] // permit this to be called in stably-const fn
49+
#[macro_export]
50+
#[unstable(feature = "ub_checks", issue = "none")]
4951
macro_rules! assert_unsafe_precondition {
5052
($kind:ident, $message:expr, ($($name:ident:$ty:ty = $arg:expr),*$(,)?) => $e:expr $(,)?) => {
5153
{
@@ -75,11 +77,13 @@ macro_rules! assert_unsafe_precondition {
7577
}
7678
};
7779
}
78-
pub(crate) use assert_unsafe_precondition;
80+
#[unstable(feature = "ub_checks", issue = "none")]
81+
pub use assert_unsafe_precondition;
7982

8083
/// Checking library UB is always enabled when UB-checking is done
8184
/// (and we use a reexport so that there is no unnecessary wrapper function).
82-
pub(crate) use intrinsics::ub_checks as check_library_ub;
85+
#[unstable(feature = "ub_checks", issue = "none")]
86+
pub use intrinsics::ub_checks as check_library_ub;
8387

8488
/// Determines whether we should check for language UB.
8589
///

‎library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@
356356
#![feature(str_internals)]
357357
#![feature(strict_provenance)]
358358
#![feature(strict_provenance_atomic_ptr)]
359+
#![feature(ub_checks)]
359360
// tidy-alphabetical-end
360361
//
361362
// Library features (alloc):

‎library/std/src/os/fd/owned.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ impl Drop for OwnedFd {
176176
// something like EINTR), we might close another valid file descriptor
177177
// opened after we closed ours.
178178
#[cfg(not(target_os = "hermit"))]
179-
let _ = libc::close(self.fd);
179+
{
180+
crate::sys::fs::debug_assert_fd_is_open(self.fd);
181+
let _ = libc::close(self.fd);
182+
}
180183
#[cfg(target_os = "hermit")]
181184
let _ = hermit_abi::close(self.fd);
182185
}

‎library/std/src/sys/pal/unix/args.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,10 @@ mod imp {
9898
}
9999

100100
#[inline(always)]
101-
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
102-
// On Linux-GNU, we rely on `ARGV_INIT_ARRAY` below to initialize
103-
// `ARGC` and `ARGV`. But in Miri that does not actually happen so we
104-
// still initialize here.
105-
#[cfg(any(miri, not(all(target_os = "linux", target_env = "gnu"))))]
106-
really_init(_argc, _argv);
101+
pub unsafe fn init(argc: isize, argv: *const *const u8) {
102+
// on GNU/Linux if we are main then we will init argv and argc twice, it "duplicates work"
103+
// BUT edge-cases are real: only using .init_array can break most emulators, dlopen, etc.
104+
really_init(argc, argv);
107105
}
108106

109107
/// glibc passes argc, argv, and envp to functions in .init_array, as a non-standard extension.

‎library/std/src/sys/pal/unix/fs.rs

+32
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,40 @@ impl Iterator for ReadDir {
864864
}
865865
}
866866

867+
/// Aborts the process if a file desceriptor is not open, if debug asserts are enabled
868+
///
869+
/// Many IO syscalls can't be fully trusted about EBADF error codes because those
870+
/// might get bubbled up from a remote FUSE server rather than the file descriptor
871+
/// in the current process being invalid.
872+
///
873+
/// So we check file flags instead which live on the file descriptor and not the underlying file.
874+
/// The downside is that it costs an extra syscall, so we only do it for debug.
875+
#[inline]
876+
pub(crate) fn debug_assert_fd_is_open(fd: RawFd) {
877+
use crate::sys::os::errno;
878+
879+
// this is similar to assert_unsafe_precondition!() but it doesn't require const
880+
if core::ub_checks::check_library_ub() {
881+
if unsafe { libc::fcntl(fd, libc::F_GETFD) } == -1 && errno() == libc::EBADF {
882+
rtabort!("IO Safety violation: owned file descriptor already closed");
883+
}
884+
}
885+
}
886+
867887
impl Drop for Dir {
868888
fn drop(&mut self) {
889+
// dirfd isn't supported everywhere
890+
#[cfg(not(any(
891+
miri,
892+
target_os = "redox",
893+
target_os = "nto",
894+
target_os = "vita",
895+
target_os = "hurd",
896+
)))]
897+
{
898+
let fd = unsafe { libc::dirfd(self.0) };
899+
debug_assert_fd_is_open(fd);
900+
}
869901
let r = unsafe { libc::closedir(self.0) };
870902
assert!(
871903
r == 0 || crate::io::Error::last_os_error().is_interrupted(),

‎src/bootstrap/bootstrap.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1035,14 +1035,8 @@ def check_vendored_status(self):
10351035
if self.use_vendored_sources:
10361036
vendor_dir = os.path.join(self.rust_root, 'vendor')
10371037
if not os.path.exists(vendor_dir):
1038-
sync_dirs = "--sync ./src/tools/cargo/Cargo.toml " \
1039-
"--sync ./src/tools/rust-analyzer/Cargo.toml " \
1040-
"--sync ./compiler/rustc_codegen_cranelift/Cargo.toml " \
1041-
"--sync ./compiler/rustc_codegen_gcc/Cargo.toml " \
1042-
"--sync ./src/bootstrap/Cargo.toml "
10431038
eprint('ERROR: vendoring required, but vendor directory does not exist.')
1044-
eprint(' Run `cargo vendor {}` to initialize the '
1045-
'vendor directory.'.format(sync_dirs))
1039+
eprint(' Run `x.py vendor` to initialize the vendor directory.')
10461040
eprint(' Alternatively, use the pre-vendored `rustc-src` dist component.')
10471041
eprint(' To get a stable/beta/nightly version, download it from: ')
10481042
eprint(' '

‎src/bootstrap/src/core/build_steps/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Implementation of `make clean` in rustbuild.
1+
//! `./x.py clean`
22
//!
33
//! Responsible for cleaning out a build directory of all old and stale
44
//! artifacts to prepare for a fresh build. Currently doesn't remove the

‎src/bootstrap/src/core/build_steps/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ pub(crate) mod synthetic_targets;
1414
pub(crate) mod test;
1515
pub(crate) mod tool;
1616
pub(crate) mod toolstate;
17+
pub(crate) mod vendor;

‎src/bootstrap/src/core/build_steps/run.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Build-and-run steps for in-repo tools
2+
//!
3+
//! A bit of a hodge-podge as e.g. if a tool's a test fixture it should be in `build_steps::test`.
4+
//! If it can be reached from `./x.py run` it can go here.
5+
16
use std::path::PathBuf;
27
use std::process::Command;
38

‎src/bootstrap/src/core/build_steps/setup.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! First time setup of a dev environment
2+
//!
3+
//! These are build-and-run steps for `./x.py setup`, which allows quickly setting up the directory
4+
//! for modifying, building, and running the compiler and library. Running arbitrary configuration
5+
//! allows setting up things that cannot be simply captured inside the config.toml, in addition to
6+
//! leading people away from manually editing most of the config.toml values.
7+
18
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
29
use crate::t;
310
use crate::utils::change_tracker::CONFIG_CHANGE_HISTORY;
@@ -25,6 +32,8 @@ pub enum Profile {
2532
None,
2633
}
2734

35+
static PROFILE_DIR: &str = "src/bootstrap/defaults";
36+
2837
/// A list of historical hashes of `src/etc/rust_analyzer_settings.json`.
2938
/// New entries should be appended whenever this is updated so we can detect
3039
/// outdated vs. user-modified settings files.
@@ -41,7 +50,7 @@ static RUST_ANALYZER_SETTINGS: &str = include_str!("../../../../etc/rust_analyze
4150

4251
impl Profile {
4352
fn include_path(&self, src_path: &Path) -> PathBuf {
44-
PathBuf::from(format!("{}/src/bootstrap/defaults/config.{}.toml", src_path.display(), self))
53+
PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self))
4554
}
4655

4756
pub fn all() -> impl Iterator<Item = Self> {
@@ -220,7 +229,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {
220229

221230
let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id;
222231
let settings = format!(
223-
"# Includes one of the default files in src/bootstrap/defaults\n\
232+
"# Includes one of the default files in {PROFILE_DIR}\n\
224233
profile = \"{profile}\"\n\
225234
change-id = {latest_change_id}\n"
226235
);

‎src/bootstrap/src/core/build_steps/suggest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Attempt to magically identify good tests to run
2+
13
#![cfg_attr(feature = "build-metrics", allow(unused))]
24

35
use clap::Parser;

‎src/bootstrap/src/core/build_steps/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//! Implementation of the test-related targets of the build system.
1+
//! Build-and-run steps for `./x.py test` test fixtures
22
//!
3-
//! This file implements the various regression test suites that we execute on
4-
//! our CI.
3+
//! `./x.py test` (aka [`Kind::Test`]) is currently allowed to reach build steps in other modules.
4+
//! However, this contains ~all test parts we expect people to be able to build and run locally.
55
66
use std::env;
77
use std::ffi::OsStr;

‎src/bootstrap/src/core/build_steps/toolstate.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//! [Toolstate] checks to keep tools building
2+
//!
3+
//! Reachable via `./x.py test` but mostly relevant for CI, since it isn't run locally by default.
4+
//!
5+
//! [Toolstate]: https://forge.rust-lang.org/infra/toolstate.html
6+
17
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
28
use crate::utils::helpers::t;
39
use serde_derive::{Deserialize, Serialize};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
2+
use std::path::PathBuf;
3+
use std::process::Command;
4+
5+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
6+
pub(crate) struct Vendor {
7+
sync_args: Vec<PathBuf>,
8+
versioned_dirs: bool,
9+
root_dir: PathBuf,
10+
}
11+
12+
impl Step for Vendor {
13+
type Output = ();
14+
const DEFAULT: bool = true;
15+
const ONLY_HOSTS: bool = true;
16+
17+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
18+
run.alias("placeholder").default_condition(true)
19+
}
20+
21+
fn make_run(run: RunConfig<'_>) {
22+
run.builder.ensure(Vendor {
23+
sync_args: run.builder.config.cmd.vendor_sync_args(),
24+
versioned_dirs: run.builder.config.cmd.vendor_versioned_dirs(),
25+
root_dir: run.builder.src.clone(),
26+
});
27+
}
28+
29+
fn run(self, builder: &Builder<'_>) -> Self::Output {
30+
let mut cmd = Command::new(&builder.initial_cargo);
31+
cmd.arg("vendor");
32+
33+
if self.versioned_dirs {
34+
cmd.arg("--versioned-dirs");
35+
}
36+
37+
// Sync these paths by default.
38+
for p in [
39+
"src/tools/cargo/Cargo.toml",
40+
"src/tools/rust-analyzer/Cargo.toml",
41+
"compiler/rustc_codegen_cranelift/Cargo.toml",
42+
"compiler/rustc_codegen_gcc/Cargo.toml",
43+
"src/bootstrap/Cargo.toml",
44+
] {
45+
cmd.arg("--sync").arg(builder.src.join(p));
46+
}
47+
48+
// Also sync explicitly requested paths.
49+
for sync_arg in self.sync_args {
50+
cmd.arg("--sync").arg(sync_arg);
51+
}
52+
53+
// Will read the libstd Cargo.toml
54+
// which uses the unstable `public-dependency` feature.
55+
cmd.env("RUSTC_BOOTSTRAP", "1");
56+
57+
cmd.current_dir(self.root_dir);
58+
59+
builder.run(&mut cmd);
60+
}
61+
}

‎src/bootstrap/src/core/builder.rs

+28-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ use std::sync::OnceLock;
1414
use std::time::{Duration, Instant};
1515

1616
use crate::core::build_steps::tool::{self, SourceType};
17-
use crate::core::build_steps::{check, clean, compile, dist, doc, install, run, setup, test};
18-
use crate::core::build_steps::{clippy, llvm};
17+
use crate::core::build_steps::{
18+
check, clean, clippy, compile, dist, doc, install, llvm, run, setup, test, vendor,
19+
};
1920
use crate::core::config::flags::{Color, Subcommand};
2021
use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
2122
use crate::prepare_behaviour_dump_dir;
@@ -34,13 +35,34 @@ use once_cell::sync::Lazy;
3435
#[cfg(test)]
3536
mod tests;
3637

38+
/// Builds and performs different [`Self::kind`]s of stuff and actions, taking
39+
/// into account build configuration from e.g. config.toml.
3740
pub struct Builder<'a> {
41+
/// Build configuration from e.g. config.toml.
3842
pub build: &'a Build,
43+
44+
/// The stage to use. Either implicitly determined based on subcommand, or
45+
/// explicitly specified with `--stage N`. Normally this is the stage we
46+
/// use, but sometimes we want to run steps with a lower stage than this.
3947
pub top_stage: u32,
48+
49+
/// What to build or what action to perform.
4050
pub kind: Kind,
51+
52+
/// A cache of outputs of [`Step`]s so we can avoid running steps we already
53+
/// ran.
4154
cache: Cache,
55+
56+
/// A stack of [`Step`]s to run before we can run this builder. The output
57+
/// of steps is cached in [`Self::cache`].
4258
stack: RefCell<Vec<Box<dyn Any>>>,
59+
60+
/// The total amount of time we spent running [`Step`]s in [`Self::stack`].
4361
time_spent_on_dependencies: Cell<Duration>,
62+
63+
/// The paths passed on the command line. Used by steps to figure out what
64+
/// to do. For example: with `./x check foo bar` we get `paths=["foo",
65+
/// "bar"]`.
4466
pub paths: Vec<PathBuf>,
4567
}
4668

@@ -638,6 +660,7 @@ pub enum Kind {
638660
Run,
639661
Setup,
640662
Suggest,
663+
Vendor,
641664
}
642665

643666
impl Kind {
@@ -658,6 +681,7 @@ impl Kind {
658681
Kind::Run => "run",
659682
Kind::Setup => "setup",
660683
Kind::Suggest => "suggest",
684+
Kind::Vendor => "vendor",
661685
}
662686
}
663687

@@ -921,6 +945,7 @@ impl<'a> Builder<'a> {
921945
),
922946
Kind::Setup => describe!(setup::Profile, setup::Hook, setup::Link, setup::Vscode),
923947
Kind::Clean => describe!(clean::CleanAll, clean::Rustc, clean::Std),
948+
Kind::Vendor => describe!(vendor::Vendor),
924949
// special-cased in Build::build()
925950
Kind::Format | Kind::Suggest => vec![],
926951
}
@@ -993,6 +1018,7 @@ impl<'a> Builder<'a> {
9931018
Kind::Setup,
9941019
path.as_ref().map_or([].as_slice(), |path| std::slice::from_ref(path)),
9951020
),
1021+
Subcommand::Vendor { .. } => (Kind::Vendor, &paths[..]),
9961022
};
9971023

9981024
Self::new_internal(build, kind, paths.to_owned())

‎src/bootstrap/src/core/config/config.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ pub struct Config {
345345
#[cfg(test)]
346346
pub initial_rustfmt: RefCell<RustfmtState>,
347347

348+
/// The paths to work with. For example: with `./x check foo bar` we get
349+
/// `paths=["foo", "bar"]`.
348350
pub paths: Vec<PathBuf>,
349351
}
350352

@@ -2027,7 +2029,8 @@ impl Config {
20272029
| Subcommand::Run { .. }
20282030
| Subcommand::Setup { .. }
20292031
| Subcommand::Format { .. }
2030-
| Subcommand::Suggest { .. } => flags.stage.unwrap_or(0),
2032+
| Subcommand::Suggest { .. }
2033+
| Subcommand::Vendor { .. } => flags.stage.unwrap_or(0),
20312034
};
20322035

20332036
// CI should always run stage 2 builds, unless it specifically states otherwise
@@ -2054,7 +2057,8 @@ impl Config {
20542057
| Subcommand::Run { .. }
20552058
| Subcommand::Setup { .. }
20562059
| Subcommand::Format { .. }
2057-
| Subcommand::Suggest { .. } => {}
2060+
| Subcommand::Suggest { .. }
2061+
| Subcommand::Vendor { .. } => {}
20582062
}
20592063
}
20602064

‎src/bootstrap/src/core/config/flags.rs

+24
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,15 @@ Arguments:
456456
#[arg(long)]
457457
run: bool,
458458
},
459+
/// Vendor dependencies
460+
Vendor {
461+
/// Additional `Cargo.toml` to sync and vendor
462+
#[arg(long)]
463+
sync: Vec<PathBuf>,
464+
/// Always include version in subdir name
465+
#[arg(long)]
466+
versioned_dirs: bool,
467+
},
459468
}
460469

461470
impl Subcommand {
@@ -476,6 +485,7 @@ impl Subcommand {
476485
Subcommand::Run { .. } => Kind::Run,
477486
Subcommand::Setup { .. } => Kind::Setup,
478487
Subcommand::Suggest { .. } => Kind::Suggest,
488+
Subcommand::Vendor { .. } => Kind::Vendor,
479489
}
480490
}
481491

@@ -581,6 +591,20 @@ impl Subcommand {
581591
_ => false,
582592
}
583593
}
594+
595+
pub fn vendor_versioned_dirs(&self) -> bool {
596+
match *self {
597+
Subcommand::Vendor { versioned_dirs, .. } => versioned_dirs,
598+
_ => false,
599+
}
600+
}
601+
602+
pub fn vendor_sync_args(&self) -> Vec<PathBuf> {
603+
match self {
604+
Subcommand::Vendor { sync, .. } => sync.clone(),
605+
_ => vec![],
606+
}
607+
}
584608
}
585609

586610
/// Returns the shell completion for a given shell, if the result differs from the current

‎src/etc/completions/x.py.fish

+37
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ complete -c x.py -n "__fish_use_subcommand" -f -a "install" -d 'Install distribu
4747
complete -c x.py -n "__fish_use_subcommand" -f -a "run" -d 'Run tools contained in this repository'
4848
complete -c x.py -n "__fish_use_subcommand" -f -a "setup" -d 'Set up the environment for development'
4949
complete -c x.py -n "__fish_use_subcommand" -f -a "suggest" -d 'Suggest a subset of tests to run, based on modified files'
50+
complete -c x.py -n "__fish_use_subcommand" -f -a "vendor" -d 'Vendor dependencies'
5051
complete -c x.py -n "__fish_seen_subcommand_from build" -l config -d 'TOML configuration file for build' -r -F
5152
complete -c x.py -n "__fish_seen_subcommand_from build" -l build-dir -d 'Build directory, overrides `build.build-dir` in `config.toml`' -r -f -a "(__fish_complete_directories)"
5253
complete -c x.py -n "__fish_seen_subcommand_from build" -l build -d 'build target of the stage0 compiler' -r -f
@@ -590,3 +591,39 @@ complete -c x.py -n "__fish_seen_subcommand_from suggest" -l llvm-profile-genera
590591
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l enable-bolt-settings -d 'Enable BOLT link flags'
591592
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l skip-stage0-validation -d 'Skip stage0 compiler validation'
592593
complete -c x.py -n "__fish_seen_subcommand_from suggest" -s h -l help -d 'Print help (see more with \'--help\')'
594+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l sync -d 'Additional `Cargo.toml` to sync and vendor' -r -F
595+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l config -d 'TOML configuration file for build' -r -F
596+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l build-dir -d 'Build directory, overrides `build.build-dir` in `config.toml`' -r -f -a "(__fish_complete_directories)"
597+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l build -d 'build target of the stage0 compiler' -r -f
598+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l host -d 'host targets to build' -r -f
599+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l target -d 'target targets to build' -r -f
600+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l exclude -d 'build paths to exclude' -r -F
601+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l skip -d 'build paths to skip' -r -F
602+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l rustc-error-format -r -f
603+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l on-fail -d 'command to run on failure' -r -f -a "(__fish_complete_command)"
604+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l stage -d 'stage to build (indicates compiler to use/test, e.g., stage 0 uses the bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)' -r -f
605+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l keep-stage -d 'stage(s) to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)' -r -f
606+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l keep-stage-std -d 'stage(s) of the standard library to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)' -r -f
607+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l src -d 'path to the root of the rust checkout' -r -f -a "(__fish_complete_directories)"
608+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -s j -l jobs -d 'number of jobs to run in parallel' -r -f
609+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l warnings -d 'if value is deny, will deny warnings if value is warn, will emit warnings otherwise, use the default configured behaviour' -r -f -a "{deny '',warn '',default ''}"
610+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l error-format -d 'rustc error format' -r -f
611+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l color -d 'whether to use color in cargo and rustc output' -r -f -a "{always '',never '',auto ''}"
612+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l llvm-skip-rebuild -d 'whether rebuilding llvm should be skipped, overriding `skip-rebuld` in config.toml' -r -f -a "{true '',false ''}"
613+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l rust-profile-generate -d 'generate PGO profile with rustc build' -r -F
614+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
615+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
616+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l reproducible-artifact -d 'Additional reproducible artifacts that should be added to the reproducible artifacts archive' -r
617+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l set -d 'override options in config.toml' -r -f
618+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l versioned-dirs -d 'Always include version in subdir name'
619+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
620+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -s i -l incremental -d 'use incremental compilation'
621+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l include-default-paths -d 'include default paths in addition to the provided ones'
622+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l dry-run -d 'dry run; don\'t build anything'
623+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l dump-bootstrap-shims -d 'Indicates whether to dump the work done from bootstrap shims'
624+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l json-output -d 'use message-format=json'
625+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l bypass-bootstrap-lock -d 'Bootstrap uses this value to decide whether it should bypass locking the build process. This is rarely needed (e.g., compiling the std library for different targets in parallel)'
626+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l llvm-profile-generate -d 'generate PGO profile with llvm built for rustc'
627+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l enable-bolt-settings -d 'Enable BOLT link flags'
628+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l skip-stage0-validation -d 'Skip stage0 compiler validation'
629+
complete -c x.py -n "__fish_seen_subcommand_from vendor" -s h -l help -d 'Print help (see more with \'--help\')'

‎src/etc/completions/x.py.ps1

+44
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
7474
[CompletionResult]::new('run', 'run', [CompletionResultType]::ParameterValue, 'Run tools contained in this repository')
7575
[CompletionResult]::new('setup', 'setup', [CompletionResultType]::ParameterValue, 'Set up the environment for development')
7676
[CompletionResult]::new('suggest', 'suggest', [CompletionResultType]::ParameterValue, 'Suggest a subset of tests to run, based on modified files')
77+
[CompletionResult]::new('vendor', 'vendor', [CompletionResultType]::ParameterValue, 'Vendor dependencies')
7778
break
7879
}
7980
'x.py;build' {
@@ -724,6 +725,49 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
724725
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
725726
break
726727
}
728+
'x.py;vendor' {
729+
[CompletionResult]::new('--sync', 'sync', [CompletionResultType]::ParameterName, 'Additional `Cargo.toml` to sync and vendor')
730+
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'TOML configuration file for build')
731+
[CompletionResult]::new('--build-dir', 'build-dir', [CompletionResultType]::ParameterName, 'Build directory, overrides `build.build-dir` in `config.toml`')
732+
[CompletionResult]::new('--build', 'build', [CompletionResultType]::ParameterName, 'build target of the stage0 compiler')
733+
[CompletionResult]::new('--host', 'host', [CompletionResultType]::ParameterName, 'host targets to build')
734+
[CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'target targets to build')
735+
[CompletionResult]::new('--exclude', 'exclude', [CompletionResultType]::ParameterName, 'build paths to exclude')
736+
[CompletionResult]::new('--skip', 'skip', [CompletionResultType]::ParameterName, 'build paths to skip')
737+
[CompletionResult]::new('--rustc-error-format', 'rustc-error-format', [CompletionResultType]::ParameterName, 'rustc-error-format')
738+
[CompletionResult]::new('--on-fail', 'on-fail', [CompletionResultType]::ParameterName, 'command to run on failure')
739+
[CompletionResult]::new('--stage', 'stage', [CompletionResultType]::ParameterName, 'stage to build (indicates compiler to use/test, e.g., stage 0 uses the bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)')
740+
[CompletionResult]::new('--keep-stage', 'keep-stage', [CompletionResultType]::ParameterName, 'stage(s) to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)')
741+
[CompletionResult]::new('--keep-stage-std', 'keep-stage-std', [CompletionResultType]::ParameterName, 'stage(s) of the standard library to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)')
742+
[CompletionResult]::new('--src', 'src', [CompletionResultType]::ParameterName, 'path to the root of the rust checkout')
743+
[CompletionResult]::new('-j', 'j', [CompletionResultType]::ParameterName, 'number of jobs to run in parallel')
744+
[CompletionResult]::new('--jobs', 'jobs', [CompletionResultType]::ParameterName, 'number of jobs to run in parallel')
745+
[CompletionResult]::new('--warnings', 'warnings', [CompletionResultType]::ParameterName, 'if value is deny, will deny warnings if value is warn, will emit warnings otherwise, use the default configured behaviour')
746+
[CompletionResult]::new('--error-format', 'error-format', [CompletionResultType]::ParameterName, 'rustc error format')
747+
[CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'whether to use color in cargo and rustc output')
748+
[CompletionResult]::new('--llvm-skip-rebuild', 'llvm-skip-rebuild', [CompletionResultType]::ParameterName, 'whether rebuilding llvm should be skipped, overriding `skip-rebuld` in config.toml')
749+
[CompletionResult]::new('--rust-profile-generate', 'rust-profile-generate', [CompletionResultType]::ParameterName, 'generate PGO profile with rustc build')
750+
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
751+
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
752+
[CompletionResult]::new('--reproducible-artifact', 'reproducible-artifact', [CompletionResultType]::ParameterName, 'Additional reproducible artifacts that should be added to the reproducible artifacts archive')
753+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
754+
[CompletionResult]::new('--versioned-dirs', 'versioned-dirs', [CompletionResultType]::ParameterName, 'Always include version in subdir name')
755+
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
756+
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
757+
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
758+
[CompletionResult]::new('--incremental', 'incremental', [CompletionResultType]::ParameterName, 'use incremental compilation')
759+
[CompletionResult]::new('--include-default-paths', 'include-default-paths', [CompletionResultType]::ParameterName, 'include default paths in addition to the provided ones')
760+
[CompletionResult]::new('--dry-run', 'dry-run', [CompletionResultType]::ParameterName, 'dry run; don''t build anything')
761+
[CompletionResult]::new('--dump-bootstrap-shims', 'dump-bootstrap-shims', [CompletionResultType]::ParameterName, 'Indicates whether to dump the work done from bootstrap shims')
762+
[CompletionResult]::new('--json-output', 'json-output', [CompletionResultType]::ParameterName, 'use message-format=json')
763+
[CompletionResult]::new('--bypass-bootstrap-lock', 'bypass-bootstrap-lock', [CompletionResultType]::ParameterName, 'Bootstrap uses this value to decide whether it should bypass locking the build process. This is rarely needed (e.g., compiling the std library for different targets in parallel)')
764+
[CompletionResult]::new('--llvm-profile-generate', 'llvm-profile-generate', [CompletionResultType]::ParameterName, 'generate PGO profile with llvm built for rustc')
765+
[CompletionResult]::new('--enable-bolt-settings', 'enable-bolt-settings', [CompletionResultType]::ParameterName, 'Enable BOLT link flags')
766+
[CompletionResult]::new('--skip-stage0-validation', 'skip-stage0-validation', [CompletionResultType]::ParameterName, 'Skip stage0 compiler validation')
767+
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
768+
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
769+
break
770+
}
727771
})
728772

729773
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |

‎src/etc/completions/x.py.sh

+118-1
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ _x.py() {
5757
bootstrap,test)
5858
cmd="bootstrap__test"
5959
;;
60+
bootstrap,vendor)
61+
cmd="bootstrap__vendor"
62+
;;
6063
*)
6164
;;
6265
esac
6366
done
6467

6568
case "${cmd}" in
6669
x.py)
67-
opts="-v -i -j -h --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]... build check clippy fix fmt doc test miri bench clean dist install run setup suggest"
70+
opts="-v -i -j -h --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]... build check clippy fix fmt doc test miri bench clean dist install run setup suggest vendor"
6871
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
6972
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
7073
return 0
@@ -1879,6 +1882,120 @@ _x.py() {
18791882
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
18801883
return 0
18811884
;;
1885+
x.py__vendor)
1886+
opts="-v -i -j -h --sync --versioned-dirs --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]..."
1887+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
1888+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
1889+
return 0
1890+
fi
1891+
case "${prev}" in
1892+
--sync)
1893+
COMPREPLY=($(compgen -f "${cur}"))
1894+
return 0
1895+
;;
1896+
--config)
1897+
COMPREPLY=($(compgen -f "${cur}"))
1898+
return 0
1899+
;;
1900+
--build-dir)
1901+
COMPREPLY=($(compgen -f "${cur}"))
1902+
return 0
1903+
;;
1904+
--build)
1905+
COMPREPLY=("${cur}")
1906+
return 0
1907+
;;
1908+
--host)
1909+
COMPREPLY=("${cur}")
1910+
return 0
1911+
;;
1912+
--target)
1913+
COMPREPLY=("${cur}")
1914+
return 0
1915+
;;
1916+
--exclude)
1917+
COMPREPLY=($(compgen -f "${cur}"))
1918+
return 0
1919+
;;
1920+
--skip)
1921+
COMPREPLY=($(compgen -f "${cur}"))
1922+
return 0
1923+
;;
1924+
--rustc-error-format)
1925+
COMPREPLY=("${cur}")
1926+
return 0
1927+
;;
1928+
--on-fail)
1929+
COMPREPLY=($(compgen -f "${cur}"))
1930+
return 0
1931+
;;
1932+
--stage)
1933+
COMPREPLY=("${cur}")
1934+
return 0
1935+
;;
1936+
--keep-stage)
1937+
COMPREPLY=("${cur}")
1938+
return 0
1939+
;;
1940+
--keep-stage-std)
1941+
COMPREPLY=("${cur}")
1942+
return 0
1943+
;;
1944+
--src)
1945+
COMPREPLY=($(compgen -f "${cur}"))
1946+
return 0
1947+
;;
1948+
--jobs)
1949+
COMPREPLY=("${cur}")
1950+
return 0
1951+
;;
1952+
-j)
1953+
COMPREPLY=("${cur}")
1954+
return 0
1955+
;;
1956+
--warnings)
1957+
COMPREPLY=($(compgen -W "deny warn default" -- "${cur}"))
1958+
return 0
1959+
;;
1960+
--error-format)
1961+
COMPREPLY=("${cur}")
1962+
return 0
1963+
;;
1964+
--color)
1965+
COMPREPLY=($(compgen -W "always never auto" -- "${cur}"))
1966+
return 0
1967+
;;
1968+
--llvm-skip-rebuild)
1969+
COMPREPLY=($(compgen -W "true false" -- "${cur}"))
1970+
return 0
1971+
;;
1972+
--rust-profile-generate)
1973+
COMPREPLY=($(compgen -f "${cur}"))
1974+
return 0
1975+
;;
1976+
--rust-profile-use)
1977+
COMPREPLY=($(compgen -f "${cur}"))
1978+
return 0
1979+
;;
1980+
--llvm-profile-use)
1981+
COMPREPLY=($(compgen -f "${cur}"))
1982+
return 0
1983+
;;
1984+
--reproducible-artifact)
1985+
COMPREPLY=($(compgen -f "${cur}"))
1986+
return 0
1987+
;;
1988+
--set)
1989+
COMPREPLY=("${cur}")
1990+
return 0
1991+
;;
1992+
*)
1993+
COMPREPLY=()
1994+
;;
1995+
esac
1996+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
1997+
return 0
1998+
;;
18821999
esac
18832000
}
18842001

‎src/etc/completions/x.py.zsh

+51
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,51 @@ _arguments "${_arguments_options[@]}" \
742742
'--help[Print help (see more with '\''--help'\'')]' \
743743
'*::paths -- paths for the subcommand:_files' \
744744
&& ret=0
745+
;;
746+
(vendor)
747+
_arguments "${_arguments_options[@]}" \
748+
'*--sync=[Additional \`Cargo.toml\` to sync and vendor]:SYNC:_files' \
749+
'--config=[TOML configuration file for build]:FILE:_files' \
750+
'--build-dir=[Build directory, overrides \`build.build-dir\` in \`config.toml\`]:DIR:_files -/' \
751+
'--build=[build target of the stage0 compiler]:BUILD:( )' \
752+
'--host=[host targets to build]:HOST:( )' \
753+
'--target=[target targets to build]:TARGET:( )' \
754+
'*--exclude=[build paths to exclude]:PATH:_files' \
755+
'*--skip=[build paths to skip]:PATH:_files' \
756+
'--rustc-error-format=[]:RUSTC_ERROR_FORMAT:( )' \
757+
'--on-fail=[command to run on failure]:CMD:_cmdstring' \
758+
'--stage=[stage to build (indicates compiler to use/test, e.g., stage 0 uses the bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)]:N:( )' \
759+
'*--keep-stage=[stage(s) to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)]:N:( )' \
760+
'*--keep-stage-std=[stage(s) of the standard library to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)]:N:( )' \
761+
'--src=[path to the root of the rust checkout]:DIR:_files -/' \
762+
'-j+[number of jobs to run in parallel]:JOBS:( )' \
763+
'--jobs=[number of jobs to run in parallel]:JOBS:( )' \
764+
'--warnings=[if value is deny, will deny warnings if value is warn, will emit warnings otherwise, use the default configured behaviour]:deny|warn:(deny warn default)' \
765+
'--error-format=[rustc error format]:FORMAT:( )' \
766+
'--color=[whether to use color in cargo and rustc output]:STYLE:(always never auto)' \
767+
'--llvm-skip-rebuild=[whether rebuilding llvm should be skipped, overriding \`skip-rebuld\` in config.toml]:VALUE:(true false)' \
768+
'--rust-profile-generate=[generate PGO profile with rustc build]:PROFILE:_files' \
769+
'--rust-profile-use=[use PGO profile for rustc build]:PROFILE:_files' \
770+
'--llvm-profile-use=[use PGO profile for LLVM build]:PROFILE:_files' \
771+
'*--reproducible-artifact=[Additional reproducible artifacts that should be added to the reproducible artifacts archive]:REPRODUCIBLE_ARTIFACT: ' \
772+
'*--set=[override options in config.toml]:section.option=value:( )' \
773+
'--versioned-dirs[Always include version in subdir name]' \
774+
'*-v[use verbose output (-vv for very verbose)]' \
775+
'*--verbose[use verbose output (-vv for very verbose)]' \
776+
'-i[use incremental compilation]' \
777+
'--incremental[use incremental compilation]' \
778+
'--include-default-paths[include default paths in addition to the provided ones]' \
779+
'--dry-run[dry run; don'\''t build anything]' \
780+
'--dump-bootstrap-shims[Indicates whether to dump the work done from bootstrap shims]' \
781+
'--json-output[use message-format=json]' \
782+
'--bypass-bootstrap-lock[Bootstrap uses this value to decide whether it should bypass locking the build process. This is rarely needed (e.g., compiling the std library for different targets in parallel)]' \
783+
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
784+
'--enable-bolt-settings[Enable BOLT link flags]' \
785+
'--skip-stage0-validation[Skip stage0 compiler validation]' \
786+
'-h[Print help (see more with '\''--help'\'')]' \
787+
'--help[Print help (see more with '\''--help'\'')]' \
788+
'*::paths -- paths for the subcommand:_files' \
789+
&& ret=0
745790
;;
746791
esac
747792
;;
@@ -766,6 +811,7 @@ _x.py_commands() {
766811
'run:Run tools contained in this repository' \
767812
'setup:Set up the environment for development' \
768813
'suggest:Suggest a subset of tests to run, based on modified files' \
814+
'vendor:Vendor dependencies' \
769815
)
770816
_describe -t commands 'x.py commands' commands "$@"
771817
}
@@ -844,6 +890,11 @@ _x.py__test_commands() {
844890
local commands; commands=()
845891
_describe -t commands 'x.py test commands' commands "$@"
846892
}
893+
(( $+functions[_x.py__vendor_commands] )) ||
894+
_x.py__vendor_commands() {
895+
local commands; commands=()
896+
_describe -t commands 'x.py vendor commands' commands "$@"
897+
}
847898

848899
if [ "$funcstack[1]" = "_x.py" ]; then
849900
_x.py "$@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//@ compile-flags: -Zincremental-verify-ich=yes
2+
// issue: rust-lang/rust#83085 incremental ICE: forcing query with already existing `DepNode`
3+
// this used to fail to build straight away without needing any kind of
4+
// stage1/2 builds but tidy demands it
5+
//@ revisions:rpass1 rpass2
6+
7+
fn main() {
8+
const BOO: &[u8; 0] = &[];
9+
match &[] {
10+
BOO => (),
11+
b"" => (),
12+
_ => (),
13+
}
14+
}
15+
16+
#[derive(PartialEq, Eq)]
17+
struct Id<'a> {
18+
ns: &'a str,
19+
}
20+
fn visit_struct() {
21+
let id = Id { ns: "random1" };
22+
const FLAG: Id<'static> = Id {
23+
ns: "needs_to_be_the_same",
24+
};
25+
match id {
26+
FLAG => {}
27+
_ => {}
28+
}
29+
}
30+
fn visit_struct2() {
31+
let id = Id { ns: "random2" };
32+
const FLAG: Id<'static> = Id {
33+
ns: "needs_to_be_the_same",
34+
};
35+
match id {
36+
FLAG => {}
37+
_ => {}
38+
}
39+
}

0 commit comments

Comments
 (0)
Please sign in to comment.