mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 05:51:58 +00:00
rewrote error messages for #[rustc_error]
This commit is contained in:
parent
fff3c25b85
commit
f0d206147e
@ -29,7 +29,10 @@ pub mod symbol_names_test;
|
||||
|
||||
|
||||
pub fn trigger_delay_span_bug(tcx: TyCtxt<'_>, key: DefId) {
|
||||
tcx.sess.delay_span_bug(tcx.def_span(key), "compilation successful");
|
||||
tcx.sess.delay_span_bug(
|
||||
tcx.def_span(key),
|
||||
"delayed span bug triggered by #[rustc_error(delay_span_bug_from_inside_query)]"
|
||||
);
|
||||
}
|
||||
|
||||
/// check for the #[rustc_error] annotation, which forces an
|
||||
@ -53,7 +56,10 @@ pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
|
||||
}
|
||||
// bare #[rustc_error]
|
||||
None => {
|
||||
tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
|
||||
tcx.sess.span_fatal(
|
||||
tcx.def_span(def_id),
|
||||
"fatal error triggered by #[rustc_error]"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// revisions: cfail1 cfail2
|
||||
// should-ice
|
||||
// error-pattern: compilation successful
|
||||
// error-pattern: fatal error triggered by #[rustc_error]
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
@ -45,4 +45,4 @@ fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { } //[ok]~ ERROR compilation successful
|
||||
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/bound-lifetime-in-binding-only.rs:71:1
|
||||
|
|
||||
LL | fn main() { }
|
||||
|
@ -68,4 +68,4 @@ fn ok3<T>() where for<'a> Parameterized<'a>: Foo<Item=&'a i32> {
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { } //[ok]~ ERROR compilation successful
|
||||
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/bound-lifetime-in-return-only.rs:49:1
|
||||
|
|
||||
LL | fn main() { }
|
||||
|
@ -46,4 +46,4 @@ fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) {
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { } //[ok]~ ERROR compilation successful
|
||||
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/project-fn-ret-contravariant.rs:50:1
|
||||
|
|
||||
LL | fn main() { }
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/project-fn-ret-contravariant.rs:50:1
|
||||
|
|
||||
LL | fn main() { }
|
||||
|
@ -48,5 +48,5 @@ fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { }
|
||||
//[ok]~^ ERROR compilation successful
|
||||
//[oneuse]~^^ ERROR compilation successful
|
||||
//[ok]~^ ERROR fatal error triggered by #[rustc_error]
|
||||
//[oneuse]~^^ ERROR fatal error triggered by #[rustc_error]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/project-fn-ret-invariant.rs:59:1
|
||||
|
|
||||
LL | fn main() { }
|
||||
|
@ -57,4 +57,4 @@ fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { }
|
||||
//[ok]~^ ERROR compilation successful
|
||||
//[ok]~^ ERROR fatal error triggered by #[rustc_error]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/higher-ranked-projection.rs:24:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -21,7 +21,7 @@ fn foo<U, T>(_t: T)
|
||||
{}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { //[good]~ ERROR compilation successful
|
||||
fn main() { //[good]~ ERROR fatal error triggered by #[rustc_error]
|
||||
foo(());
|
||||
//[bad]~^ ERROR type mismatch
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/hr-subtype.rs:100:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/hr-subtype.rs:100:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/hr-subtype.rs:100:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/hr-subtype.rs:100:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/hr-subtype.rs:100:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -98,9 +98,9 @@ check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {
|
||||
//[bound_a_vs_bound_a]~^ ERROR compilation successful
|
||||
//[bound_a_vs_bound_b]~^^ ERROR compilation successful
|
||||
//[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
|
||||
//[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
|
||||
//[free_x_vs_free_x]~^^^^^ ERROR compilation successful
|
||||
//[bound_a_vs_bound_a]~^ ERROR fatal error triggered by #[rustc_error]
|
||||
//[bound_a_vs_bound_b]~^^ ERROR fatal error triggered by #[rustc_error]
|
||||
//[bound_inv_a_vs_bound_inv_b]~^^^ ERROR fatal error triggered by #[rustc_error]
|
||||
//[bound_co_a_vs_bound_co_b]~^^^^ ERROR fatal error triggered by #[rustc_error]
|
||||
//[free_x_vs_free_x]~^^^^^ ERROR fatal error triggered by #[rustc_error]
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ extern crate test_macros;
|
||||
//~^ WARN unused extern crate
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {} //~ ERROR compilation successful
|
||||
fn main() {} //~ ERROR fatal error triggered by #[rustc_error]
|
||||
|
@ -10,7 +10,7 @@ note: lint level defined here
|
||||
LL | #![warn(unused_extern_crates)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/no-macro-use-attr.rs:10:1
|
||||
|
|
||||
LL | fn main() {}
|
||||
|
@ -18,7 +18,7 @@ struct Foo {
|
||||
const FOO: Foo = Foo { x: 0 };
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { //[with_gate]~ ERROR compilation successful
|
||||
fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error]
|
||||
let y = Foo { x: 1 };
|
||||
match y {
|
||||
FOO => { }
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/feature-gate.rs:21:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {
|
||||
//~^ ERROR compilation successful
|
||||
//~^ ERROR fatal error triggered by #[rustc_error]
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: compilation successful
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/rustc-error.rs:4:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user