From 37cd39f3ce831afdfb4741474bdeefafda93bf6a Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 27 May 2025 18:28:46 +0300 Subject: handle cfg bootstrap on compiler and miri Signed-off-by: onur-ozkan --- compiler/rustc_span/src/analyze_source_file.rs | 13 ++++++++++++- compiler/rustc_span/src/lib.rs | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_span/src') diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs index c32593a6d95..55d899c9ada 100644 --- a/compiler/rustc_span/src/analyze_source_file.rs +++ b/compiler/rustc_span/src/analyze_source_file.rs @@ -29,7 +29,18 @@ pub(crate) fn analyze_source_file(src: &str) -> (Vec, Vec { + #[cfg(bootstrap)] + cfg_match! { $($tokens)* } + + #[cfg(not(bootstrap))] + cfg_select! { $($tokens)* } + }; +} + +cfg_select_dispatch! { any(target_arch = "x86", target_arch = "x86_64") => { fn analyze_source_file_dispatch( src: &str, diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 906462a0d22..e950493f135 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -17,10 +17,11 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(cfg_match))] +#![cfg_attr(not(bootstrap), feature(cfg_select))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] -#![feature(cfg_select)] #![feature(core_io_borrowed_buf)] #![feature(hash_set_entry)] #![feature(if_let_guard)] -- cgit 1.4.1-3-g733a5