Skip to content

Commit 004c549

Browse files
committed
Auto merge of #60126 - estebank:continue-eval, r=oli-obk
Continue evaluating after item-type checking Fix #30999. r? @oli-obk
2 parents 6d59933 + 2dc5d52 commit 004c549

20 files changed

+179
-201
lines changed

src/librustc_interface/passes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -966,8 +966,7 @@ fn analysis<'tcx>(
966966
time(sess, "layout testing", || layout_test::test_layout(tcx));
967967

968968
// Avoid overwhelming user with errors if borrow checking failed.
969-
// I'm not sure how helpful this is, to be honest, but it avoids
970-
// a
969+
// I'm not sure how helpful this is, to be honest, but it avoids a
971970
// lot of annoying errors in the compile-fail tests (basically,
972971
// lint warnings and so on -- kindck used to do this abort, but
973972
// kindck is gone now). -nmatsakis

src/librustc_typeck/lib.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,10 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
357357
time(tcx.sess, "wf checking", || check::check_wf_new(tcx))?;
358358

359359
time(tcx.sess, "item-types checking", || {
360-
tcx.sess.track_errors(|| {
361-
for &module in tcx.hir().krate().modules.keys() {
362-
tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));
363-
}
364-
})
365-
})?;
360+
for &module in tcx.hir().krate().modules.keys() {
361+
tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));
362+
}
363+
});
366364

367365
time(tcx.sess, "item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE));
368366

src/test/ui/c-variadic/variadic-ffi-1.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ extern {
1212
extern "C" fn bar(f: isize, x: u8) {}
1313

1414
fn main() {
15-
// errors below are no longer checked because error above aborts
16-
// compilation; see variadic-ffi-3.rs for corresponding test.
1715
unsafe {
18-
foo();
19-
foo(1);
16+
foo(); //~ ERROR this function takes at least 2 parameters but 0 parameters were supplied
17+
foo(1); //~ ERROR this function takes at least 2 parameters but 1 parameter was supplied
2018

21-
let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
22-
let y: extern "C" fn(f: isize, x: u8, ...) = bar;
19+
let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~ ERROR mismatched types
20+
let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~ ERROR mismatched types
2321

24-
foo(1, 2, 3f32);
25-
foo(1, 2, true);
26-
foo(1, 2, 1i8);
27-
foo(1, 2, 1u8);
28-
foo(1, 2, 1i16);
29-
foo(1, 2, 1u16);
22+
foo(1, 2, 3f32); //~ ERROR can't pass
23+
foo(1, 2, true); //~ ERROR can't pass
24+
foo(1, 2, 1i8); //~ ERROR can't pass
25+
foo(1, 2, 1u8); //~ ERROR can't pass
26+
foo(1, 2, 1i16); //~ ERROR can't pass
27+
foo(1, 2, 1u16); //~ ERROR can't pass
3028
}
3129
}

src/test/ui/c-variadic/variadic-ffi-1.stderr

+75-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,79 @@ error[E0045]: C-variadic function must have C or cdecl calling convention
44
LL | fn printf(_: *const u8, ...);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention
66

7-
error: aborting due to previous error
7+
error[E0060]: this function takes at least 2 parameters but 0 parameters were supplied
8+
--> $DIR/variadic-ffi-1.rs:16:9
9+
|
10+
LL | fn foo(f: isize, x: u8, ...);
11+
| ----------------------------- defined here
12+
...
13+
LL | foo();
14+
| ^^^^^ expected at least 2 parameters
15+
16+
error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied
17+
--> $DIR/variadic-ffi-1.rs:17:9
18+
|
19+
LL | fn foo(f: isize, x: u8, ...);
20+
| ----------------------------- defined here
21+
...
22+
LL | foo(1);
23+
| ^^^^^^ expected at least 2 parameters
24+
25+
error[E0308]: mismatched types
26+
--> $DIR/variadic-ffi-1.rs:19:56
27+
|
28+
LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
29+
| ^^^ expected non-variadic fn, found variadic function
30+
|
31+
= note: expected type `unsafe extern "C" fn(isize, u8)`
32+
found type `for<'r> unsafe extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...) {foo}`
33+
34+
error[E0308]: mismatched types
35+
--> $DIR/variadic-ffi-1.rs:20:54
36+
|
37+
LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
38+
| ^^^ expected variadic fn, found non-variadic function
39+
|
40+
= note: expected type `for<'r> extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...)`
41+
found type `extern "C" fn(isize, u8) {bar}`
42+
43+
error[E0617]: can't pass `f32` to variadic function
44+
--> $DIR/variadic-ffi-1.rs:22:19
45+
|
46+
LL | foo(1, 2, 3f32);
47+
| ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
48+
49+
error[E0617]: can't pass `bool` to variadic function
50+
--> $DIR/variadic-ffi-1.rs:23:19
51+
|
52+
LL | foo(1, 2, true);
53+
| ^^^^ help: cast the value to `c_int`: `true as c_int`
54+
55+
error[E0617]: can't pass `i8` to variadic function
56+
--> $DIR/variadic-ffi-1.rs:24:19
57+
|
58+
LL | foo(1, 2, 1i8);
59+
| ^^^ help: cast the value to `c_int`: `1i8 as c_int`
60+
61+
error[E0617]: can't pass `u8` to variadic function
62+
--> $DIR/variadic-ffi-1.rs:25:19
63+
|
64+
LL | foo(1, 2, 1u8);
65+
| ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
66+
67+
error[E0617]: can't pass `i16` to variadic function
68+
--> $DIR/variadic-ffi-1.rs:26:19
69+
|
70+
LL | foo(1, 2, 1i16);
71+
| ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
72+
73+
error[E0617]: can't pass `u16` to variadic function
74+
--> $DIR/variadic-ffi-1.rs:27:19
75+
|
76+
LL | foo(1, 2, 1u16);
77+
| ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
78+
79+
error: aborting due to 11 previous errors
880

9-
For more information about this error, try `rustc --explain E0045`.
81+
Some errors have detailed explanations: E0045, E0060, E0308, E0617.
82+
For more information about an error, try `rustc --explain E0045`.

src/test/ui/c-variadic/variadic-ffi-3.rs

-29
This file was deleted.

src/test/ui/c-variadic/variadic-ffi-3.stderr

-76
This file was deleted.

src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait Get {
77

88
impl Get for i32 {
99
fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
10-
x
10+
x //~ ERROR lifetime mismatch
1111
}
1212
}
1313

src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,15 @@ LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
2020
expected fn(&i32, &'a u32, &u32) -> &'a u32
2121
found fn(&i32, &u32, &u32) -> &u32
2222

23-
error: aborting due to previous error
23+
error[E0623]: lifetime mismatch
24+
--> $DIR/mismatched_trait_impl.rs:10:9
25+
|
26+
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
27+
| ---- -------
28+
| |
29+
| this parameter and the return type are declared with different lifetimes...
30+
LL | x
31+
| ^ ...but data from `x` is returned here
32+
33+
error: aborting due to 2 previous errors
2434

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
enum MList { Cons(isize, MList), Nil }
22
//~^ ERROR recursive type `MList` has infinite size
3+
//~| ERROR cycle detected when processing `MList`
34

45
fn main() { let a = MList::Cons(10, MList::Cons(11, MList::Nil)); }

src/test/ui/infinite/infinite-tag-type-recursion.stderr

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ LL | enum MList { Cons(isize, MList), Nil }
88
|
99
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `MList` representable
1010

11-
error: aborting due to previous error
11+
error[E0391]: cycle detected when processing `MList`
12+
--> $DIR/infinite-tag-type-recursion.rs:1:1
13+
|
14+
LL | enum MList { Cons(isize, MList), Nil }
15+
| ^^^^^^^^^^
16+
|
17+
= note: ...which again requires processing `MList`, completing the cycle
18+
= note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: MList } }`
19+
20+
error: aborting due to 2 previous errors
1221

13-
For more information about this error, try `rustc --explain E0072`.
22+
Some errors have detailed explanations: E0072, E0391.
23+
For more information about an error, try `rustc --explain E0072`.

src/test/ui/issues/issue-16048.rs

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ impl<'a> NoLifetime for Foo<'a> {
2222
//~^ ERROR E0195
2323
//~| NOTE lifetimes do not match method in trait
2424
return *self as T;
25+
//~^ ERROR non-primitive cast: `Foo<'a>` as `T`
26+
//~| NOTE an `as` expression can only be used to convert between primitive types.
2527
}
2628
}
2729

