Skip to content

Commit 223aced

Browse files
committed
Fix tests
1 parent b6b2a42 commit 223aced

File tree

8 files changed

+21
-24
lines changed

8 files changed

+21
-24
lines changed

tests/ui/consts/const-try-feature-gate.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | Some(())?;
55
| ^^^^^^^^^
66
|
77
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
8-
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
8+
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
99
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
1010
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1111

@@ -27,7 +27,7 @@ LL | Some(())?;
2727
| ^^^^^^^^^
2828
|
2929
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
30-
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
30+
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
3131
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
3232
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3333

tests/ui/consts/const-try.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//@ run-pass
2-
//@ compile-flags: -Znext-solver
1+
//@ check-pass
32

43
// Demonstrates what's needed to make use of `?` in const contexts.
54

@@ -14,14 +13,12 @@ struct TryMe;
1413
struct Error;
1514

1615
impl const FromResidual<Error> for TryMe {
17-
//~^ ERROR const `impl` for trait `FromResidual` which is not `const`
1816
fn from_residual(residual: Error) -> Self {
1917
TryMe
2018
}
2119
}
2220

2321
impl const Try for TryMe {
24-
//~^ ERROR const `impl` for trait `Try` which is not `const`
2522
type Output = ();
2623
type Residual = Error;
2724
fn from_output(output: Self::Output) -> Self {
@@ -34,8 +31,6 @@ impl const Try for TryMe {
3431

3532
const fn t() -> TryMe {
3633
TryMe?;
37-
//~^ ERROR `?` is not allowed on
38-
//~| ERROR `?` is not allowed on
3934
TryMe
4035
}
4136

tests/ui/consts/const-try.stderr

Whitespace-only changes.

tests/ui/consts/control-flow/try.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ run-pass
1+
//@ check-pass
22

33
#![allow(dead_code)]
44
#![feature(const_trait_impl)]

tests/ui/specialization/issue-111232.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ impl<T> From<T> for T {
1111

1212
struct S;
1313

14-
impl From<S> for S { //~ ERROR conflicting implementations of trait `From<S>` for type `S`
15-
fn from(s: S) -> S {
14+
impl From<S> for S {
15+
fn from(s: S) -> S { //~ ERROR `from` specializes an item from a parent `impl`, but that item is not marked `default`
1616
s
1717
}
1818
}
1919

20+
2021
fn main() {}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
error[E0119]: conflicting implementations of trait `From<S>` for type `S`
2-
--> $DIR/issue-111232.rs:5:1
1+
error[E0520]: `from` specializes an item from a parent `impl`, but that item is not marked `default`
2+
--> $DIR/issue-111232.rs:15:5
33
|
4-
LL | impl From<S> for S {
5-
| ^^^^^^^^^^^^^^^^^^
4+
LL | impl<T> From<T> for T {
5+
| --------------------- parent `impl` is here
6+
...
7+
LL | fn from(s: S) -> S {
8+
| ^^^^^^^^^^^^^^^^^^ cannot specialize default item `from`
69
|
7-
= note: conflicting implementation in crate `core`:
8-
- impl<T> From<T> for T;
10+
= note: to specialize, `from` in the parent `impl` must be marked `default`
911

1012
error: aborting due to 1 previous error
1113

12-
For more information about this error, try `rustc --explain E0119`.
14+
For more information about this error, try `rustc --explain E0520`.

tests/ui/traits/const-traits/const-from.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// tests/const_conversion_tests.rs
21
#![feature(const_trait_impl,f16, f128)]
32
#![feature(ascii_char, ascii_char_variants)]
43

tests/ui/traits/const-traits/const-from.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0277]: the trait bound `String: const From<&str>` is not satisfied
2-
--> $DIR/const-from.rs:29:18
2+
--> $DIR/const-from.rs:28:18
33
|
44
LL | let mut st = String::from("world");
55
| ^^^^^^
66

77
error[E0599]: the method `as_ref` exists for reference `&u8`, but its trait bounds were not satisfied
8-
--> $DIR/const-from.rs:34:25
8+
--> $DIR/const-from.rs:33:25
99
|
1010
LL | let _: &u8 = x.as_ref();
1111
| ^^^^^^ method cannot be called on `&u8` due to unsatisfied trait bounds
@@ -15,7 +15,7 @@ LL | let _: &u8 = x.as_ref();
1515
which is required by `&u8: AsRef<_>`
1616

1717
error[E0599]: the method `as_mut` exists for mutable reference `&mut u8`, but its trait bounds were not satisfied
18-
--> $DIR/const-from.rs:38:26
18+
--> $DIR/const-from.rs:37:26
1919
|
2020
LL | let _: &mut u8 = ym.as_mut();
2121
| ^^^^^^ method cannot be called on `&mut u8` due to unsatisfied trait bounds
@@ -25,13 +25,13 @@ LL | let _: &mut u8 = ym.as_mut();
2525
which is required by `&mut u8: AsMut<_>`
2626

2727
error[E0277]: the trait bound `[u8; 3]: const AsRef<[u8]>` is not satisfied
28-
--> $DIR/const-from.rs:42:24
28+
--> $DIR/const-from.rs:41:24
2929
|
3030
LL | let _: &[u8] = arr.as_ref();
3131
| ^^^^^^
3232

3333
error[E0277]: the trait bound `[u8; 3]: const AsMut<[u8]>` is not satisfied
34-
--> $DIR/const-from.rs:45:29
34+
--> $DIR/const-from.rs:44:29
3535
|
3636
LL | let _: &mut [u8] = arr2.as_mut();
3737
| ^^^^^^

0 commit comments

Comments
 (0)