diff options
| author | bors <bors@rust-lang.org> | 2019-06-02 14:42:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-02 14:42:11 +0000 |
| commit | d461555e443a07bc75564b8322dc461efe7cea7c (patch) | |
| tree | 142116ba2b27c046e6b5bbb8306d620d1ace9d9d /src/test/ui/const-generics/mut-ref-const-param-array.rs | |
| parent | 4c7bb8b0d9d3c5149c8ad12b59604ccb57e8accc (diff) | |
| parent | aaf264b999ff4ed9f0b65757076ed3a8e64dc9b9 (diff) | |
| download | rust-d461555e443a07bc75564b8322dc461efe7cea7c.tar.gz rust-d461555e443a07bc75564b8322dc461efe7cea7c.zip | |
Auto merge of #61460 - Centril:rollup-8txhjx4, r=Centril
Rollup of 6 pull requests Successful merges: - #61380 (Fix some issues with `unwrap_usize` instead of `assert_usize`) - #61423 (codegen: change `$6d$` to `$u6d$`) - #61438 (Point at individual type args on arg count mismatch) - #61441 (Tweak wording when encountering `fn` call in pattern) - #61451 (Fix missing semicolon in doc) - #61458 (Fix typo in AsRef doc) Failed merges: r? @ghost
Diffstat (limited to 'src/test/ui/const-generics/mut-ref-const-param-array.rs')
| -rw-r--r-- | src/test/ui/const-generics/mut-ref-const-param-array.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/mut-ref-const-param-array.rs b/src/test/ui/const-generics/mut-ref-const-param-array.rs new file mode 100644 index 00000000000..f930fb87963 --- /dev/null +++ b/src/test/ui/const-generics/mut-ref-const-param-array.rs @@ -0,0 +1,19 @@ +// run-pass + +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +use std::ops::AddAssign; + +fn inc<T: AddAssign + Clone, const N: usize>(v: &mut [T; N]) -> &mut [T; N] { + for x in v.iter_mut() { + *x += x.clone(); + } + v +} + +fn main() { + let mut v = [1, 2, 3]; + inc(&mut v); + assert_eq!(v, [2, 4, 6]); +} |
