deps: apply upstream rustc-* changes
This commit is contained in:
parent
de4ff814b0
commit
b28fd5f91c
@ -27,7 +27,7 @@ pub enum FileName {
|
||||
impl From<rustc_span::FileName> for FileName {
|
||||
fn from(name: rustc_span::FileName) -> FileName {
|
||||
match name {
|
||||
rustc_span::FileName::Real(p) => FileName::Real(p),
|
||||
rustc_span::FileName::Real(p) => FileName::Real(p.into_local_path()),
|
||||
rustc_span::FileName::Custom(ref f) if f == "stdin" => FileName::Stdin,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
@ -322,7 +322,11 @@ pub(crate) fn format_expr(
|
||||
}
|
||||
// We do not format these expressions yet, but they should still
|
||||
// satisfy our width restrictions.
|
||||
ast::ExprKind::LlvmInlineAsm(..) => Some(context.snippet(expr.span).to_owned()),
|
||||
// Style Guide RFC for InlineAsm variant pending
|
||||
// https://github.com/rust-dev-tools/fmt-rfcs/issues/152
|
||||
ast::ExprKind::LlvmInlineAsm(..) | ast::ExprKind::InlineAsm(..) => {
|
||||
Some(context.snippet(expr.span).to_owned())
|
||||
}
|
||||
ast::ExprKind::TryBlock(ref block) => {
|
||||
if let rw @ Some(_) =
|
||||
rewrite_single_line_block(context, "try ", block, Some(&expr.attrs), None, shape)
|
||||
|
@ -1204,6 +1204,7 @@ pub(crate) fn convert_try_mac(
|
||||
kind: ast::ExprKind::Try(parser.parse_expr().ok()?),
|
||||
span: mac.span(), // incorrect span, but shouldn't matter too much
|
||||
attrs: ast::AttrVec::new(),
|
||||
tokens: Some(ts),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
@ -68,7 +68,9 @@ where
|
||||
impl From<&FileName> for rustc_span::FileName {
|
||||
fn from(filename: &FileName) -> rustc_span::FileName {
|
||||
match filename {
|
||||
FileName::Real(path) => rustc_span::FileName::Real(path.to_owned()),
|
||||
FileName::Real(path) => {
|
||||
rustc_span::FileName::Real(rustc_span::RealFileName::Named(path.to_owned()))
|
||||
}
|
||||
FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()),
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ impl Emitter for SilentOnIgnoredFilesEmitter {
|
||||
}
|
||||
if let Some(primary_span) = &db.span.primary_span() {
|
||||
let file_name = self.source_map.span_to_filename(*primary_span);
|
||||
if let rustc_span::FileName::Real(ref path) = file_name {
|
||||
if let rustc_span::FileName::Real(rustc_span::RealFileName::Named(ref path)) = file_name
|
||||
{
|
||||
if self
|
||||
.ignore_path_set
|
||||
.is_match(&FileName::Real(path.to_path_buf()))
|
||||
@ -162,7 +163,9 @@ impl ParseSess {
|
||||
pub(crate) fn is_file_parsed(&self, path: &Path) -> bool {
|
||||
self.parse_sess
|
||||
.source_map()
|
||||
.get_source_file(&rustc_span::FileName::Real(path.to_path_buf()))
|
||||
.get_source_file(&rustc_span::FileName::Real(
|
||||
rustc_span::RealFileName::Named(path.to_path_buf()),
|
||||
))
|
||||
.is_some()
|
||||
}
|
||||
|
||||
@ -277,7 +280,7 @@ mod tests {
|
||||
use crate::config::IgnoreList;
|
||||
use crate::is_nightly_channel;
|
||||
use crate::utils::mk_sp;
|
||||
use rustc_span::{FileName as SourceMapFileName, MultiSpan, DUMMY_SP};
|
||||
use rustc_span::{FileName as SourceMapFileName, MultiSpan, RealFileName, DUMMY_SP};
|
||||
use std::path::PathBuf;
|
||||
|
||||
struct TestEmitter {
|
||||
@ -337,7 +340,10 @@ mod tests {
|
||||
let source_map = Rc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let source =
|
||||
String::from(r#"extern "system" fn jni_symbol!( funcName ) ( ... ) -> {} "#);
|
||||
source_map.new_source_file(SourceMapFileName::Real(PathBuf::from("foo.rs")), source);
|
||||
source_map.new_source_file(
|
||||
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))),
|
||||
source,
|
||||
);
|
||||
let mut emitter = build_emitter(
|
||||
Rc::clone(&num_emitted_errors),
|
||||
Rc::clone(&can_reset_errors),
|
||||
@ -361,7 +367,10 @@ mod tests {
|
||||
let ignore_list = get_ignore_list(r#"ignore = ["foo.rs"]"#);
|
||||
let source_map = Rc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let source = String::from(r#"pub fn bar() { 1x; }"#);
|
||||
source_map.new_source_file(SourceMapFileName::Real(PathBuf::from("foo.rs")), source);
|
||||
source_map.new_source_file(
|
||||
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))),
|
||||
source,
|
||||
);
|
||||
let mut emitter = build_emitter(
|
||||
Rc::clone(&num_emitted_errors),
|
||||
Rc::clone(&can_reset_errors),
|
||||
@ -384,7 +393,10 @@ mod tests {
|
||||
let can_reset_errors = Rc::new(RefCell::new(false));
|
||||
let source_map = Rc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let source = String::from(r#"pub fn bar() { 1x; }"#);
|
||||
source_map.new_source_file(SourceMapFileName::Real(PathBuf::from("foo.rs")), source);
|
||||
source_map.new_source_file(
|
||||
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))),
|
||||
source,
|
||||
);
|
||||
let mut emitter = build_emitter(
|
||||
Rc::clone(&num_emitted_errors),
|
||||
Rc::clone(&can_reset_errors),
|
||||
@ -411,12 +423,16 @@ mod tests {
|
||||
let foo_source = String::from(r#"pub fn foo() { 1x; }"#);
|
||||
let fatal_source =
|
||||
String::from(r#"extern "system" fn jni_symbol!( funcName ) ( ... ) -> {} "#);
|
||||
source_map
|
||||
.new_source_file(SourceMapFileName::Real(PathBuf::from("bar.rs")), bar_source);
|
||||
source_map
|
||||
.new_source_file(SourceMapFileName::Real(PathBuf::from("foo.rs")), foo_source);
|
||||
source_map.new_source_file(
|
||||
SourceMapFileName::Real(PathBuf::from("fatal.rs")),
|
||||
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("bar.rs"))),
|
||||
bar_source,
|
||||
);
|
||||
source_map.new_source_file(
|
||||
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))),
|
||||
foo_source,
|
||||
);
|
||||
source_map.new_source_file(
|
||||
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("fatal.rs"))),
|
||||
fatal_source,
|
||||
);
|
||||
let mut emitter = build_emitter(
|
||||
|
@ -487,6 +487,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
|
||||
| ast::ExprKind::Continue(..)
|
||||
| ast::ExprKind::Err
|
||||
| ast::ExprKind::Field(..)
|
||||
| ast::ExprKind::InlineAsm(..)
|
||||
| ast::ExprKind::LlvmInlineAsm(..)
|
||||
| ast::ExprKind::Let(..)
|
||||
| ast::ExprKind::Path(..)
|
||||
|
Loading…
x
Reference in New Issue
Block a user