Skip to content

Add some regression tests #72492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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; }
Expand Down
Original file line number Diff line number Diff line change
@@ -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>;
| ^^^^^^^^^^
Expand All @@ -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>;
| ^^^^^^^^^^^^^
Expand All @@ -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>> {
| ^^^^^^^^
Expand All @@ -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>> {
| ^^^^^^^^
Expand All @@ -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>> {
| ^^^^^^^^
Expand All @@ -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;
| ^^^^^^^^^^
Expand All @@ -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>) {}
| ^^^^^^^^^
Expand All @@ -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>) {}
| ^^^^^^^^^
Expand All @@ -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 }
| ^^^^^^^^^
Expand All @@ -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) }
| ^^^^^^^^^
Expand All @@ -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;
| ^^^^^^^^^
Expand All @@ -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;
| ^^^^^^^^^
Expand All @@ -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;
| ^^^^^^^^^
Expand All @@ -116,23 +116,23 @@ 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;
| ^^^^^^^^^^^^^^^^^^^
|
= 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;
| ^^^^^^^^^^^^^^^^^^^
|
= 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;
| ^^^^^^^^^^^^^^^^^^^
Expand Down
27 changes: 27 additions & 0 deletions src/test/ui/issues/issue-72455.rs
Original file line number Diff line number Diff line change
@@ -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() {}