Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6dfcf9a
Remove branches from sift_down_to_bottom loop
SkiFire13 Nov 7, 2020
25b3f61
Remove useless branches from sift_down_range loop
SkiFire13 Nov 7, 2020
8d15753
Remove useless bound checks from into_sorted_vec
SkiFire13 Nov 7, 2020
387568c
Added SAFETY comment as request
SkiFire13 Nov 9, 2020
de84ad9
Implement destructuring assignment for structs and slices
fanzier Nov 7, 2020
f344134
Add asm register information for SPIR-V
khyperia Nov 11, 2020
0e34b73
Change capitalization of Spirv to SpirV
khyperia Nov 11, 2020
cd314ae
update rustfmt
calebcartwright Nov 12, 2020
c338c81
Update cargo
ehuss Nov 12, 2020
80b2835
extend min_const_generics param ty tests
lcnr Nov 12, 2020
380b222
Consider mutable ident binding patterns to be simple
ebkalderon Sep 15, 2020
2baa0ce
Don't reuse bindings for `ref mut`
jyn514 Nov 8, 2020
38127ca
Handle and test wildcard arguments
jyn514 Nov 10, 2020
4b0b42a
Rollup merge of #76730 - ebkalderon:rustdoc-fix-mut-args-async-fn, r=…
m-ou-se Nov 12, 2020
755dd14
Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=pe…
m-ou-se Nov 12, 2020
4088981
Rollup merge of #78857 - SkiFire13:bheap-opt, r=KodrAus
m-ou-se Nov 12, 2020
76fa5f2
Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu
m-ou-se Nov 12, 2020
a2e8fb5
Rollup merge of #78970 - calebcartwright:update-rustfmt, r=Aaron1011
m-ou-se Nov 12, 2020
ef77a43
Rollup merge of #78972 - ehuss:update-cargo, r=ehuss
m-ou-se Nov 12, 2020
38ca6e3
Rollup merge of #78987 - lcnr:integer-sizes, r=varkor
m-ou-se Nov 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/test/ui/const-generics/core-types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Check that all types allowed with `min_const_generics` work.
// run-pass
// revisions: full min

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

struct A<const N: u8>;
struct B<const N: u16>;
struct C<const N: u32>;
struct D<const N: u64>;
struct E<const N: u128>;
struct F<const N: usize>;
struct G<const N: i8>;
struct H<const N: i16>;
struct I<const N: i32>;
struct J<const N: i64>;
struct K<const N: i128>;
struct L<const N: isize>;
struct M<const N: char>;
struct N<const N: bool>;

fn main() {
let _ = A::<{u8::MIN}>;
let _ = A::<{u8::MAX}>;
let _ = B::<{u16::MIN}>;
let _ = B::<{u16::MAX}>;
let _ = C::<{u32::MIN}>;
let _ = C::<{u32::MAX}>;
let _ = D::<{u64::MIN}>;
let _ = D::<{u64::MAX}>;
let _ = E::<{u128::MIN}>;
let _ = E::<{u128::MAX}>;
let _ = F::<{usize::MIN}>;
let _ = F::<{usize::MAX}>;
let _ = G::<{i8::MIN}>;
let _ = G::<{i8::MAX}>;
let _ = H::<{i16::MIN}>;
let _ = H::<{i16::MAX}>;
let _ = I::<{i32::MIN}>;
let _ = I::<{i32::MAX}>;
let _ = J::<{i64::MIN}>;
let _ = J::<{i64::MAX}>;
let _ = K::<{i128::MIN}>;
let _ = K::<{i128::MAX}>;
let _ = L::<{isize::MIN}>;
let _ = L::<{isize::MAX}>;
let _ = M::<'A'>;
let _ = N::<true>;
}
11 changes: 11 additions & 0 deletions src/test/ui/const-generics/min_const_generics/complex-types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(min_const_generics)]
#![feature(never_type)]

struct Foo<const N: [u8; 0]>;
//~^ ERROR `[u8; 0]` is forbidden
Expand All @@ -14,4 +15,14 @@ struct Fez<const N: No>;
struct Faz<const N: &'static u8>;
//~^ ERROR `&'static u8` is forbidden

struct Fiz<const N: !>;
//~^ ERROR `!` is forbidden

enum Goo<const N: ()> { A, B }
//~^ ERROR `()` is forbidden

union Boo<const N: ()> { a: () }
//~^ ERROR `()` is forbidden


fn main() {}
37 changes: 32 additions & 5 deletions src/test/ui/const-generics/min_const_generics/complex-types.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `[u8; 0]` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:3:21
--> $DIR/complex-types.rs:4:21
|
LL | struct Foo<const N: [u8; 0]>;
| ^^^^^^^
Expand All @@ -8,7 +8,7 @@ LL | struct Foo<const N: [u8; 0]>;
= note: more complex types are supported with `#[feature(const_generics)]`

error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:6:21
--> $DIR/complex-types.rs:7:21
|
LL | struct Bar<const N: ()>;
| ^^
Expand All @@ -17,7 +17,7 @@ LL | struct Bar<const N: ()>;
= note: more complex types are supported with `#[feature(const_generics)]`

error: `No` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:11:21
--> $DIR/complex-types.rs:12:21
|
LL | struct Fez<const N: No>;
| ^^
Expand All @@ -26,13 +26,40 @@ LL | struct Fez<const N: No>;
= note: more complex types are supported with `#[feature(const_generics)]`

error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:14:21
--> $DIR/complex-types.rs:15:21
|
LL | struct Faz<const N: &'static u8>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`

error: aborting due to 4 previous errors
error: `!` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:18:21
|
LL | struct Fiz<const N: !>;
| ^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`

error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:21:19
|
LL | enum Goo<const N: ()> { A, B }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`

error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:24:20
|
LL | union Boo<const N: ()> { a: () }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`

error: aborting due to 7 previous errors