Try fixing some tests

This commit is contained in:
Deadbeef 2021-08-25 14:30:09 +00:00
parent 1164c946b0
commit ff24ac4f2b
No known key found for this signature in database
GPG Key ID: 027DF9338862ADDD
27 changed files with 52 additions and 255 deletions

View File

@ -1,9 +1,7 @@
// check-pass
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![feature(const_fn_trait_bound)]
#![allow(incomplete_features)]
struct S;
@ -16,9 +14,9 @@ impl const PartialEq for S {
}
}
// This duplicate bound should not result in ambiguities. It should be equivalent to a single const
// This duplicate bound should not result in ambiguities. It should be equivalent to a single ~const
// bound.
const fn equals_self<T: PartialEq + ?const PartialEq>(t: &T) -> bool {
const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
*t == *t
}

View File

@ -1,9 +1,7 @@
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
pub const fn equals_self<T: ?const PartialEq>(t: &T) -> bool {
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t
//~^ ERROR calls in constant functions are limited to constant functions
}

View File

@ -1,9 +1,6 @@
// check-pass
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct S;

View File

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/feature-gate.rs:17:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -1,17 +0,0 @@
// revisions: stock gated
// gate-test-const_trait_bound_opt_out
#![cfg_attr(gated, feature(const_trait_bound_opt_out))]
#![allow(incomplete_features)]
#![feature(rustc_attrs)]
#![feature(const_fn_trait_bound)]
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
#[rustc_error]
fn main() {} //[gated]~ ERROR fatal error triggered by #[rustc_error]

View File

@ -1,12 +0,0 @@
error[E0658]: `?const` on trait bounds is experimental
--> $DIR/feature-gate.rs:13:29
|
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
| ^^^^^^
|
= note: see issue #67794 <https://github.com/rust-lang/rust/issues/67794> for more information
= help: add `#![feature(const_trait_bound_opt_out)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,21 +0,0 @@
#![feature(const_trait_bound_opt_out)]
#![feature(associated_type_bounds)]
#![allow(incomplete_features)]
trait T {}
struct S;
impl T for S {}
fn rpit() -> impl ?const T { S }
//~^ ERROR `?const` is not permitted in `impl Trait`
fn apit(_: impl ?const T) {}
//~^ ERROR `?const` is not permitted in `impl Trait`
fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
//~^ ERROR `?const` is not permitted in `impl Trait`
fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
//~^ ERROR `?const` is not permitted in `impl Trait`
fn main() {}

View File

@ -1,26 +0,0 @@
error: `?const` is not permitted in `impl Trait`
--> $DIR/in-impl-trait.rs:9:19
|
LL | fn rpit() -> impl ?const T { S }
| ^^^^^^^^
error: `?const` is not permitted in `impl Trait`
--> $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: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:18:48
|
LL | fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
| ^^^^^^^^
error: aborting due to 4 previous errors

View File

@ -1,8 +0,0 @@
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
trait Super {}
trait T: ?const Super {}
//~^ ERROR `?const` is not permitted in supertraits
fn main() {}

View File

@ -1,8 +0,0 @@
error: `?const` is not permitted in supertraits
--> $DIR/in-trait-bounds.rs:5:10
|
LL | trait T: ?const Super {}
| ^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,19 +0,0 @@
#![feature(const_trait_bound_opt_out)]
#![allow(bare_trait_objects)]
#![allow(incomplete_features)]
struct S;
trait T {}
impl T for S {}
// An inherent impl for the trait object `?const T`.
impl ?const T {}
//~^ ERROR `?const` is not permitted in trait objects
fn trait_object() -> &'static dyn ?const T { &S }
//~^ ERROR `?const` is not permitted in trait objects
fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
//~^ ERROR `?const` is not permitted in trait objects
fn main() {}

View File

@ -1,20 +0,0 @@
error: `?const` is not permitted in trait objects
--> $DIR/in-trait-object.rs:10:6
|
LL | impl ?const T {}
| ^^^^^^^^
error: `?const` is not permitted in trait objects
--> $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:16:61
|
LL | fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
| ^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,8 +0,0 @@
// compile-flags: -Z parse-only
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct S<T: ?const ?const Tr>;
//~^ ERROR expected identifier, found keyword `const`
//~| ERROR expected one of `(`, `+`, `,`, `::`, `<`, `=`, or `>`

View File

@ -1,14 +0,0 @@
error: expected identifier, found keyword `const`
--> $DIR/opt-out-twice.rs:6:21
|
LL | struct S<T: ?const ?const Tr>;
| ^^^^^ expected identifier, found keyword
error: expected one of `(`, `+`, `,`, `::`, `<`, `=`, or `>`, found `Tr`
--> $DIR/opt-out-twice.rs:6:27
|
LL | struct S<T: ?const ?const Tr>;
| ^^ expected one of 7 possible tokens
error: aborting due to 2 previous errors

View File

@ -1,10 +0,0 @@
// compile-flags: -Z parse-only
// check-pass
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct S<
T: ?const ?for<'a> Tr<'a> + 'static + ?const std::ops::Add,
T: ?const ?for<'a: 'b> m::Trait<'a>,
>;

View File

@ -1,7 +0,0 @@
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
//~^ ERROR `?const` and `?` are mutually exclusive
fn main() {}

View File

@ -1,8 +0,0 @@
error: `?const` and `?` are mutually exclusive
--> $DIR/with-maybe-sized.rs:4:13
|
LL | struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,7 +0,0 @@
// compile-flags: -Z parse-only
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct S<T: const Tr>;
//~^ ERROR expected one of `!`, `(`, `,`, `=`, `>`, `?`, `for`, lifetime, or path

View File

@ -1,8 +0,0 @@
error: expected one of `!`, `(`, `,`, `=`, `>`, `?`, `for`, lifetime, or path, found keyword `const`
--> $DIR/without-question-mark.rs:6:13
|
LL | struct S<T: const Tr>;
| ^^^^^ expected one of 9 possible tokens
error: aborting due to previous error

View File

@ -1,8 +0,0 @@
error: expected a trait, found type
--> $DIR/impl-opt-out-trait.rs:8:6
|
LL | impl ?const T for S {}
| ^^^^^^^^
error: aborting due to previous error

View File

@ -1,11 +1,9 @@
#![feature(const_trait_bound_opt_out)]
#![feature(const_trait_impl)]
#![allow(incomplete_features)]
struct S;
trait T {}
impl ?const T for S {}
impl ~const T for S {}
//~^ ERROR expected a trait, found type
fn main() {}

View File

@ -1,6 +1,4 @@
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
#![allow(bare_trait_objects)]
struct S;

View File

@ -5,4 +5,4 @@
#![feature(const_trait_impl)]
// For now, this parses since an error does not occur until AST lowering.
impl ?const T {}
impl ~const T {}

View File

@ -0,0 +1,38 @@
#![feature(const_trait_impl)]
#![feature(associated_type_bounds)]
trait T {}
struct S;
impl T for S {}
fn rpit() -> impl ~const T { S }
//~^ ERROR `~const` is not allowed
fn apit(_: impl ~const T) {}
//~^ ERROR `~const` is not allowed
fn rpit_assoc_bound() -> impl IntoIterator<Item: ~const T> { Some(S) }
//~^ ERROR `~const` is not allowed
fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T>) {}
//~^ ERROR `~const` is not allowed
fn generic<T: ~const T>() {}
//~^ ERROR `~const` is not allowed
fn where_clause<T>() where T: ~const T {}
//~^ ERROR `~const` is not allowed
impl ~const T {}
//~^ ERROR `~const` is not allowed
fn trait_object() -> &'static dyn ~const T { &S }
//~^ ERROR `~const` is not allowed
fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ~const T>>) {}
//~^ ERROR `~const` is not allowed
struct S<T: ~const ?Sized>(std::marker::PhantomData<T>);
//~^ ERROR `~const` and `?` are mutually exclusive
fn main() {}

View File

@ -1,12 +0,0 @@
#![feature(const_trait_impl)]
fn a<T: ~const From<u8>>() {}
//~^ ERROR: `~const` is not allowed
struct S;
impl S {
fn b<T: ~const From<u8>>() {}
//~^ ERROR: `~const` is not allowed
}
fn main() {}

View File

@ -1,18 +0,0 @@
error: `~const` is not allowed here
--> $DIR/tilde-const-on-non-const-fn.rs:2:9
|
LL | fn a<T: ~const From<u8>>() {}
| ^^^^^^^^^^^^^^^
|
= note: only allowed on bounds on traits' associated types, const fns, const impls and its associated functions
error: `~const` is not allowed here
--> $DIR/tilde-const-on-non-const-fn.rs:8:13
|
LL | fn b<T: ~const From<u8>>() {}
| ^^^^^^^^^^^^^^^
|
= note: only allowed on bounds on traits' associated types, const fns, const impls and its associated functions
error: aborting due to 2 previous errors

View File

@ -0,0 +1,9 @@
// compile-flags: -Z parse-only
// check-pass
#![feature(const_trait_impl)]
struct S<
T: ~const ?for<'a> Tr<'a> + 'static + ~const std::ops::Add,
T: ~const ?for<'a: 'b> m::Trait<'a>,
>;