mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Do not ICE when we have -Zunpretty=expand with invalid ABI
This commit is contained in:
parent
d5e7f4782e
commit
26ecd44160
@ -274,6 +274,7 @@ impl<'a> PostExpansionVisitor<'a> {
|
||||
);
|
||||
}
|
||||
abi => {
|
||||
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
|
||||
self.sess.parse_sess.span_diagnostic.delay_span_bug(
|
||||
span,
|
||||
&format!("unrecognized ABI not caught in lowering: {}", abi),
|
||||
@ -281,6 +282,7 @@ impl<'a> PostExpansionVisitor<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_extern(&self, ext: ast::Extern, constness: ast::Const) {
|
||||
if let ast::Extern::Explicit(abi, _) = ext {
|
||||
|
@ -2707,6 +2707,14 @@ impl PpMode {
|
||||
| MirCFG => true,
|
||||
}
|
||||
}
|
||||
pub fn needs_hir(&self) -> bool {
|
||||
use PpMode::*;
|
||||
match *self {
|
||||
Source(_) | AstTree(_) => false,
|
||||
|
||||
Hir(_) | HirTree | ThirTree | Mir | MirCFG => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn needs_analysis(&self) -> bool {
|
||||
use PpMode::*;
|
||||
|
13
src/test/ui/codemap_tests/unicode.expanded.stdout
Normal file
13
src/test/ui/codemap_tests/unicode.expanded.stdout
Normal file
@ -0,0 +1,13 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
// revisions: normal expanded
|
||||
//[expanded] check-pass
|
||||
//[expanded]compile-flags: -Zunpretty=expanded
|
||||
|
||||
extern "路濫狼á́́" fn foo() {}
|
||||
|
||||
fn main() {}
|
@ -1,5 +1,5 @@
|
||||
error[E0703]: invalid ABI: found `路濫狼á́́`
|
||||
--> $DIR/unicode.rs:1:8
|
||||
--> $DIR/unicode.rs:5:8
|
||||
|
|
||||
LL | extern "路濫狼á́́" fn foo() {}
|
||||
| ^^^^^^^^^ invalid ABI
|
@ -1,3 +1,7 @@
|
||||
extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
|
||||
// revisions: normal expanded
|
||||
//[expanded] check-pass
|
||||
//[expanded]compile-flags: -Zunpretty=expanded
|
||||
|
||||
extern "路濫狼á́́" fn foo() {} //[normal]~ ERROR invalid ABI
|
||||
|
||||
fn main() { }
|
||||
|
Loading…
Reference in New Issue
Block a user