Rollup merge of #72492 - JohnTitor:add-tests, r=matthewjasper

Add some regression tests

Closes #69415
Closes #72455

r? @matthewjasper
This commit is contained in:
Dylan DPC 2020-05-23 19:10:01 +02:00 committed by GitHub
commit e91897d214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 16 deletions

View File

@ -1,3 +1,6 @@
// compile-flags: -Zsave-analysis
// This is also a regression test for #69415 and the above flag is needed.
#![feature(untagged_unions)]
trait Tr1 { type As1: Copy; }

View File

@ -1,5 +1,5 @@
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:12:22
--> $DIR/feature-gate-associated_type_bounds.rs:15:22
|
LL | type A: Iterator<Item: Copy>;
| ^^^^^^^^^^
@ -8,7 +8,7 @@ LL | type A: Iterator<Item: Copy>;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:15:22
--> $DIR/feature-gate-associated_type_bounds.rs:18:22
|
LL | type B: Iterator<Item: 'static>;
| ^^^^^^^^^^^^^
@ -17,7 +17,7 @@ LL | type B: Iterator<Item: 'static>;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:19:20
--> $DIR/feature-gate-associated_type_bounds.rs:22:20
|
LL | struct _St1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^
@ -26,7 +26,7 @@ LL | struct _St1<T: Tr1<As1: Tr2>> {
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:26:18
--> $DIR/feature-gate-associated_type_bounds.rs:29:18
|
LL | enum _En1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^
@ -35,7 +35,7 @@ LL | enum _En1<T: Tr1<As1: Tr2>> {
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:33:19
--> $DIR/feature-gate-associated_type_bounds.rs:36:19
|
LL | union _Un1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^
@ -44,7 +44,7 @@ LL | union _Un1<T: Tr1<As1: Tr2>> {
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:40:37
--> $DIR/feature-gate-associated_type_bounds.rs:43:37
|
LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
| ^^^^^^^^^^
@ -53,7 +53,7 @@ LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:43:22
--> $DIR/feature-gate-associated_type_bounds.rs:46:22
|
LL | fn _apit(_: impl Tr1<As1: Copy>) {}
| ^^^^^^^^^
@ -62,7 +62,7 @@ LL | fn _apit(_: impl Tr1<As1: Copy>) {}
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:45:26
--> $DIR/feature-gate-associated_type_bounds.rs:48:26
|
LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
| ^^^^^^^^^
@ -71,7 +71,7 @@ LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:48:24
--> $DIR/feature-gate-associated_type_bounds.rs:51:24
|
LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
| ^^^^^^^^^
@ -80,7 +80,7 @@ LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:51:31
--> $DIR/feature-gate-associated_type_bounds.rs:54:31
|
LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
| ^^^^^^^^^
@ -89,7 +89,7 @@ LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:54:23
--> $DIR/feature-gate-associated_type_bounds.rs:57:23
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^
@ -98,7 +98,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:60:24
--> $DIR/feature-gate-associated_type_bounds.rs:63:24
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^
@ -107,7 +107,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:67:21
--> $DIR/feature-gate-associated_type_bounds.rs:70:21
|
LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^
@ -116,7 +116,7 @@ LL | let _: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-associated_type_bounds.rs:54:14
--> $DIR/feature-gate-associated_type_bounds.rs:57:14
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
@ -124,7 +124,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-associated_type_bounds.rs:60:15
--> $DIR/feature-gate-associated_type_bounds.rs:63:15
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
@ -132,7 +132,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-associated_type_bounds.rs:67:12
--> $DIR/feature-gate-associated_type_bounds.rs:70:12
|
LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^

View File

@ -0,0 +1,27 @@
// check-pass
pub trait ResultExt {
type Ok;
fn err_eprint_and_ignore(self) -> Option<Self::Ok>;
}
impl<O, E> ResultExt for std::result::Result<O, E>
where
E: std::error::Error,
{
type Ok = O;
fn err_eprint_and_ignore(self) -> Option<O>
where
Self: ,
{
match self {
Err(e) => {
eprintln!("{}", e);
None
}
Ok(o) => Some(o),
}
}
}
fn main() {}