Skip to content

Commit e91897d

Browse files
authored
Rollup merge of #72492 - JohnTitor:add-tests, r=matthewjasper
Add some regression tests Closes #69415 Closes #72455 r? @matthewjasper
2 parents 67759b7 + 47e35cb commit e91897d

File tree

3 files changed

+46
-16
lines changed

3 files changed

+46
-16
lines changed

src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// compile-flags: -Zsave-analysis
2+
// This is also a regression test for #69415 and the above flag is needed.
3+
14
#![feature(untagged_unions)]
25

36
trait Tr1 { type As1: Copy; }

src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: associated type bounds are unstable
2-
--> $DIR/feature-gate-associated_type_bounds.rs:12:22
2+
--> $DIR/feature-gate-associated_type_bounds.rs:15:22
33
|
44
LL | type A: Iterator<Item: Copy>;
55
| ^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | type A: Iterator<Item: Copy>;
88
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
99

1010
error[E0658]: associated type bounds are unstable
11-
--> $DIR/feature-gate-associated_type_bounds.rs:15:22
11+
--> $DIR/feature-gate-associated_type_bounds.rs:18:22
1212
|
1313
LL | type B: Iterator<Item: 'static>;
1414
| ^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL | type B: Iterator<Item: 'static>;
1717
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
1818

1919
error[E0658]: associated type bounds are unstable
20-
--> $DIR/feature-gate-associated_type_bounds.rs:19:20
20+
--> $DIR/feature-gate-associated_type_bounds.rs:22:20
2121
|
2222
LL | struct _St1<T: Tr1<As1: Tr2>> {
2323
| ^^^^^^^^
@@ -26,7 +26,7 @@ LL | struct _St1<T: Tr1<As1: Tr2>> {
2626
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
2727

2828
error[E0658]: associated type bounds are unstable
29-
--> $DIR/feature-gate-associated_type_bounds.rs:26:18
29+
--> $DIR/feature-gate-associated_type_bounds.rs:29:18
3030
|
3131
LL | enum _En1<T: Tr1<As1: Tr2>> {
3232
| ^^^^^^^^
@@ -35,7 +35,7 @@ LL | enum _En1<T: Tr1<As1: Tr2>> {
3535
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
3636

3737
error[E0658]: associated type bounds are unstable
38-
--> $DIR/feature-gate-associated_type_bounds.rs:33:19
38+
--> $DIR/feature-gate-associated_type_bounds.rs:36:19
3939
|
4040
LL | union _Un1<T: Tr1<As1: Tr2>> {
4141
| ^^^^^^^^
@@ -44,7 +44,7 @@ LL | union _Un1<T: Tr1<As1: Tr2>> {
4444
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
4545

4646
error[E0658]: associated type bounds are unstable
47-
--> $DIR/feature-gate-associated_type_bounds.rs:40:37
47+
--> $DIR/feature-gate-associated_type_bounds.rs:43:37
4848
|
4949
LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
5050
| ^^^^^^^^^^
@@ -53,7 +53,7 @@ LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
5353
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
5454

5555
error[E0658]: associated type bounds are unstable
56-
--> $DIR/feature-gate-associated_type_bounds.rs:43:22
56+
--> $DIR/feature-gate-associated_type_bounds.rs:46:22
5757
|
5858
LL | fn _apit(_: impl Tr1<As1: Copy>) {}
5959
| ^^^^^^^^^
@@ -62,7 +62,7 @@ LL | fn _apit(_: impl Tr1<As1: Copy>) {}
6262
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
6363

6464
error[E0658]: associated type bounds are unstable
65-
--> $DIR/feature-gate-associated_type_bounds.rs:45:26
65+
--> $DIR/feature-gate-associated_type_bounds.rs:48:26
6666
|
6767
LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
6868
| ^^^^^^^^^
@@ -71,7 +71,7 @@ LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
7171
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
7272

7373
error[E0658]: associated type bounds are unstable
74-
--> $DIR/feature-gate-associated_type_bounds.rs:48:24
74+
--> $DIR/feature-gate-associated_type_bounds.rs:51:24
7575
|
7676
LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
7777
| ^^^^^^^^^
@@ -80,7 +80,7 @@ LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
8080
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
8181

8282
error[E0658]: associated type bounds are unstable
83-
--> $DIR/feature-gate-associated_type_bounds.rs:51:31
83+
--> $DIR/feature-gate-associated_type_bounds.rs:54:31
8484
|
8585
LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
8686
| ^^^^^^^^^
@@ -89,7 +89,7 @@ LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
8989
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
9090

9191
error[E0658]: associated type bounds are unstable
92-
--> $DIR/feature-gate-associated_type_bounds.rs:54:23
92+
--> $DIR/feature-gate-associated_type_bounds.rs:57:23
9393
|
9494
LL | const _cdef: impl Tr1<As1: Copy> = S1;
9595
| ^^^^^^^^^
@@ -98,7 +98,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
9898
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
9999

100100
error[E0658]: associated type bounds are unstable
101-
--> $DIR/feature-gate-associated_type_bounds.rs:60:24
101+
--> $DIR/feature-gate-associated_type_bounds.rs:63:24
102102
|
103103
LL | static _sdef: impl Tr1<As1: Copy> = S1;
104104
| ^^^^^^^^^
@@ -107,7 +107,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
107107
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
108108

109109
error[E0658]: associated type bounds are unstable
110-
--> $DIR/feature-gate-associated_type_bounds.rs:67:21
110+
--> $DIR/feature-gate-associated_type_bounds.rs:70:21
111111
|
112112
LL | let _: impl Tr1<As1: Copy> = S1;
113113
| ^^^^^^^^^
@@ -116,23 +116,23 @@ LL | let _: impl Tr1<As1: Copy> = S1;
116116
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
117117

118118
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
119-
--> $DIR/feature-gate-associated_type_bounds.rs:54:14
119+
--> $DIR/feature-gate-associated_type_bounds.rs:57:14
120120
|
121121
LL | const _cdef: impl Tr1<As1: Copy> = S1;
122122
| ^^^^^^^^^^^^^^^^^^^
123123
|
124124
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
125125

126126
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
127-
--> $DIR/feature-gate-associated_type_bounds.rs:60:15
127+
--> $DIR/feature-gate-associated_type_bounds.rs:63:15
128128
|
129129
LL | static _sdef: impl Tr1<As1: Copy> = S1;
130130
| ^^^^^^^^^^^^^^^^^^^
131131
|
132132
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
133133

134134
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
135-
--> $DIR/feature-gate-associated_type_bounds.rs:67:12
135+
--> $DIR/feature-gate-associated_type_bounds.rs:70:12
136136
|
137137
LL | let _: impl Tr1<As1: Copy> = S1;
138138
| ^^^^^^^^^^^^^^^^^^^

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

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// check-pass
2+
3+
pub trait ResultExt {
4+
type Ok;
5+
fn err_eprint_and_ignore(self) -> Option<Self::Ok>;
6+
}
7+
8+
impl<O, E> ResultExt for std::result::Result<O, E>
9+
where
10+
E: std::error::Error,
11+
{
12+
type Ok = O;
13+
fn err_eprint_and_ignore(self) -> Option<O>
14+
where
15+
Self: ,
16+
{
17+
match self {
18+
Err(e) => {
19+
eprintln!("{}", e);
20+
None
21+
}
22+
Ok(o) => Some(o),
23+
}
24+
}
25+
}
26+
27+
fn main() {}

0 commit comments

Comments
 (0)