Auto merge of #51762 - petrochenkov:oh-hi-mark, r=oli-obk
hygiene: Implement transparent marks and use them for call-site hygiene in proc-macros Fixes https://github.com/rust-lang/rust/issues/50050
This commit is contained in:
@@ -43,7 +43,7 @@ use ast::{BinOpKind, UnOp};
|
||||
use ast::{RangeEnd, RangeSyntax};
|
||||
use {ast, attr};
|
||||
use codemap::{self, CodeMap, Spanned, respan};
|
||||
use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, DUMMY_SP, edition::Edition};
|
||||
use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, edition::Edition};
|
||||
use errors::{self, Applicability, DiagnosticBuilder};
|
||||
use parse::{self, SeqSep, classify, token};
|
||||
use parse::lexer::TokenAndSpan;
|
||||
@@ -567,7 +567,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
if let Some(directory) = directory {
|
||||
parser.directory = directory;
|
||||
} else if !parser.span.source_equal(&DUMMY_SP) {
|
||||
} else if !parser.span.is_dummy() {
|
||||
if let FileName::Real(mut path) = sess.codemap().span_to_unmapped_path(parser.span) {
|
||||
path.pop();
|
||||
parser.directory.path = Cow::from(path);
|
||||
@@ -584,7 +584,7 @@ impl<'a> Parser<'a> {
|
||||
} else {
|
||||
self.token_cursor.next()
|
||||
};
|
||||
if next.sp == syntax_pos::DUMMY_SP {
|
||||
if next.sp.is_dummy() {
|
||||
// Tweak the location for better diagnostics, but keep syntactic context intact.
|
||||
next.sp = self.prev_span.with_ctxt(next.sp.ctxt());
|
||||
}
|
||||
@@ -6138,7 +6138,7 @@ impl<'a> Parser<'a> {
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
let hi = if self.span == syntax_pos::DUMMY_SP {
|
||||
let hi = if self.span.is_dummy() {
|
||||
inner_lo
|
||||
} else {
|
||||
self.prev_span
|
||||
@@ -6369,7 +6369,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
let mut err = self.diagnostic().struct_span_err(id_sp,
|
||||
"cannot declare a new module at this location");
|
||||
if id_sp != syntax_pos::DUMMY_SP {
|
||||
if !id_sp.is_dummy() {
|
||||
let src_path = self.sess.codemap().span_to_filename(id_sp);
|
||||
if let FileName::Real(src_path) = src_path {
|
||||
if let Some(stem) = src_path.file_stem() {
|
||||
|
||||
Reference in New Issue
Block a user