Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 703c557

Browse files
committed
Fix more tests
1 parent ff24ac4 commit 703c557

20 files changed

+103
-50
lines changed

compiler/rustc_typeck/src/astconv/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
927927
self.instantiate_poly_trait_ref(
928928
&b.trait_ref,
929929
b.span,
930-
constness,
930+
Constness::NotConst,
931931
param_ty,
932932
bounds,
933933
false,
@@ -937,7 +937,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
937937
self.instantiate_poly_trait_ref(
938938
&b.trait_ref,
939939
b.span,
940-
Constness::NotConst,
940+
constness,
941941
param_ty,
942942
bounds,
943943
false,

src/test/ui/consts/const-eval/issue-49296.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/issue-49296.rs:20:16
2+
--> $DIR/issue-49296.rs:11:16
33
|
44
LL | const X: u64 = *wat(42);
55
| ^^^^^^^^ pointer to alloc2 was dereferenced after this allocation got freed

src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized`
44
LL | type Assoc = OnlySized<<T as Foo>::Item>;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
note: required by a bound in `Foo::Item`
8-
--> $DIR/projection-bound-cycle-generic.rs:11:49
7+
note: required by a bound in `OnlySized`
8+
--> $DIR/projection-bound-cycle-generic.rs:28:18
99
|
10-
LL | type Item: Sized where <Self as Foo>::Item: Sized;
11-
| ^^^^^ required by this bound in `Foo::Item`
10+
LL | struct OnlySized<T> where T: Sized { f: T }
11+
| ^ required by this bound in `OnlySized`
1212

1313
error: aborting due to previous error
1414

src/test/ui/generic-associated-types/projection-bound-cycle.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized`
44
LL | type Assoc = OnlySized<<T as Foo>::Item>;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
note: required by a bound in `Foo::Item`
8-
--> $DIR/projection-bound-cycle.rs:13:49
7+
note: required by a bound in `OnlySized`
8+
--> $DIR/projection-bound-cycle.rs:30:18
99
|
10-
LL | type Item: Sized where <Self as Foo>::Item: Sized;
11-
| ^^^^^ required by this bound in `Foo::Item`
10+
LL | struct OnlySized<T> where T: Sized { f: T }
11+
| ^ required by this bound in `OnlySized`
1212

1313
error: aborting due to previous error
1414

src/test/ui/parser/bounds-type.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ struct S<
99
T: Tr +, // OK
1010
T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds
1111

12-
T: ?const Tr, // OK
13-
T: ?const ?Tr, // OK
14-
T: ?const Tr + 'a, // OK
15-
T: ?const 'a, //~ ERROR `?const` may only modify trait bounds, not lifetime bounds
12+
T: ~const Tr, // OK
13+
T: ~const ?Tr, // OK
14+
T: ~const Tr + 'a, // OK
15+
T: ~const 'a, //~ ERROR `~const` may only modify trait bounds, not lifetime bounds
1616
>;
1717

1818
fn main() {}

src/test/ui/parser/bounds-type.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ error: `?` may only modify trait bounds, not lifetime bounds
44
LL | T: ?'a,
55
| ^
66

7-
error: `?const` may only modify trait bounds, not lifetime bounds
7+
error: `~const` may only modify trait bounds, not lifetime bounds
88
--> $DIR/bounds-type.rs:15:8
99
|
10-
LL | T: ?const 'a,
10+
LL | T: ~const 'a,
1111
| ^^^^^^
1212

1313
error: aborting due to 2 previous errors

src/test/ui/parser/trait-object-delimiters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn foo1(_: &dyn Drop + AsRef<str>) {} //~ ERROR ambiguous `+` in a type
66
fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds
77

88
fn foo3(_: &dyn {Drop + AsRef<str>}) {} //~ ERROR expected parameter name, found `{`
9-
//~^ ERROR expected one of `!`, `(`, `)`, `,`, `?`, `for`, lifetime, or path, found `{`
9+
//~^ ERROR expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
1010
//~| ERROR at least one trait is required for an object type
1111

1212
fn foo4(_: &dyn <Drop + AsRef<str>>) {} //~ ERROR expected identifier, found `<`

src/test/ui/parser/trait-object-delimiters.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ error: expected parameter name, found `{`
2222
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
2323
| ^ expected parameter name
2424

25-
error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, lifetime, or path, found `{`
25+
error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
2626
--> $DIR/trait-object-delimiters.rs:8:17
2727
|
2828
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
29-
| -^ expected one of 8 possible tokens
29+
| -^ expected one of 9 possible tokens
3030
| |
3131
| help: missing `,`
3232

src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// FIXME(fee1-dead): this should have a better error message
22
#![feature(const_trait_impl)]
3-
#![feature(const_trait_bound_opt_out)]
4-
#![allow(incomplete_features)]
53

64
struct NonConstAdd(i32);
75

@@ -14,7 +12,7 @@ impl std::ops::Add for NonConstAdd {
1412
}
1513

1614
trait Foo {
17-
type Bar: std::ops::Add;
15+
type Bar: ~const std::ops::Add;
1816
}
1917

2018
impl const Foo for NonConstAdd {
@@ -23,7 +21,7 @@ impl const Foo for NonConstAdd {
2321
}
2422

2523
trait Baz {
26-
type Qux: ?const std::ops::Add;
24+
type Qux: std::ops::Add;
2725
}
2826

2927
impl const Baz for NonConstAdd {

src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error[E0277]: cannot add `NonConstAdd` to `NonConstAdd`
2-
--> $DIR/assoc-type.rs:21:5
2+
--> $DIR/assoc-type.rs:19:5
33
|
44
LL | type Bar = NonConstAdd;
55
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `NonConstAdd + NonConstAdd`
66
|
77
= help: the trait `Add` is not implemented for `NonConstAdd`
88
note: required by a bound in `Foo::Bar`
9-
--> $DIR/assoc-type.rs:17:15
9+
--> $DIR/assoc-type.rs:15:15
1010
|
11-
LL | type Bar: std::ops::Add;
12-
| ^^^^^^^^^^^^^ required by this bound in `Foo::Bar`
11+
LL | type Bar: ~const std::ops::Add;
12+
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::Bar`
1313
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
1414
|
1515
LL | impl const Foo for NonConstAdd where NonConstAdd: Add {

0 commit comments

Comments
 (0)