1
Fork 0

fix most compiler/ doctests

This commit is contained in:
Elliot Roberts 2022-04-15 15:04:34 -07:00
parent bf611439e3
commit 7907385999
116 changed files with 666 additions and 609 deletions

View file

@ -686,7 +686,7 @@ impl SyntaxContext {
/// 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 {
/// ...
@ -710,6 +710,7 @@ impl SyntaxContext {
/// 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) {
@ -746,7 +747,8 @@ impl SyntaxContext {
/// 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 {
@ -786,7 +788,7 @@ impl SyntaxContext {
/// 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));
/// }

View file

@ -1058,10 +1058,11 @@ impl SourceMap {
/// Tries to find the span of the semicolon of a macro call statement.
/// The input must be the *call site* span of a statement from macro expansion.
///
/// v output
/// mac!();
/// ^^^^^^ input
/// ```ignore (illustrative)
/// // v output
/// mac!();
/// // ^^^^^^ input
/// ```
pub fn mac_call_stmt_semi_span(&self, mac_call: Span) -> Option<Span> {
let span = self.span_extend_while(mac_call, char::is_whitespace).ok()?;
let span = span.shrink_to_hi().with_hi(BytePos(span.hi().0.checked_add(1)?));