Skip to content

Allow const parameters in array sizes to be unified #60742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Add a test for a function taking a const param array as an argument
  • Loading branch information
varkor committed May 28, 2019
commit 5a585fe45e93b946013ec2eebb0b2c2ec3bed15a
16 changes: 16 additions & 0 deletions src/test/ui/const-generics/fn-taking-const-generic-array.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// run-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

use std::fmt::Display;

fn print_slice<T: Display, const N: usize>(slice: &[T; N]) {
for x in slice.iter() {
println!("{}", x);
}
}

fn main() {
print_slice(&[1, 2, 3]);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/fn-taking-const-generic-array.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^