Skip to content

Commit 286cb14

Browse files
authored
Rollup merge of rust-lang#67543 - JohnTitor:regression-tests, r=Dylan-DPC
Add regression tests for fixed ICEs Closes rust-lang#61747 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66205 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66270 (fixed by rust-lang#66246) Closes rust-lang#66868 (fixed by rust-lang#67071) Closes rust-lang#67424 (fixed by rust-lang#67160) Also picking a minor nit up from rust-lang#67071 with 101dd7b r? @Centril
2 parents 05c3295 + ac05c84 commit 286cb14

11 files changed

+152
-1
lines changed

src/librustc/traits/error_reporting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
23732373
let span = self.tcx.def_span(generator_did);
23742374

23752375
// Do not ICE on closure typeck (#66868).
2376-
if let None = self.tcx.hir().as_local_hir_id(generator_did) {
2376+
if self.tcx.hir().as_local_hir_id(generator_did).is_none() {
23772377
return false;
23782378
}
23792379

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+
struct Const<const N: usize>;
7+
8+
impl<const C: usize> Const<{C}> {
9+
fn successor() -> Const<{C + 1}> {
10+
Const
11+
}
12+
}
13+
14+
fn main() {
15+
let _x: Const::<2> = Const::<1>::successor();
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/issue-61747.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
#![allow(incomplete_features, dead_code, unconditional_recursion)]
4+
#![feature(const_generics)]
5+
6+
fn fact<const N: usize>() {
7+
fact::<{ N - 1 }>();
8+
}
9+
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Fixed by #67160
2+
3+
trait Trait1 {
4+
type A;
5+
}
6+
7+
trait Trait2 {
8+
type Type1<B>: Trait1<A=B>;
9+
//~^ ERROR: generic associated types are unstable
10+
//~| ERROR: type-generic associated types are not yet implemented
11+
}
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0658]: generic associated types are unstable
2+
--> $DIR/issue-67424.rs:8:5
3+
|
4+
LL | type Type1<B>: Trait1<A=B>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: for more information, see https://github.com/rust-lang/rust/issues/44265
8+
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
9+
10+
error: type-generic associated types are not yet implemented
11+
--> $DIR/issue-67424.rs:8:5
12+
|
13+
LL | type Type1<B>: Trait1<A=B>;
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: for more information, see https://github.com/rust-lang/rust/issues/44265
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0658`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Regression test for #66270, fixed by #66246
2+
3+
struct Bug {
4+
incorrect_field: 0,
5+
//~^ ERROR expected type
6+
}
7+
8+
struct Empty {}
9+
10+
fn main() {
11+
let Bug {
12+
any_field: Empty {},
13+
} = Bug {};
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected type, found `0`
2+
--> $DIR/issue-66270-pat-struct-parser-recovery.rs:4:22
3+
|
4+
LL | incorrect_field: 0,
5+
| ^ expected type
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// edition:2018
2+
3+
#![crate_type = "lib"]
4+
5+
use std::{
6+
future::Future,
7+
pin::Pin,
8+
sync::RwLock,
9+
task::{Context, Poll},
10+
};
11+
12+
struct S {}
13+
14+
impl Future for S {
15+
type Output = ();
16+
fn poll(self: Pin<&mut Self>, _: &mut Context) -> Poll<Self::Output> {
17+
Poll::Pending
18+
}
19+
}
20+
21+
pub async fn f() {
22+
let fo = RwLock::new(S {});
23+
24+
(&mut *fo.write().unwrap()).await;
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Fixed by #67071
2+
// aux-build: issue_66868_closure_typeck.rs
3+
// edition:2018
4+
5+
extern crate issue_66868_closure_typeck;
6+
7+
pub fn g<T>(task: T)
8+
where
9+
T: Send,
10+
{
11+
}
12+
13+
fn main() {
14+
g(issue_66868_closure_typeck::f()); //~ ERROR: cannot be sent between threads safely
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0277]: `std::sync::RwLockWriteGuard<'_, issue_66868_closure_typeck::S>` cannot be sent between threads safely
2+
--> $DIR/issue-66868-closure-typeck.rs:14:5
3+
|
4+
LL | pub fn g<T>(task: T)
5+
| -
6+
LL | where
7+
LL | T: Send,
8+
| ---- required by this bound in `g`
9+
...
10+
LL | g(issue_66868_closure_typeck::f());
11+
| ^ `std::sync::RwLockWriteGuard<'_, issue_66868_closure_typeck::S>` cannot be sent between threads safely
12+
|
13+
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::RwLockWriteGuard<'_, issue_66868_closure_typeck::S>`
14+
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {std::sync::RwLock<issue_66868_closure_typeck::S>, &'r std::sync::RwLock<issue_66868_closure_typeck::S>, std::sync::RwLock<issue_66868_closure_typeck::S>, std::result::Result<std::sync::RwLockWriteGuard<'s, issue_66868_closure_typeck::S>, std::sync::PoisonError<std::sync::RwLockWriteGuard<'t0, issue_66868_closure_typeck::S>>>, &'t1 mut std::sync::RwLockWriteGuard<'t2, issue_66868_closure_typeck::S>, std::sync::RwLockWriteGuard<'t3, issue_66868_closure_typeck::S>, issue_66868_closure_typeck::S, &'t4 mut issue_66868_closure_typeck::S, &'t5 mut issue_66868_closure_typeck::S, ()}`
15+
= note: required because it appears within the type `[static generator@DefId(15:16 ~ issue_66868_closure_typeck[8787]::f[0]::{{closure}}[0]) for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {std::sync::RwLock<issue_66868_closure_typeck::S>, &'r std::sync::RwLock<issue_66868_closure_typeck::S>, std::sync::RwLock<issue_66868_closure_typeck::S>, std::result::Result<std::sync::RwLockWriteGuard<'s, issue_66868_closure_typeck::S>, std::sync::PoisonError<std::sync::RwLockWriteGuard<'t0, issue_66868_closure_typeck::S>>>, &'t1 mut std::sync::RwLockWriteGuard<'t2, issue_66868_closure_typeck::S>, std::sync::RwLockWriteGuard<'t3, issue_66868_closure_typeck::S>, issue_66868_closure_typeck::S, &'t4 mut issue_66868_closure_typeck::S, &'t5 mut issue_66868_closure_typeck::S, ()}]`
16+
= note: required because it appears within the type `std::future::GenFuture<[static generator@DefId(15:16 ~ issue_66868_closure_typeck[8787]::f[0]::{{closure}}[0]) for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {std::sync::RwLock<issue_66868_closure_typeck::S>, &'r std::sync::RwLock<issue_66868_closure_typeck::S>, std::sync::RwLock<issue_66868_closure_typeck::S>, std::result::Result<std::sync::RwLockWriteGuard<'s, issue_66868_closure_typeck::S>, std::sync::PoisonError<std::sync::RwLockWriteGuard<'t0, issue_66868_closure_typeck::S>>>, &'t1 mut std::sync::RwLockWriteGuard<'t2, issue_66868_closure_typeck::S>, std::sync::RwLockWriteGuard<'t3, issue_66868_closure_typeck::S>, issue_66868_closure_typeck::S, &'t4 mut issue_66868_closure_typeck::S, &'t5 mut issue_66868_closure_typeck::S, ()}]>`
17+
= note: required because it appears within the type `impl std::future::Future`
18+
= note: required because it appears within the type `impl std::future::Future`
19+
20+
error: aborting due to previous error
21+
22+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)