Skip to content

Commit f0d2061

Browse files
committed
rewrote error messages for #[rustc_error]
1 parent fff3c25 commit f0d2061

26 files changed

+38
-32
lines changed

src/librustc_codegen_utils/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ pub mod symbol_names_test;
2929

3030

3131
pub fn trigger_delay_span_bug(tcx: TyCtxt<'_>, key: DefId) {
32-
tcx.sess.delay_span_bug(tcx.def_span(key), "compilation successful");
32+
tcx.sess.delay_span_bug(
33+
tcx.def_span(key),
34+
"delayed span bug triggered by #[rustc_error(delay_span_bug_from_inside_query)]"
35+
);
3336
}
3437

3538
/// check for the #[rustc_error] annotation, which forces an
@@ -53,7 +56,10 @@ pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
5356
}
5457
// bare #[rustc_error]
5558
None => {
56-
tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
59+
tcx.sess.span_fatal(
60+
tcx.def_span(def_id),
61+
"fatal error triggered by #[rustc_error]"
62+
);
5763
}
5864
}
5965
}

src/test/incremental/delayed_span_bug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// revisions: cfail1 cfail2
22
// should-ice
3-
// error-pattern: compilation successful
3+
// error-pattern: fatal error triggered by #[rustc_error]
44

55
#![feature(rustc_attrs)]
66

src/test/ui/associated-types/bound-lifetime-constrained.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
4545
}
4646

4747
#[rustc_error]
48-
fn main() { } //[ok]~ ERROR compilation successful
48+
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]

src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/bound-lifetime-in-binding-only.rs:71:1
33
|
44
LL | fn main() { }

src/test/ui/associated-types/bound-lifetime-in-binding-only.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ fn ok3<T>() where for<'a> Parameterized<'a>: Foo<Item=&'a i32> {
6868
}
6969

7070
#[rustc_error]
71-
fn main() { } //[ok]~ ERROR compilation successful
71+
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]

src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/bound-lifetime-in-return-only.rs:49:1
33
|
44
LL | fn main() { }

src/test/ui/associated-types/bound-lifetime-in-return-only.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) {
4646
}
4747

4848
#[rustc_error]
49-
fn main() { } //[ok]~ ERROR compilation successful
49+
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]

src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/project-fn-ret-contravariant.rs:50:1
33
|
44
LL | fn main() { }

src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/project-fn-ret-contravariant.rs:50:1
33
|
44
LL | fn main() { }

src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
4848

4949
#[rustc_error]
5050
fn main() { }
51-
//[ok]~^ ERROR compilation successful
52-
//[oneuse]~^^ ERROR compilation successful
51+
//[ok]~^ ERROR fatal error triggered by #[rustc_error]
52+
//[oneuse]~^^ ERROR fatal error triggered by #[rustc_error]

src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/project-fn-ret-invariant.rs:59:1
33
|
44
LL | fn main() { }

src/test/ui/associated-types/cache/project-fn-ret-invariant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
5757

5858
#[rustc_error]
5959
fn main() { }
60-
//[ok]~^ ERROR compilation successful
60+
//[ok]~^ ERROR fatal error triggered by #[rustc_error]

src/test/ui/associated-types/higher-ranked-projection.good.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/higher-ranked-projection.rs:24:1
33
|
44
LL | / fn main() {

src/test/ui/associated-types/higher-ranked-projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn foo<U, T>(_t: T)
2121
{}
2222

2323
#[rustc_error]
24-
fn main() { //[good]~ ERROR compilation successful
24+
fn main() { //[good]~ ERROR fatal error triggered by #[rustc_error]
2525
foo(());
2626
//[bad]~^ ERROR type mismatch
2727
}

src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/hr-subtype.rs:100:1
33
|
44
LL | / fn main() {

src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/hr-subtype.rs:100:1
33
|
44
LL | / fn main() {

src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/hr-subtype.rs:100:1
33
|
44
LL | / fn main() {

src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/hr-subtype.rs:100:1
33
|
44
LL | / fn main() {

src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/hr-subtype.rs:100:1
33
|
44
LL | / fn main() {

src/test/ui/hr-subtype/hr-subtype.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &
9898

9999
#[rustc_error]
100100
fn main() {
101-
//[bound_a_vs_bound_a]~^ ERROR compilation successful
102-
//[bound_a_vs_bound_b]~^^ ERROR compilation successful
103-
//[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
104-
//[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
105-
//[free_x_vs_free_x]~^^^^^ ERROR compilation successful
101+
//[bound_a_vs_bound_a]~^ ERROR fatal error triggered by #[rustc_error]
102+
//[bound_a_vs_bound_b]~^^ ERROR fatal error triggered by #[rustc_error]
103+
//[bound_inv_a_vs_bound_inv_b]~^^^ ERROR fatal error triggered by #[rustc_error]
104+
//[bound_co_a_vs_bound_co_b]~^^^^ ERROR fatal error triggered by #[rustc_error]
105+
//[free_x_vs_free_x]~^^^^^ ERROR fatal error triggered by #[rustc_error]
106106
}

src/test/ui/proc-macro/no-macro-use-attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ extern crate test_macros;
77
//~^ WARN unused extern crate
88

99
#[rustc_error]
10-
fn main() {} //~ ERROR compilation successful
10+
fn main() {} //~ ERROR fatal error triggered by #[rustc_error]

src/test/ui/proc-macro/no-macro-use-attr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ note: lint level defined here
1010
LL | #![warn(unused_extern_crates)]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

13-
error: compilation successful
13+
error: fatal error triggered by #[rustc_error]
1414
--> $DIR/no-macro-use-attr.rs:10:1
1515
|
1616
LL | fn main() {}

src/test/ui/rfc1445/feature-gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct Foo {
1818
const FOO: Foo = Foo { x: 0 };
1919

2020
#[rustc_error]
21-
fn main() { //[with_gate]~ ERROR compilation successful
21+
fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error]
2222
let y = Foo { x: 1 };
2323
match y {
2424
FOO => { }

src/test/ui/rfc1445/feature-gate.with_gate.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/feature-gate.rs:21:1
33
|
44
LL | / fn main() {

src/test/ui/rustc-error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
#[rustc_error]
44
fn main() {
5-
//~^ ERROR compilation successful
5+
//~^ ERROR fatal error triggered by #[rustc_error]
66
}

src/test/ui/rustc-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: compilation successful
1+
error: fatal error triggered by #[rustc_error]
22
--> $DIR/rustc-error.rs:4:1
33
|
44
LL | / fn main() {

0 commit comments

Comments
 (0)