Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a197ebd
{CStr,OsStr,Path}::as_$1
GrigorenkoPV Aug 27, 2025
4e5ce74
`[T]::as_[mut_]slice`
GrigorenkoPV Aug 27, 2025
48f7f31
`ByteStr::as_[mut_]byte_str`
GrigorenkoPV Aug 27, 2025
5197856
Set -Cpanic=abort in windows-msvc stack protector tests
saethlin Nov 11, 2025
a5f677b
Try to fix i686
saethlin Nov 13, 2025
4c29d61
Remove -Zoom=panic
bjorn3 Oct 15, 2025
6693a56
Merge commit 'e24f0fa3c54951d1a5843b54ebe052faaa3a3cd2' into sync_cg_…
bjorn3 Dec 8, 2025
069016e
Merge branch 'sync_from_rust'
bjorn3 Dec 8, 2025
66381e3
Revert build_llvm_sysroot_for_triple back from reading the manifest t…
bjorn3 Dec 8, 2025
d38a5a6
Make `--print=backend-has-zstd` work by default on any backend
Zalathar Dec 8, 2025
77f1582
Rollup merge of #147725 - bjorn3:remove_oom_panic, r=Amanieu
matthiaskrgr Dec 10, 2025
51e8b6e
Rollup merge of #149764 - Zalathar:has-zstd, r=bjorn3
matthiaskrgr Dec 10, 2025
932c939
Remove uses of `cfg(any()/all())`
jamie-osec Dec 10, 2025
d55b61a
Adapt `cg_cranelift` to the overhauled filename handling
Urgau Dec 6, 2025
2298c01
Rollup merge of #149791 - clubby789:cfg-bool-lints, r=jdonszelmann
matthiaskrgr Dec 12, 2025
4d011ef
Remove `[no-mentions]` handler in the triagebot config
Urgau Dec 12, 2025
e3f9bce
Use `let...else` instead of `match foo { ... _ => return };` and `if …
estebank Dec 9, 2025
812320a
Merge pull request #1612 from Urgau/Urgau-patch-1
bjorn3 Dec 12, 2025
9561346
Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
bors Dec 13, 2025
6a821c5
simplify how inline asm handles `MaybeUninit`
WaffleLapkin Dec 13, 2025
4748c53
Add `llvm.x86.vcvtps2ph.128` (#1613)
opstic Dec 14, 2025
d57ccad
Rollup merge of #149950 - WaffleLapkin:inlines-ur-mu-into-asm, r=jdon…
Zalathar Dec 16, 2025
8d37589
std_detect: AArch64 Darwin: expose SME F16F16 and B16B16 features
pthariensflame Dec 16, 2025
216d1a7
Sync from rust 21ff67df15329dd7548ccba54b6c6ae9a562124f
bjorn3 Dec 16, 2025
b9839eb
Rustup to rustc 1.94.0-nightly (21ff67df1 2025-12-15)
bjorn3 Dec 16, 2025
b73270f
Fix rustc test suite
bjorn3 Dec 16, 2025
49f1fa5
Unconditionally install rustfmt
bjorn3 Dec 16, 2025
bb9dac5
Disable linker plugin lto rustc test
bjorn3 Dec 16, 2025
3822cf1
Disable a bunch of rustc tests that fail with --panic-unwind-support
bjorn3 Dec 16, 2025
60b616d
tests/run-make-cargo/same-crate-name-and-macro-name: New regression test
Enselic Dec 17, 2025
bd137df
test for duplicate default eii ICE 149985
jdonszelmann Dec 17, 2025
1cd7cb1
turn panic into span_delayed_bug
jdonszelmann Dec 17, 2025
08b7d34
another related case that deserved a test
jdonszelmann Dec 17, 2025
82ee8b2
`cfg_select!`: emit parse errors in unused branches
folkertdev Dec 12, 2025
c820f46
Generate macro expansion for rust compiler crates docs
GuillaumeGomez Dec 15, 2025
ae5e0d5
Support recursive delegation
aerooneqq Dec 18, 2025
9571693
unstable.rs: fix typos in comments (implementatble -> implementable)
DanielEScherzer Dec 18, 2025
4dc8f3e
Sync from rust f794a08738958bbef01c3dcab34ec21d3da1e51a
bjorn3 Dec 18, 2025
6396521
Rustup to rustc 1.94.0-nightly (f794a0873 2025-12-17)
bjorn3 Dec 18, 2025
8de4afd
Fix rustc testsuite
bjorn3 Dec 18, 2025
fe34b17
Port `#[rustc_lint_opt_deny_field_access]` to attribute parser
Bryntet Dec 18, 2025
cd4d899
make all parsed rustc attributes error on duplicate
Bryntet Dec 18, 2025
c594c39
Merge commit '8de4afd39ba48f25be98684cdb7a96ec6da89d10' into sync_cg_…
bjorn3 Dec 18, 2025
d1bfaf8
Rollup merge of #145933 - GrigorenkoPV:thing_as_thing, r=Amanieu
JonathanBrouwer Dec 18, 2025
d3b63ff
Rollup merge of #148849 - saethlin:windows-stack-protectors, r=wesley…
JonathanBrouwer Dec 18, 2025
b8f00b7
Rollup merge of #149925 - folkertdev:cfg-select-parse-unused-branches…
JonathanBrouwer Dec 18, 2025
6b8ee4a
Rollup merge of #150022 - GuillaumeGomez:rustc-macro-expansion, r=kobzol
JonathanBrouwer Dec 18, 2025
e856c92
Rollup merge of #150024 - aerooneqq:recursive-delegation-2, r=petroch…
JonathanBrouwer Dec 18, 2025
1fd57a1
Rollup merge of #150048 - pthariensflame:patch-1, r=Amanieu
JonathanBrouwer Dec 18, 2025
2552b3d
Rollup merge of #150083 - Enselic:same-crate-same-macro, r=Kivooeo
JonathanBrouwer Dec 18, 2025
76c4181
Rollup merge of #150102 - jdonszelmann:fix-149982, r=Kivooeo
JonathanBrouwer Dec 18, 2025
d8b64f4
Rollup merge of #150124 - DanielEScherzer:patch-1, r=petrochenkov
JonathanBrouwer Dec 18, 2025
31e279f
Rollup merge of #150125 - Bryntet:parse_rustc_lint_opt_deny_field_acc…
JonathanBrouwer Dec 18, 2025
ee56ef6
Rollup merge of #150126 - bjorn3:sync_cg_clif-2025-12-18, r=bjorn3
JonathanBrouwer Dec 18, 2025
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: 2 additions & 0 deletions compiler/rustc_ast_lowering/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ ast_lowering_coroutine_too_many_parameters =
ast_lowering_default_field_in_tuple = default fields are not supported in tuple structs
.label = default fields are only supported on structs
ast_lowering_delegation_cycle_in_signature_resolution = encountered a cycle during delegation signature resolution
ast_lowering_delegation_unresolved_callee = failed to resolve delegation callee
ast_lowering_does_not_support_modifiers =
the `{$class_name}` register class does not support template modifiers
Expand Down
68 changes: 48 additions & 20 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use hir::{BodyId, HirId};
use rustc_abi::ExternAbi;
use rustc_ast::*;
use rustc_attr_parsing::{AttributeParser, ShouldEmit};
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::Target;
use rustc_hir::attrs::{AttributeKind, InlineAttr};
Expand All @@ -55,6 +56,7 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol};
use {rustc_ast as ast, rustc_hir as hir};

