Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 26, 2020
1 parent 18fa778 commit c4ba60a
Show file tree
Hide file tree
Showing 449 changed files with 658 additions and 950 deletions.
1 change: 0 additions & 1 deletion src/test/rustdoc-ui/error-in-impl-trait/const-generics.rs
@@ -1,6 +1,5 @@
// check-pass
// edition:2018
#![feature(min_const_generics)]
trait ValidTrait {}

/// This has docs
Expand Down
2 changes: 0 additions & 2 deletions src/test/rustdoc/async-fn.rs
@@ -1,7 +1,5 @@
// ignore-tidy-linelength
// edition:2018
#![feature(min_const_generics)]

// @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>'
pub async fn foo() -> Option<Foo> {
None
Expand Down
2 changes: 0 additions & 2 deletions src/test/rustdoc/const-generics/auxiliary/extern_crate.rs
@@ -1,6 +1,4 @@
// edition:2018
#![feature(min_const_generics)]

pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]> {
[[0; N]; N].iter().copied()
}
Expand Down
1 change: 0 additions & 1 deletion src/test/rustdoc/const-generics/const-generics-docs.rs
@@ -1,6 +1,5 @@
// edition:2018
// aux-build: extern_crate.rs
#![feature(min_const_generics)]
#![crate_name = "foo"]

extern crate extern_crate;
Expand Down
1 change: 0 additions & 1 deletion src/test/rustdoc/const-generics/type-alias.rs
@@ -1,5 +1,4 @@
// ignore-tidy-linelength
#![feature(min_const_generics)]
#![crate_name = "foo"]

