Add with_{def_site,call_site,legacy}_ctxt,
methods to Span
Use these to create call-site spans for AST passes when needed.
This commit is contained in:
parent
0b86782058
commit
c8cf9f5a02
10 changed files with 138 additions and 117 deletions
|
@ -17,7 +17,7 @@ use syntax::edition::Edition;
|
||||||
use syntax::ext::base::{self, Indeterminate, SpecialDerives};
|
use syntax::ext::base::{self, Indeterminate, SpecialDerives};
|
||||||
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
||||||
use syntax::ext::expand::{AstFragment, Invocation, InvocationKind};
|
use syntax::ext::expand::{AstFragment, Invocation, InvocationKind};
|
||||||
use syntax::ext::hygiene::{self, ExpnId, ExpnData, ExpnKind, Transparency};
|
use syntax::ext::hygiene::{self, ExpnId, ExpnData, ExpnKind};
|
||||||
use syntax::ext::tt::macro_rules;
|
use syntax::ext::tt::macro_rules;
|
||||||
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
|
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
|
||||||
use syntax::feature_gate::GateIssue;
|
use syntax::feature_gate::GateIssue;
|
||||||
|
@ -131,23 +131,20 @@ impl<'a> base::Resolver for Resolver<'a> {
|
||||||
// Create a Span with modern hygiene with a definition site of the provided
|
// Create a Span with modern hygiene with a definition site of the provided
|
||||||
// module, or a fake empty `#[no_implicit_prelude]` module if no module is
|
// module, or a fake empty `#[no_implicit_prelude]` module if no module is
|
||||||
// provided.
|
// provided.
|
||||||
fn span_for_ast_pass(
|
fn expansion_for_ast_pass(
|
||||||
&mut self,
|
&mut self,
|
||||||
base_span: Span,
|
call_site: Span,
|
||||||
pass: AstPass,
|
pass: AstPass,
|
||||||
features: &[Symbol],
|
features: &[Symbol],
|
||||||
parent_module_id: Option<NodeId>,
|
parent_module_id: Option<NodeId>,
|
||||||
) -> Span {
|
) -> ExpnId {
|
||||||
let span = base_span.fresh_expansion_with_transparency(
|
let expn_id = ExpnId::fresh(Some(ExpnData::allow_unstable(
|
||||||
ExpnData::allow_unstable(
|
ExpnKind::AstPass(pass),
|
||||||
ExpnKind::AstPass(pass),
|
call_site,
|
||||||
base_span,
|
self.session.edition(),
|
||||||
self.session.edition(),
|
features.into(),
|
||||||
features.into(),
|
)));
|
||||||
),
|
|
||||||
Transparency::Opaque,
|
|
||||||
);
|
|
||||||
let expn_id = span.ctxt().outer_expn();
|
|
||||||
let parent_scope = if let Some(module_id) = parent_module_id {
|
let parent_scope = if let Some(module_id) = parent_module_id {
|
||||||
let parent_def_id = self.definitions.local_def_id(module_id);
|
let parent_def_id = self.definitions.local_def_id(module_id);
|
||||||
self.definitions.add_parent_module_of_macro_def(expn_id, parent_def_id);
|
self.definitions.add_parent_module_of_macro_def(expn_id, parent_def_id);
|
||||||
|
@ -160,7 +157,7 @@ impl<'a> base::Resolver for Resolver<'a> {
|
||||||
self.empty_module
|
self.empty_module
|
||||||
};
|
};
|
||||||
self.ast_transform_scopes.insert(expn_id, parent_scope);
|
self.ast_transform_scopes.insert(expn_id, parent_scope);
|
||||||
span
|
expn_id
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_imports(&mut self) {
|
fn resolve_imports(&mut self) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::attr::{HasAttrs, Stability, Deprecation};
|
||||||
use crate::source_map::SourceMap;
|
use crate::source_map::SourceMap;
|
||||||
use crate::edition::Edition;
|
use crate::edition::Edition;
|
||||||
use crate::ext::expand::{self, AstFragment, Invocation};
|
use crate::ext::expand::{self, AstFragment, Invocation};
|
||||||
use crate::ext::hygiene::{ExpnId, Transparency};
|
use crate::ext::hygiene::ExpnId;
|
||||||
use crate::mut_visit::{self, MutVisitor};
|
use crate::mut_visit::{self, MutVisitor};
|
||||||
use crate::parse::{self, parser, DirectoryOwnership};
|
use crate::parse::{self, parser, DirectoryOwnership};
|
||||||
use crate::parse::token;
|
use crate::parse::token;
|
||||||
|
@ -658,13 +658,13 @@ pub trait Resolver {
|
||||||
extra_placeholders: &[NodeId]);
|
extra_placeholders: &[NodeId]);
|
||||||
fn register_builtin_macro(&mut self, ident: ast::Ident, ext: SyntaxExtension);
|
fn register_builtin_macro(&mut self, ident: ast::Ident, ext: SyntaxExtension);
|
||||||
|
|
||||||
fn span_for_ast_pass(
|
fn expansion_for_ast_pass(
|
||||||
&mut self,
|
&mut self,
|
||||||
span: Span,
|
call_site: Span,
|
||||||
pass: AstPass,
|
pass: AstPass,
|
||||||
features: &[Symbol],
|
features: &[Symbol],
|
||||||
parent_module_id: Option<NodeId>,
|
parent_module_id: Option<NodeId>,
|
||||||
) -> Span;
|
) -> ExpnId;
|
||||||
|
|
||||||
fn resolve_imports(&mut self);
|
fn resolve_imports(&mut self);
|
||||||
|
|
||||||
|
@ -750,20 +750,20 @@ impl<'a> ExtCtxt<'a> {
|
||||||
/// Equivalent of `Span::def_site` from the proc macro API,
|
/// Equivalent of `Span::def_site` from the proc macro API,
|
||||||
/// except that the location is taken from the span passed as an argument.
|
/// except that the location is taken from the span passed as an argument.
|
||||||
pub fn with_def_site_ctxt(&self, span: Span) -> Span {
|
pub fn with_def_site_ctxt(&self, span: Span) -> Span {
|
||||||
span.with_ctxt_from_mark(self.current_expansion.id, Transparency::Opaque)
|
span.with_def_site_ctxt(self.current_expansion.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Equivalent of `Span::call_site` from the proc macro API,
|
/// Equivalent of `Span::call_site` from the proc macro API,
|
||||||
/// except that the location is taken from the span passed as an argument.
|
/// except that the location is taken from the span passed as an argument.
|
||||||
pub fn with_call_site_ctxt(&self, span: Span) -> Span {
|
pub fn with_call_site_ctxt(&self, span: Span) -> Span {
|
||||||
span.with_ctxt_from_mark(self.current_expansion.id, Transparency::Transparent)
|
span.with_call_site_ctxt(self.current_expansion.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Span with a context reproducing `macro_rules` hygiene (hygienic locals, unhygienic items).
|
/// Span with a context reproducing `macro_rules` hygiene (hygienic locals, unhygienic items).
|
||||||
/// FIXME: This should be eventually replaced either with `with_def_site_ctxt` (preferably),
|
/// FIXME: This should be eventually replaced either with `with_def_site_ctxt` (preferably),
|
||||||
/// or with `with_call_site_ctxt` (where necessary).
|
/// or with `with_call_site_ctxt` (where necessary).
|
||||||
pub fn with_legacy_ctxt(&self, span: Span) -> Span {
|
pub fn with_legacy_ctxt(&self, span: Span) -> Span {
|
||||||
span.with_ctxt_from_mark(self.current_expansion.id, Transparency::SemiTransparent)
|
span.with_legacy_ctxt(self.current_expansion.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns span for the macro which originally caused the current expansion to happen.
|
/// Returns span for the macro which originally caused the current expansion to happen.
|
||||||
|
|
|
@ -326,12 +326,13 @@ fn mk_decls(
|
||||||
custom_attrs: &[ProcMacroDef],
|
custom_attrs: &[ProcMacroDef],
|
||||||
custom_macros: &[ProcMacroDef],
|
custom_macros: &[ProcMacroDef],
|
||||||
) -> P<ast::Item> {
|
) -> P<ast::Item> {
|
||||||
let span = cx.resolver.span_for_ast_pass(
|
let expn_id = cx.resolver.expansion_for_ast_pass(
|
||||||
DUMMY_SP,
|
DUMMY_SP,
|
||||||
AstPass::ProcMacroHarness,
|
AstPass::ProcMacroHarness,
|
||||||
&[sym::rustc_attrs, sym::proc_macro_internals],
|
&[sym::rustc_attrs, sym::proc_macro_internals],
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
let span = DUMMY_SP.with_def_site_ctxt(expn_id);
|
||||||
|
|
||||||
let proc_macro = Ident::new(sym::proc_macro, span);
|
let proc_macro = Ident::new(sym::proc_macro, span);
|
||||||
let krate = cx.item(span,
|
let krate = cx.item(span,
|
||||||
|
|
|
@ -28,19 +28,21 @@ pub fn inject(
|
||||||
&[sym::std]
|
&[sym::std]
|
||||||
};
|
};
|
||||||
|
|
||||||
let span = resolver.span_for_ast_pass(
|
let expn_id = resolver.expansion_for_ast_pass(
|
||||||
DUMMY_SP,
|
DUMMY_SP,
|
||||||
AstPass::StdImports,
|
AstPass::StdImports,
|
||||||
&[sym::prelude_import],
|
&[sym::prelude_import],
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
let span = DUMMY_SP.with_def_site_ctxt(expn_id);
|
||||||
|
let call_site = DUMMY_SP.with_call_site_ctxt(expn_id);
|
||||||
|
|
||||||
// .rev() to preserve ordering above in combination with insert(0, ...)
|
// .rev() to preserve ordering above in combination with insert(0, ...)
|
||||||
for &orig_name_sym in names.iter().rev() {
|
for &orig_name_sym in names.iter().rev() {
|
||||||
let (rename, orig_name) = if rust_2018 {
|
let (rename, orig_name) = if rust_2018 {
|
||||||
(Ident::new(kw::Underscore, span), Some(orig_name_sym))
|
(Ident::new(kw::Underscore, span), Some(orig_name_sym))
|
||||||
} else {
|
} else {
|
||||||
(Ident::with_dummy_span(orig_name_sym), None)
|
(Ident::new(orig_name_sym, call_site), None)
|
||||||
};
|
};
|
||||||
krate.module.items.insert(0, P(ast::Item {
|
krate.module.items.insert(0, P(ast::Item {
|
||||||
attrs: vec![attr::mk_attr_outer(
|
attrs: vec![attr::mk_attr_outer(
|
||||||
|
@ -65,7 +67,7 @@ pub fn inject(
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
[kw::PathRoot, name, sym::prelude, sym::v1].iter()
|
[kw::PathRoot, name, sym::prelude, sym::v1].iter()
|
||||||
.map(|symbol| ast::PathSegment::from_ident(ast::Ident::with_dummy_span(*symbol)))
|
.map(|symbol| ast::PathSegment::from_ident(ast::Ident::new(*symbol, call_site)))
|
||||||
.collect()
|
.collect()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -97,15 +97,16 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
|
||||||
};
|
};
|
||||||
// Create an identifier that will hygienically resolve the test
|
// Create an identifier that will hygienically resolve the test
|
||||||
// case name, even in another module.
|
// case name, even in another module.
|
||||||
let sp = self.cx.ext_cx.resolver.span_for_ast_pass(
|
let expn_id = self.cx.ext_cx.resolver.expansion_for_ast_pass(
|
||||||
module.inner,
|
module.inner,
|
||||||
AstPass::TestHarness,
|
AstPass::TestHarness,
|
||||||
&[],
|
&[],
|
||||||
Some(parent),
|
Some(parent),
|
||||||
);
|
);
|
||||||
let expn = sp.ctxt().outer_expn();
|
|
||||||
for test in &mut tests {
|
for test in &mut tests {
|
||||||
test.ident.span = test.ident.span.apply_mark(expn, Transparency::Opaque);
|
// See the comment on `mk_main` for why we're using
|
||||||
|
// `apply_mark` directly.
|
||||||
|
test.ident.span = test.ident.span.apply_mark(expn_id, Transparency::Opaque);
|
||||||
}
|
}
|
||||||
self.cx.test_cases.extend(tests);
|
self.cx.test_cases.extend(tests);
|
||||||
}
|
}
|
||||||
|
@ -207,12 +208,13 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
|
||||||
// #![main]
|
// #![main]
|
||||||
// test::test_main_static(&[..tests]);
|
// test::test_main_static(&[..tests]);
|
||||||
// }
|
// }
|
||||||
let sp = cx.ext_cx.resolver.span_for_ast_pass(
|
let expn_id = cx.ext_cx.resolver.expansion_for_ast_pass(
|
||||||
DUMMY_SP,
|
DUMMY_SP,
|
||||||
AstPass::TestHarness,
|
AstPass::TestHarness,
|
||||||
&[sym::main, sym::test, sym::rustc_attrs],
|
&[sym::main, sym::test, sym::rustc_attrs],
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
let sp = DUMMY_SP.with_def_site_ctxt(expn_id);
|
||||||
let ecx = &cx.ext_cx;
|
let ecx = &cx.ext_cx;
|
||||||
let test_id = Ident::new(sym::test, sp);
|
let test_id = Ident::new(sym::test, sp);
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ impl SyntaxContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extend a syntax context with a given expansion and transparency.
|
/// Extend a syntax context with a given expansion and transparency.
|
||||||
pub fn apply_mark(self, expn_id: ExpnId, transparency: Transparency) -> SyntaxContext {
|
crate fn apply_mark(self, expn_id: ExpnId, transparency: Transparency) -> SyntaxContext {
|
||||||
HygieneData::with(|data| data.apply_mark(self, expn_id, transparency))
|
HygieneData::with(|data| data.apply_mark(self, expn_id, transparency))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -514,6 +514,25 @@ impl Span {
|
||||||
span.ctxt)
|
span.ctxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Equivalent of `Span::def_site` from the proc macro API,
|
||||||
|
/// except that the location is taken from the `self` span.
|
||||||
|
pub fn with_def_site_ctxt(self, expn_id: ExpnId) -> Span {
|
||||||
|
self.with_ctxt_from_mark(expn_id, Transparency::Opaque)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Equivalent of `Span::call_site` from the proc macro API,
|
||||||
|
/// except that the location is taken from the `self` span.
|
||||||
|
pub fn with_call_site_ctxt(&self, expn_id: ExpnId) -> Span {
|
||||||
|
self.with_ctxt_from_mark(expn_id, Transparency::Transparent)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Span with a context reproducing `macro_rules` hygiene (hygienic locals, unhygienic items).
|
||||||
|
/// FIXME: This should be eventually replaced either with `with_def_site_ctxt` (preferably),
|
||||||
|
/// or with `with_call_site_ctxt` (where necessary).
|
||||||
|
pub fn with_legacy_ctxt(&self, expn_id: ExpnId) -> Span {
|
||||||
|
self.with_ctxt_from_mark(expn_id, Transparency::SemiTransparent)
|
||||||
|
}
|
||||||
|
|
||||||
/// Produces a span with the same location as `self` and context produced by a macro with the
|
/// Produces a span with the same location as `self` and context produced by a macro with the
|
||||||
/// given ID and transparency, assuming that macro was defined directly and not produced by
|
/// given ID and transparency, assuming that macro was defined directly and not produced by
|
||||||
/// some other macro (which is the case for built-in and procedural macros).
|
/// some other macro (which is the case for built-in and procedural macros).
|
||||||
|
|
|
@ -2,40 +2,40 @@ PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
|
||||||
PRINT-BANG INPUT (DEBUG): TokenStream [
|
PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "M",
|
ident: "M",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
|
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
|
||||||
|
@ -43,39 +43,39 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ;
|
||||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "A",
|
ident: "A",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,55 +3,55 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct A (identity ! ($crate :: S)) ;
|
||||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "A",
|
ident: "A",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "identity",
|
ident: "identity",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: '!',
|
ch: '!',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-ATTR INPUT (DISPLAY): struct B(identity!(::dollar_crate_external :: S));
|
PRINT-ATTR INPUT (DISPLAY): struct B(identity!(::dollar_crate_external :: S));
|
||||||
|
@ -59,54 +59,54 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct B (identity ! ($crate :: S)) ;
|
||||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "B",
|
ident: "B",
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "identity",
|
ident: "identity",
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: '!',
|
ch: '!',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #7 bytes(LO..HI),
|
span: #8 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,40 +2,40 @@ PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
|
||||||
PRINT-BANG INPUT (DEBUG): TokenStream [
|
PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "M",
|
ident: "M",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
|
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
|
||||||
|
@ -43,40 +43,40 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ;
|
||||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "A",
|
ident: "A",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-DERIVE INPUT (DISPLAY): struct D(crate::S);
|
PRINT-DERIVE INPUT (DISPLAY): struct D(crate::S);
|
||||||
|
@ -84,80 +84,80 @@ PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ($crate :: S) ;
|
||||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "D",
|
ident: "D",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #2 bytes(LO..HI),
|
span: #3 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
|
PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
|
||||||
PRINT-BANG INPUT (DEBUG): TokenStream [
|
PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "M",
|
ident: "M",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-ATTR INPUT (DISPLAY): struct A(::dollar_crate_external::S);
|
PRINT-ATTR INPUT (DISPLAY): struct A(::dollar_crate_external::S);
|
||||||
|
@ -165,40 +165,40 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ;
|
||||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "A",
|
ident: "A",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
PRINT-DERIVE INPUT (DISPLAY): struct D(::dollar_crate_external::S);
|
PRINT-DERIVE INPUT (DISPLAY): struct D(::dollar_crate_external::S);
|
||||||
|
@ -206,39 +206,39 @@ PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ($crate :: S) ;
|
||||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "struct",
|
ident: "struct",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "D",
|
ident: "D",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
delimiter: Parenthesis,
|
delimiter: Parenthesis,
|
||||||
stream: TokenStream [
|
stream: TokenStream [
|
||||||
Ident {
|
Ident {
|
||||||
ident: "$crate",
|
ident: "$crate",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Joint,
|
spacing: Joint,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ':',
|
ch: ':',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Ident {
|
Ident {
|
||||||
ident: "S",
|
ident: "S",
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
Punct {
|
Punct {
|
||||||
ch: ';',
|
ch: ';',
|
||||||
spacing: Alone,
|
spacing: Alone,
|
||||||
span: #9 bytes(LO..HI),
|
span: #10 bytes(LO..HI),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue