Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Jan 20, 2020
1 parent 0ac4ba0 commit 23ea42c
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 94 deletions.
@@ -1,8 +1,8 @@
error: `?const` on trait bounds is not yet implemented
--> $DIR/feature-gate.rs:11:29
error: fatal error triggered by #[rustc_error]
--> $DIR/feature-gate.rs:16:1
|
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
| ^^^^^^^^
LL | fn main() {}
| ^^^^^^^^^^^^

error: aborting due to previous error

Expand Up @@ -3,13 +3,14 @@

#![cfg_attr(gated, feature(const_trait_bound_opt_out))]
#![allow(incomplete_features)]
#![feature(rustc_attrs)]

trait T {
const CONST: i32;
}

const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
//[stock]~^ ERROR `?const` on trait bounds is experimental
//[stock,gated]~^^ ERROR `?const` on trait bounds is not yet implemented

fn main() {}
#[rustc_error]
fn main() {} //[gated]~ ERROR fatal error triggered by #[rustc_error]
@@ -1,18 +1,12 @@
error[E0658]: `?const` on trait bounds is experimental
--> $DIR/feature-gate.rs:11:29
--> $DIR/feature-gate.rs:12:29
|
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
| ^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/67794
= help: add `#![feature(const_trait_bound_opt_out)]` to the crate attributes to enable

error: `?const` on trait bounds is not yet implemented
--> $DIR/feature-gate.rs:11:29
|
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
| ^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
Expand Up @@ -8,18 +8,14 @@ impl T for S {}

fn rpit() -> impl ?const T { S }
//~^ ERROR `?const` is not permitted in `impl Trait`
//~| ERROR `?const` on trait bounds is not yet implemented

fn apit(_: impl ?const T) {}
//~^ ERROR `?const` is not permitted in `impl Trait`
//~| ERROR `?const` on trait bounds is not yet implemented

fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
//~^ ERROR `?const` is not permitted in `impl Trait`
//~| ERROR `?const` on trait bounds is not yet implemented

fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
//~^ ERROR `?const` is not permitted in `impl Trait`
//~| ERROR `?const` on trait bounds is not yet implemented

fn main() {}
Expand Up @@ -5,46 +5,22 @@ LL | fn rpit() -> impl ?const T { S }
| ^^^^^^^^

error: `?const` is not permitted in `impl Trait`
--> $DIR/in-impl-trait.rs:13:17
--> $DIR/in-impl-trait.rs:12:17
|
LL | fn apit(_: impl ?const T) {}
| ^^^^^^^^

error: `?const` is not permitted in `impl Trait`
--> $DIR/in-impl-trait.rs:17:50
--> $DIR/in-impl-trait.rs:15:50
|
LL | fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
| ^^^^^^^^

error: `?const` is not permitted in `impl Trait`
--> $DIR/in-impl-trait.rs:21:48
--> $DIR/in-impl-trait.rs:18:48
|
LL | fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-impl-trait.rs:9:19
|
LL | fn rpit() -> impl ?const T { S }
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-impl-trait.rs:13:17
|
LL | fn apit(_: impl ?const T) {}
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-impl-trait.rs:17:50
|
LL | fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-impl-trait.rs:21:48
|
LL | fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
| ^^^^^^^^

error: aborting due to 8 previous errors
error: aborting due to 4 previous errors

Expand Up @@ -4,6 +4,5 @@
trait Super {}
trait T: ?const Super {}
//~^ ERROR `?const` is not permitted in supertraits
//~| ERROR `?const` on trait bounds is not yet implemented

fn main() {}
Expand Up @@ -4,11 +4,5 @@ error: `?const` is not permitted in supertraits
LL | trait T: ?const Super {}
| ^^^^^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-trait-bounds.rs:5:10
|
LL | trait T: ?const Super {}
| ^^^^^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

Expand Up @@ -9,14 +9,11 @@ impl T for S {}
// An inherent impl for the trait object `?const T`.
impl ?const T {}
//~^ ERROR `?const` is not permitted in trait objects
//~| ERROR `?const` on trait bounds is not yet implemented

fn trait_object() -> &'static dyn ?const T { &S }
//~^ ERROR `?const` is not permitted in trait objects
//~| ERROR `?const` on trait bounds is not yet implemented

fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
//~^ ERROR `?const` is not permitted in trait objects
//~| ERROR `?const` on trait bounds is not yet implemented

fn main() {}
Expand Up @@ -5,34 +5,16 @@ LL | impl ?const T {}
| ^^^^^^^^

error: `?const` is not permitted in trait objects
--> $DIR/in-trait-object.rs:14:35
--> $DIR/in-trait-object.rs:13:35
|
LL | fn trait_object() -> &'static dyn ?const T { &S }
| ^^^^^^^^

error: `?const` is not permitted in trait objects
--> $DIR/in-trait-object.rs:18:61
--> $DIR/in-trait-object.rs:16:61
|
LL | fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-trait-object.rs:10:6
|
LL | impl ?const T {}
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-trait-object.rs:14:35
|
LL | fn trait_object() -> &'static dyn ?const T { &S }
| ^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/in-trait-object.rs:18:61
|
LL | fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
| ^^^^^^^^

error: aborting due to 6 previous errors
error: aborting due to 3 previous errors

Expand Up @@ -3,6 +3,5 @@

struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
//~^ ERROR `?const` and `?` are mutually exclusive
//~| ERROR `?const` on trait bounds is not yet implemented

fn main() {}
Expand Up @@ -4,11 +4,5 @@ error: `?const` and `?` are mutually exclusive
LL | struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^

error: `?const` on trait bounds is not yet implemented
--> $DIR/with-maybe-sized.rs:4:13
|
LL | struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

9 changes: 6 additions & 3 deletions src/test/ui/rfc-2632-const-trait-impl/inherent-impl.rs
@@ -1,5 +1,3 @@
// compile-flags: -Z parse-only

#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
Expand All @@ -8,7 +6,12 @@
struct S;
trait T {}

impl const S {}
//~^ ERROR inherent impls cannot be `const`
//~| ERROR const trait impls are not yet implemented

impl const T {}
//~^ ERROR `const` cannot modify an inherent impl
//~^ ERROR inherent impls cannot be `const`
//~| ERROR const trait impls are not yet implemented

fn main() {}
30 changes: 25 additions & 5 deletions src/test/ui/rfc-2632-const-trait-impl/inherent-impl.stderr
@@ -1,10 +1,30 @@
error: `const` cannot modify an inherent impl
--> $DIR/inherent-impl.rs:11:6
error: inherent impls cannot be `const`
--> $DIR/inherent-impl.rs:9:1
|
LL | impl const S {}
| ^^^^^^^^^^^^^^^
|
= note: only trait implementations may be annotated with `const`

error: inherent impls cannot be `const`
--> $DIR/inherent-impl.rs:13:1
|
LL | impl const T {}
| ^^^^^
| ^^^^^^^^^^^^^^^
|
= note: only trait implementations may be annotated with `const`

error: const trait impls are not yet implemented
--> $DIR/inherent-impl.rs:9:1
|
LL | impl const S {}
| ^^^^^^^^^^^^^^^

error: const trait impls are not yet implemented
--> $DIR/inherent-impl.rs:13:1
|
= help: only a trait impl can be `const`
LL | impl const T {}
| ^^^^^^^^^^^^^^^

error: aborting due to previous error
error: aborting due to 4 previous errors

0 comments on commit 23ea42c

Please sign in to comment.