// @has foo/type.CellIndex.html '//pre[@class="rust typedef"]' 'type CellIndex<const D: usize> = [i64; D];'
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/array-slice-vec/match_arr_unknown_len.stderr
Expand Up @@ -6,7 +6,6 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0308]: mismatched types
--> $DIR/match_arr_unknown_len.rs:6:9
Expand Down
Expand Up @@ -14,8 +14,7 @@ impl Foo for Def {

pub fn test<A: Foo, B: Foo>() {
let _array: [u32; <A as Foo>::Y];
//~^ ERROR the trait bound `A: Foo` is not satisfied [E0277]
//~^ ERROR generic parameters may not be used
}

fn main() {
}
fn main() {}
@@ -1,17 +1,11 @@
error[E0277]: the trait bound `A: Foo` is not satisfied
--> $DIR/associated-const-type-parameter-arrays.rs:16:23
error: generic parameters may not be used in const operations
--> $DIR/associated-const-type-parameter-arrays.rs:16:24
|
LL | const Y: usize;
| --------------- required by `Foo::Y`
...
LL | let _array: [u32; <A as Foo>::Y];
| ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A`
| ^ cannot perform const operation using `A`
|
help: consider further restricting this bound
|
LL | pub fn test<A: Foo + Foo, B: Foo>() {
| ^^^^^
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
Expand Up @@ -5,7 +5,7 @@ trait Adapter {
struct Foo<A: Adapter> {
adapter: A,
links: [u32; A::LINKS], // Shouldn't suggest bounds already there.
//~^ ERROR: no associated item named `LINKS` found
//~^ ERROR generic parameters may not be used in const operations
}

fn main() {}
@@ -1,11 +1,11 @@
error[E0599]: no associated item named `LINKS` found for type parameter `A` in the current scope
--> $DIR/associated-item-duplicate-bounds.rs:7:21
error: generic parameters may not be used in const operations
--> $DIR/associated-item-duplicate-bounds.rs:7:18
|
LL | links: [u32; A::LINKS], // Shouldn't suggest bounds already there.
| ^^^^^ associated item not found in `A`
| ^^^^^^^^ cannot perform const operation using `A`
|
= help: items from traits can only be used if the type parameter is bounded by the trait
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
4 changes: 2 additions & 2 deletions src/test/ui/async-await/issues/issue-78654.full.stderr
@@ -1,11 +1,11 @@
error[E0573]: expected type, found built-in attribute `feature`
--> $DIR/issue-78654.rs:10:15
--> $DIR/issue-78654.rs:9:15
|
LL | impl<const H: feature> Foo {
| ^^^^^^^ not a type

error[E0207]: the const parameter `H` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-78654.rs:10:12
--> $DIR/issue-78654.rs:9:12
|
LL | impl<const H: feature> Foo {
| ^ unconstrained const parameter
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/async-await/issues/issue-78654.min.stderr
@@ -1,11 +1,11 @@
error[E0573]: expected type, found built-in attribute `feature`
--> $DIR/issue-78654.rs:10:15
--> $DIR/issue-78654.rs:9:15
|
LL | impl<const H: feature> Foo {
| ^^^^^^^ not a type

error[E0207]: the const parameter `H` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-78654.rs:10:12
--> $DIR/issue-78654.rs:9:12
|
LL | impl<const H: feature> Foo {
| ^ unconstrained const parameter
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/async-await/issues/issue-78654.rs
Expand Up @@ -3,7 +3,6 @@

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

struct Foo;

Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/binding/const-param.full.stderr
@@ -0,0 +1,9 @@
error[E0158]: const parameters cannot be referenced in patterns
--> $DIR/const-param.rs:8:9
|
LL | N => {}
| ^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0158`.
9 changes: 9 additions & 0 deletions src/test/ui/binding/const-param.min.stderr
@@ -0,0 +1,9 @@
error[E0158]: const parameters cannot be referenced in patterns
--> $DIR/const-param.rs:8:9
|
LL | N => {}
| ^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0158`.
5 changes: 3 additions & 2 deletions src/test/ui/binding/const-param.rs
@@ -1,6 +1,7 @@
// Identifier pattern referring to a const generic parameter is an error (issue #68853).

#![feature(const_generics)] //~ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]

fn check<const N: usize>() {
match 1 {
Expand Down
19 changes: 0 additions & 19 deletions src/test/ui/binding/const-param.stderr

This file was deleted.

1 change: 0 additions & 1 deletion src/test/ui/const-generics/apit-with-const-param.rs
Expand Up @@ -3,7 +3,6 @@

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

trait Trait {}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/const-generics/argument_order.full.stderr
@@ -1,11 +1,11 @@
error: lifetime parameters must be declared prior to const parameters
--> $DIR/argument_order.rs:12:32
--> $DIR/argument_order.rs:11:32
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`

error[E0747]: lifetime provided when a type was expected
--> $DIR/argument_order.rs:20:23
--> $DIR/argument_order.rs:19:23
|
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
| ^^^^^^^
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/const-generics/argument_order.min.stderr
@@ -1,23 +1,23 @@
error: type parameters must be declared prior to const parameters
--> $DIR/argument_order.rs:6:28
--> $DIR/argument_order.rs:5:28
|
LL | struct Bad<const N: usize, T> {
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`

error: lifetime parameters must be declared prior to const parameters
--> $DIR/argument_order.rs:12:32
--> $DIR/argument_order.rs:11:32
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`

error: type parameters must be declared prior to const parameters
--> $DIR/argument_order.rs:12:36
--> $DIR/argument_order.rs:11:36
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
| ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`

error[E0747]: lifetime provided when a type was expected
--> $DIR/argument_order.rs:20:23
--> $DIR/argument_order.rs:19:23
|
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
| ^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/argument_order.rs
@@ -1,7 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

struct Bad<const N: usize, T> {
//[min]~^ ERROR type parameters must be declared prior to const parameters
Expand Down
@@ -1,13 +1,13 @@
error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:9:38
--> $DIR/array-size-in-generic-struct-param.rs:8:38
|
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes

error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:20:10
--> $DIR/array-size-in-generic-struct-param.rs:19:10
|
LL | arr: [u8; CFG.arr_size],
| ^^^^^^^^^^^^^^^^^^
Expand Down
@@ -1,5 +1,5 @@
error: generic parameters may not be used in const operations
--> $DIR/array-size-in-generic-struct-param.rs:9:48
--> $DIR/array-size-in-generic-struct-param.rs:8:48
|
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^ cannot perform const operation using `N`
Expand All @@ -8,7 +8,7 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/array-size-in-generic-struct-param.rs:20:15
--> $DIR/array-size-in-generic-struct-param.rs:19:15
|
LL | arr: [u8; CFG.arr_size],
| ^^^ cannot perform const operation using `CFG`
Expand All @@ -17,7 +17,7 @@ LL | arr: [u8; CFG.arr_size],
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: `Config` is forbidden as the type of a const generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:18:21
--> $DIR/array-size-in-generic-struct-param.rs:17:21
|
LL | struct B<const CFG: Config> {
| ^^^^^^
Expand Down
Expand Up @@ -3,7 +3,6 @@

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

#[allow(dead_code)]
struct ArithArrayLen<const N: usize>([u32; 0 + N]);
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/array-wrapper-struct-ctor.rs
Expand Up @@ -2,7 +2,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

#![allow(dead_code)]

Expand Down
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
--> $DIR/associated-type-bound-fail.rs:14:5
--> $DIR/associated-type-bound-fail.rs:13:5
|
LL | type Assoc: Bar<N>;
| ------ required by this bound in `Foo::Assoc`
Expand Down
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
--> $DIR/associated-type-bound-fail.rs:14:5
--> $DIR/associated-type-bound-fail.rs:13:5
|
LL | type Assoc: Bar<N>;
| ------ required by this bound in `Foo::Assoc`
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/associated-type-bound-fail.rs
@@ -1,7 +1,6 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]

trait Bar<const N: usize> {}

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/associated-type-bound.rs
Expand Up @@ -2,7 +2,6 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]

trait Bar<const N: usize> {}

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/auxiliary/const_generic_lib.rs
@@ -1,6 +1,5 @@
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

pub struct Struct<const N: usize>(pub [u8; N]);

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/auxiliary/crayte.rs
@@ -1,7 +1,6 @@
// edition:2018
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

pub trait Foo<const N: usize> {}
struct Local;
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/auxiliary/impl-const.rs
@@ -1,6 +1,5 @@
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

pub struct Num<const N: usize>;

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/broken-mir-1.rs
Expand Up @@ -3,7 +3,6 @@

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

pub trait Foo {
fn foo(&self);
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/broken-mir-2.rs
Expand Up @@ -3,7 +3,6 @@

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

use std::fmt::Debug;

Expand Down
Expand Up @@ -2,7 +2,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

// This test confirms that the types can be inferred correctly for this example with const
// generics. Previously this would ICE, and more recently error.
Expand Down

0 comments on commit c4ba60a

Please sign in to comment.