use super::{GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode};
use crate::errors::{CycleInDelegationSignatureResolution, UnresolvedDelegationCallee};
use crate::{AllowReturnTypeNotation, ImplTraitPosition, ResolverAstLoweringExt};

pub(crate) struct DelegationResults<'hir> {
Expand Down Expand Up @@ -119,10 +121,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
&mut self,
delegation: &Delegation,
item_id: NodeId,
is_in_trait_impl: bool,
) -> DelegationResults<'hir> {
let span = self.lower_span(delegation.path.segments.last().unwrap().ident.span);
let sig_id = self.get_delegation_sig_id(item_id, delegation.id, span, is_in_trait_impl);

let sig_id = self.get_delegation_sig_id(
self.resolver.delegation_sig_resolution_nodes[&self.local_def_id(item_id)],
span,
);

match sig_id {
Ok(sig_id) => {
self.add_attributes_if_needed(span, sig_id);
Expand Down Expand Up @@ -238,24 +244,48 @@ impl<'hir> LoweringContext<'_, 'hir> {

fn get_delegation_sig_id(
&self,
item_id: NodeId,
path_id: NodeId,
mut node_id: NodeId,
span: Span,
is_in_trait_impl: bool,
) -> Result<DefId, ErrorGuaranteed> {
let sig_id = if is_in_trait_impl { item_id } else { path_id };
self.get_resolution_id(sig_id, span)
let mut visited: FxHashSet<NodeId> = Default::default();

loop {
visited.insert(node_id);

let Some(def_id) = self.get_resolution_id(node_id) else {
return Err(self.tcx.dcx().span_delayed_bug(
span,
format!(
"LoweringContext: couldn't resolve node {:?} in delegation item",
node_id
),
));
};

// If def_id is in local crate and it corresponds to another delegation
// it means that we refer to another delegation as a callee, so in order to obtain
// a signature DefId we obtain NodeId of the callee delegation and try to get signature from it.
if let Some(local_id) = def_id.as_local()
&& let Some(next_node_id) =
self.resolver.delegation_sig_resolution_nodes.get(&local_id)
{
node_id = *next_node_id;
if visited.contains(&node_id) {
// We encountered a cycle in the resolution, or delegation callee refers to non-existent
// entity, in this case emit an error.
return Err(match visited.len() {
1 => self.dcx().emit_err(UnresolvedDelegationCallee { span }),
_ => self.dcx().emit_err(CycleInDelegationSignatureResolution { span }),
});
}
} else {
return Ok(def_id);
}
}
}

fn get_resolution_id(&self, node_id: NodeId, span: Span) -> Result<DefId, ErrorGuaranteed> {
let def_id =
self.resolver.get_partial_res(node_id).and_then(|r| r.expect_full_res().opt_def_id());
def_id.ok_or_else(|| {
self.tcx.dcx().span_delayed_bug(
span,
format!("LoweringContext: couldn't resolve node {:?} in delegation item", node_id),
)
})
fn get_resolution_id(&self, node_id: NodeId) -> Option<DefId> {
self.resolver.get_partial_res(node_id).and_then(|r| r.expect_full_res().opt_def_id())
}

fn lower_delegation_generics(&mut self, span: Span) -> &'hir hir::Generics<'hir> {
Expand All @@ -271,8 +301,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
// Function parameter count, including C variadic `...` if present.
fn param_count(&self, sig_id: DefId) -> (usize, bool /*c_variadic*/) {
if let Some(local_sig_id) = sig_id.as_local() {
// Map may be filled incorrectly due to recursive delegation.
// Error will be emitted later during HIR ty lowering.
match self.resolver.delegation_fn_sigs.get(&local_sig_id) {
Some(sig) => (sig.param_count, sig.c_variadic),
None => (0, false),
Expand Down Expand Up @@ -489,8 +517,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
delegation.path.segments.iter().rev().skip(1).any(|segment| segment.args.is_some());

let call = if self
.get_resolution_id(delegation.id, span)
.and_then(|def_id| Ok(self.is_method(def_id, span)))
.get_resolution_id(delegation.id)
.map(|def_id| self.is_method(def_id, span))
.unwrap_or_default()
&& delegation.qself.is_none()
&& !has_generic_args
Expand Down
14 changes: 14 additions & 0 deletions compiler/rustc_ast_lowering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,3 +475,17 @@ pub(crate) struct UnionWithDefault {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(ast_lowering_delegation_unresolved_callee)]
pub(crate) struct UnresolvedDelegationCallee {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(ast_lowering_delegation_cycle_in_signature_resolution)]
pub(crate) struct CycleInDelegationSignatureResolution {
#[primary_span]
pub span: Span,
}
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::ItemKind::Macro(ident, macro_def, macro_kinds)
}
ItemKind::Delegation(box delegation) => {
let delegation_results = self.lower_delegation(delegation, id, false);
let delegation_results = self.lower_delegation(delegation, id);
hir::ItemKind::Fn {
sig: delegation_results.sig,
ident: delegation_results.ident,
Expand Down Expand Up @@ -1026,7 +1026,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
(*ident, generics, kind, ty.is_some())
}
AssocItemKind::Delegation(box delegation) => {
let delegation_results = self.lower_delegation(delegation, i.id, false);
let delegation_results = self.lower_delegation(delegation, i.id);
let item_kind = hir::TraitItemKind::Fn(
delegation_results.sig,
hir::TraitFn::Provided(delegation_results.body_id),
Expand Down Expand Up @@ -1196,7 +1196,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
)
}
AssocItemKind::Delegation(box delegation) => {
let delegation_results = self.lower_delegation(delegation, i.id, is_in_trait_impl);
let delegation_results = self.lower_delegation(delegation, i.id);
(
delegation.ident,
(
Expand Down
27 changes: 27 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/cfg_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ pub struct CfgSelectBranches {
pub unreachable: Vec<(CfgSelectPredicate, TokenStream, Span)>,
}

impl CfgSelectBranches {
/// Removes the top-most branch for which `predicate` returns `true`,
/// or the wildcard if none of the reachable branches satisfied the predicate.
pub fn pop_first_match<F>(&mut self, predicate: F) -> Option<(TokenStream, Span)>
where
F: Fn(&CfgEntry) -> bool,
{
for (index, (cfg, _, _)) in self.reachable.iter().enumerate() {
if predicate(cfg) {
let matched = self.reachable.remove(index);
return Some((matched.1, matched.2));
}
}

self.wildcard.take().map(|(_, tts, span)| (tts, span))
}

/// Consume this value and iterate over all the `TokenStream`s that it stores.
pub fn into_iter_tts(self) -> impl Iterator<Item = (TokenStream, Span)> {
let it1 = self.reachable.into_iter().map(|(_, tts, span)| (tts, span));
let it2 = self.wildcard.into_iter().map(|(_, tts, span)| (tts, span));
let it3 = self.unreachable.into_iter().map(|(_, tts, span)| (tts, span));

it1.chain(it2).chain(it3)
}
}

pub fn parse_cfg_select(
p: &mut Parser<'_>,
sess: &Session,
Expand Down
28 changes: 26 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,35 @@ impl<S: Stage> SingleAttributeParser<S> for RustcLegacyConstGenericsParser {
}
}

pub(crate) struct RustcLintOptDenyFieldAccessParser;

impl<S: Stage> SingleAttributeParser<S> for RustcLintOptDenyFieldAccessParser {
const PATH: &[Symbol] = &[sym::rustc_lint_opt_deny_field_access];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Field)]);
const TEMPLATE: AttributeTemplate = template!(Word);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(arg) = args.list().and_then(MetaItemListParser::single) else {
cx.expected_single_argument(cx.attr_span);
return None;
};

let MetaItemOrLitParser::Lit(MetaItemLit { kind: LitKind::Str(lint_message, _), .. }) = arg
else {
cx.expected_string_literal(arg.span(), arg.lit());
return None;
};

Some(AttributeKind::RustcLintOptDenyFieldAccess { lint_message: *lint_message })
}
}

pub(crate) struct RustcLintOptTyParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcLintOptTyParser {
const PATH: &[Symbol] = &[sym::rustc_lint_opt_ty];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct)]);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcLintOptTy;
}
Expand All @@ -130,7 +154,7 @@ pub(crate) struct RustcLintQueryInstabilityParser;

impl<S: Stage> NoArgsAttributeParser<S> for RustcLintQueryInstabilityParser {
const PATH: &[Symbol] = &[sym::rustc_lint_query_instability];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ use crate::attributes::prototype::CustomMirParser;
use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser};
use crate::attributes::rustc_internal::{
RustcLayoutScalarValidRangeEndParser, RustcLayoutScalarValidRangeStartParser,
RustcLegacyConstGenericsParser, RustcLintOptTyParser, RustcLintQueryInstabilityParser,
RustcMainParser, RustcNeverReturnsNullPointerParser, RustcNoImplicitAutorefsParser,
RustcObjectLifetimeDefaultParser, RustcScalableVectorParser,
RustcLegacyConstGenericsParser, RustcLintOptDenyFieldAccessParser, RustcLintOptTyParser,
RustcLintQueryInstabilityParser, RustcMainParser, RustcNeverReturnsNullPointerParser,
RustcNoImplicitAutorefsParser, RustcObjectLifetimeDefaultParser, RustcScalableVectorParser,
RustcSimdMonomorphizeLaneLimitParser,
};
use crate::attributes::semantics::MayDangleParser;
Expand Down Expand Up @@ -213,6 +213,7 @@ attribute_parsers!(
Single<RustcLayoutScalarValidRangeEndParser>,
Single<RustcLayoutScalarValidRangeStartParser>,
Single<RustcLegacyConstGenericsParser>,
Single<RustcLintOptDenyFieldAccessParser>,
Single<RustcObjectLifetimeDefaultParser>,
Single<RustcScalableVectorParser>,
Single<RustcSimdMonomorphizeLaneLimitParser>,
Expand Down
78 changes: 62 additions & 16 deletions compiler/rustc_builtin_macros/src/cfg_select.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,65 @@
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::{Expr, ast};
use rustc_attr_parsing as attr;
use rustc_attr_parsing::{
CfgSelectBranches, CfgSelectPredicate, EvalConfigResult, parse_cfg_select,
};
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult};
use rustc_span::{Ident, Span, sym};
use smallvec::SmallVec;

use crate::errors::{CfgSelectNoMatches, CfgSelectUnreachable};

/// Selects the first arm whose predicate evaluates to true.
fn select_arm(ecx: &ExtCtxt<'_>, branches: CfgSelectBranches) -> Option<(TokenStream, Span)> {
for (cfg, tt, arm_span) in branches.reachable {
if let EvalConfigResult::True = attr::eval_config_entry(&ecx.sess, &cfg) {
return Some((tt, arm_span));
}
/// This intermediate structure is used to emit parse errors for the branches that are not chosen.
/// The `MacResult` instance below parses all branches, emitting any errors it encounters, but only
/// keeps the parse result for the selected branch.
struct CfgSelectResult<'cx, 'sess> {
ecx: &'cx mut ExtCtxt<'sess>,
site_span: Span,
selected_tts: TokenStream,
selected_span: Span,
other_branches: CfgSelectBranches,
}

fn tts_to_mac_result<'cx, 'sess>(
ecx: &'cx mut ExtCtxt<'sess>,
site_span: Span,
tts: TokenStream,
span: Span,
) -> Box<dyn MacResult + 'cx> {
match ExpandResult::from_tts(ecx, tts, site_span, span, Ident::with_dummy_span(sym::cfg_select))
{
ExpandResult::Ready(x) => x,
_ => unreachable!("from_tts always returns Ready"),
}
}

macro_rules! forward_to_parser_any_macro {
($method_name:ident, $ret_ty:ty) => {
fn $method_name(self: Box<Self>) -> Option<$ret_ty> {
let CfgSelectResult { ecx, site_span, selected_tts, selected_span, .. } = *self;

for (tts, span) in self.other_branches.into_iter_tts() {
let _ = tts_to_mac_result(ecx, site_span, tts, span).$method_name();
}

tts_to_mac_result(ecx, site_span, selected_tts, selected_span).$method_name()
}
};
}

impl<'cx, 'sess> MacResult for CfgSelectResult<'cx, 'sess> {
forward_to_parser_any_macro!(make_expr, Box<Expr>);
forward_to_parser_any_macro!(make_stmts, SmallVec<[ast::Stmt; 1]>);
forward_to_parser_any_macro!(make_items, SmallVec<[Box<ast::Item>; 1]>);

forward_to_parser_any_macro!(make_impl_items, SmallVec<[Box<ast::AssocItem>; 1]>);
forward_to_parser_any_macro!(make_trait_impl_items, SmallVec<[Box<ast::AssocItem>; 1]>);
forward_to_parser_any_macro!(make_trait_items, SmallVec<[Box<ast::AssocItem>; 1]>);
forward_to_parser_any_macro!(make_foreign_items, SmallVec<[Box<ast::ForeignItem>; 1]>);

branches.wildcard.map(|(_, tt, span)| (tt, span))
forward_to_parser_any_macro!(make_ty, Box<ast::Ty>);
forward_to_parser_any_macro!(make_pat, Box<ast::Pat>);
}

pub(super) fn expand_cfg_select<'cx>(
Expand All @@ -31,7 +74,7 @@ pub(super) fn expand_cfg_select<'cx>(
Some(ecx.ecfg.features),
ecx.current_expansion.lint_node_id,
) {
Ok(branches) => {
Ok(mut branches) => {
if let Some((underscore, _, _)) = branches.wildcard {
// Warn for every unreachable predicate. We store the fully parsed branch for rustfmt.
for (predicate, _, _) in &branches.unreachable {
Expand All @@ -44,14 +87,17 @@ pub(super) fn expand_cfg_select<'cx>(
}
}

if let Some((tts, arm_span)) = select_arm(ecx, branches) {
return ExpandResult::from_tts(
if let Some((selected_tts, selected_span)) = branches.pop_first_match(|cfg| {
matches!(attr::eval_config_entry(&ecx.sess, cfg), EvalConfigResult::True)
}) {
let mac = CfgSelectResult {
ecx,
tts,
sp,
arm_span,
Ident::with_dummy_span(sym::cfg_select),
);
selected_tts,
selected_span,
other_branches: branches,
site_span: sp,
};
return ExpandResult::Ready(Box::new(mac));
} else {
// Emit a compiler error when none of the predicates matched.
let guar = ecx.dcx().emit_err(CfgSelectNoMatches { span: sp });
Expand Down
Loading
Loading