src/test/ui/issues/issue-16048.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ LL | fn get<'p, T : Test<'p>>(&self) -> T;
77
LL | fn get<'p, T : Test<'a>>(&self) -> T {
88
| ^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
99

10-
error: aborting due to previous error
10+
error[E0605]: non-primitive cast: `Foo<'a>` as `T`
11+
--> $DIR/issue-16048.rs:24:16
12+
|
13+
LL | return *self as T;
14+
| ^^^^^^^^^^
15+
|
16+
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
17+
18+
error: aborting due to 2 previous errors
1119

12-
For more information about this error, try `rustc --explain E0195`.
20+
Some errors have detailed explanations: E0195, E0605.
21+
For more information about an error, try `rustc --explain E0195`.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// compile-flags: --test
22

3-
use std::num::ParseIntError;
3+
use std::num::ParseFloatError;
44

55
#[test]
6-
fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> { //~ ERROR
6+
fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { //~ ERROR
77
"0".parse()
88
}

src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseIntError>`
1+
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseFloatError>`
22
--> $DIR/termination-trait-test-wrong-type.rs:6:1
33
|
4-
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> {
4+
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> {
55
LL | | "0".parse()
66
LL | | }
77
| |_^ `main` can only return types that implement `std::process::Termination`
88
|
9-
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseIntError>`
9+
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseFloatError>`
1010
= note: required by `test::assert_test_result`
1111

1212
error: aborting due to previous error

src/test/ui/structs/struct-base-wrong-type-2.rs

-19
This file was deleted.

src/test/ui/structs/struct-base-wrong-type-2.stderr

-21
This file was deleted.

0 commit comments

Comments
 (0)