}
impl HygieneData {
- crate fn new(edition: Edition) -> Self {
+ pub(crate) fn new(edition: Edition) -> Self {
let root_data = ExpnData::default(
ExpnKind::Root,
DUMMY_SP,
}
#[inline]
- crate fn as_u32(self) -> u32 {
+ pub(crate) fn as_u32(self) -> u32 {
self.0
}
#[inline]
- crate fn from_u32(raw: u32) -> SyntaxContext {
+ pub(crate) fn from_u32(raw: u32) -> SyntaxContext {
SyntaxContext(raw)
}
/// Extend a syntax context with a given expansion and transparency.
- crate fn apply_mark(self, expn_id: ExpnId, transparency: Transparency) -> SyntaxContext {
+ pub(crate) fn apply_mark(self, expn_id: ExpnId, transparency: Transparency) -> SyntaxContext {
HygieneData::with(|data| data.apply_mark(self, expn_id, transparency))
}
/// context up one macro definition level. That is, if we have a nested macro
/// definition as follows:
///
- /// ```rust
+ /// ```ignore (illustrative)
/// macro_rules! f {
/// macro_rules! g {
/// ...
/// For example, consider the following three resolutions of `f`:
///
/// ```rust
+ /// #![feature(decl_macro)]
/// mod foo { pub fn f() {} } // `f`'s `SyntaxContext` is empty.
/// m!(f);
/// macro m($f:ident) {
/// via a glob import with the given `SyntaxContext`.
/// For example:
///
- /// ```rust
+ /// ```compile_fail,E0425
+ /// #![feature(decl_macro)]
/// m!(f);
/// macro m($i:ident) {
/// mod foo {
/// Undo `glob_adjust` if possible:
///
- /// ```rust
+ /// ```ignore (illustrative)
/// if let Some(privacy_checking_scope) = self.reverse_glob_adjust(expansion, glob_ctxt) {
/// assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope));
/// }