Skip to content

Commit 1b194aa

Browse files
committed
Update existing UI tests
1 parent 05c1549 commit 1b194aa

8 files changed

+30
-55
lines changed

tests/ui/object-safety/assoc_const_bounds.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
#![feature(generic_consts)]
2+
#![allow(incomplete_features, dead_code)]
3+
4+
// FIXME(generic_consts): Is this the expected behavior? #110590 #112319
5+
// check-pass
6+
17
trait Foo<T> {
28
const BAR: bool
3-
where //~ ERROR: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
4-
Self: Sized;
9+
where
10+
Self: Sized;
511
}
612

713
trait Cake {}

tests/ui/object-safety/assoc_const_bounds.stderr

-15
This file was deleted.

tests/ui/object-safety/assoc_const_bounds_sized.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
#![feature(generic_consts)]
2+
#![allow(incomplete_features, dead_code)]
3+
4+
// FIXME(generic_consts): Is this the expected behavior? #110590 #112319
5+
// check-pass
6+
17
trait Foo {
28
const BAR: bool
3-
where //~ ERROR: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
4-
Self: Sized;
9+
where
10+
Self: Sized;
511
}
612

713
fn foo(_: &dyn Foo) {}

tests/ui/object-safety/assoc_const_bounds_sized.stderr

-15
This file was deleted.

tests/ui/parser/removed-syntax-static-fn.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ struct S;
33
impl S {
44
static fn f() {}
55
//~^ ERROR expected identifier, found keyword `fn`
6-
//~| ERROR expected one of `:`, `;`, or `=`
6+
//~| ERROR expected one of `:`, `;`, `<`, `=`, or `where`
77
//~| ERROR missing type for `static` item
8+
// FIXME(generic_consts): `<` and `where` now being in the list of expected tokens isn't great.
89
}
910

1011
fn main() {}

tests/ui/parser/removed-syntax-static-fn.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error: expected identifier, found keyword `fn`
44
LL | static fn f() {}
55
| ^^ expected identifier, found keyword
66

7-
error: expected one of `:`, `;`, or `=`, found `f`
7+
error: expected one of `:`, `;`, `<`, `=`, or `where`, found `f`
88
--> $DIR/removed-syntax-static-fn.rs:4:15
99
|
1010
LL | impl S {
1111
| - while parsing this item list starting here
1212
LL | static fn f() {}
13-
| ^ expected one of `:`, `;`, or `=`
13+
| ^ expected one of `:`, `;`, `<`, `=`, or `where`
1414
...
1515
LL | }
1616
| - the item list ends here

tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ trait ZstAssert: Sized {
33
const B: S = S { s: &() }; //~ ERROR missing lifetime specifier
44
const C: &'_ str = ""; //~ ERROR missing lifetime specifier
55
const D: T = T { a: &(), b: &() }; //~ ERROR missing lifetime specifier
6+
// FIXME(generic_consts): We should only suggest adding lifetime parameters to assoc consts if
7+
// the feature `generic_consts` is enabled. If it isn't, suggest adding it to the trait.
68
}
79

810
struct S<'a> {

tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr

+8-18
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ LL | const A: &str = "";
66
|
77
help: consider introducing a named lifetime parameter
88
|
9-
LL ~ trait ZstAssert<'a>: Sized {
10-
LL ~ const A: &'a str = "";
11-
|
9+
LL | const A<'a>: &'a str = "";
10+
| ++++ ++
1211

1312
error[E0106]: missing lifetime specifier
1413
--> $DIR/missing-lifetime-in-assoc-const-type.rs:3:14
@@ -18,10 +17,8 @@ LL | const B: S = S { s: &() };
1817
|
1918
help: consider introducing a named lifetime parameter
2019
|
21-
LL ~ trait ZstAssert<'a>: Sized {
22-
LL | const A: &str = "";
23-
LL ~ const B: S<'a> = S { s: &() };
24-
|
20+
LL | const B<'a>: S<'a> = S { s: &() };
21+
| ++++ ++++
2522

2623
error[E0106]: missing lifetime specifier
2724
--> $DIR/missing-lifetime-in-assoc-const-type.rs:4:15
@@ -31,11 +28,8 @@ LL | const C: &'_ str = "";
3128
|
3229
help: consider introducing a named lifetime parameter
3330
|
34-
LL ~ trait ZstAssert<'a>: Sized {
35-
LL | const A: &str = "";
36-
LL | const B: S = S { s: &() };
37-
LL ~ const C: &'a str = "";
38-
|
31+
LL | const C<'a>: &'a str = "";
32+
| ++++ ~~
3933

4034
error[E0106]: missing lifetime specifiers
4135
--> $DIR/missing-lifetime-in-assoc-const-type.rs:5:14
@@ -45,12 +39,8 @@ LL | const D: T = T { a: &(), b: &() };
4539
|
4640
help: consider introducing a named lifetime parameter
4741
|
48-
LL ~ trait ZstAssert<'a>: Sized {
49-
LL | const A: &str = "";
50-
LL | const B: S = S { s: &() };
51-
LL | const C: &'_ str = "";
52-
LL ~ const D: T<'a, 'a> = T { a: &(), b: &() };
53-
|
42+
LL | const D<'a>: T<'a, 'a> = T { a: &(), b: &() };
43+
| ++++ ++++++++
5444

5545
error: aborting due to 4 previous errors
5646

0 commit comments

Comments
 (0)