Skip to content

Commit 59281e9

Browse files
committed
debug
1 parent 2aa932c commit 59281e9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

compiler/rustc_builtin_macros/src/contracts.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use rustc_ast::token;
22
use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
33
use rustc_errors::ErrorGuaranteed;
44
use rustc_expand::base::{AttrProcMacro, ExtCtxt};
5-
use rustc_span::Span;
5+
use rustc_span::hygiene::Transparency;
66
use rustc_span::symbol::{Ident, Symbol, kw};
7+
use rustc_span::{ExpnData, ExpnKind, LocalExpnId, MacroKind, Span, sym};
78

89
pub(crate) struct ExpandRequires;
910

@@ -57,6 +58,18 @@ fn expand_contract_clause(
5758
if let TokenTree::Token(token, _) = tt { token.is_ident_named(sym) } else { false }
5859
};
5960

61+
let expn_data = ExpnData {
62+
..ExpnData::default(
63+
ExpnKind::Macro(MacroKind::Attr, sym::contract_checks),
64+
attr_span,
65+
attr_span.edition(),
66+
None,
67+
None,
68+
)
69+
};
70+
let expn_id = LocalExpnId::fresh(expn_data, attr_span.ctxt());
71+
let attr_span = attr_span.apply_mark(expn_id.to_expn_id(), Transparency::Transparent);
72+
6073
// Find the `fn` keyword to check if this is a function.
6174
if cursor
6275
.find(|tt| {

0 commit comments

Comments
 (0)