diff options
| author | bors <bors@rust-lang.org> | 2021-01-31 23:45:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-31 23:45:37 +0000 |
| commit | 941343e0871dd04ea774e8cee7755461b144ef29 (patch) | |
| tree | f1b0d9272f0e8021ea13bb21054700ce52406c2f /src/test/ui/array-slice-vec | |
| parent | 0e63af5da3400ace48a0345117980473fd21ad73 (diff) | |
| parent | 9165676d91d3e458a57f4f4eacc3975d89be9f5a (diff) | |
| download | rust-941343e0871dd04ea774e8cee7755461b144ef29.tar.gz rust-941343e0871dd04ea774e8cee7755461b144ef29.zip | |
Auto merge of #81596 - jonas-schievink:rollup-utk14gr, r=jonas-schievink
Rollup of 11 pull requests Successful merges: - #80092 (2229: Fix issues with move closures and mutability) - #80404 (Remove const_in_array_repeat) - #81255 (Don't link with --export-dynamic on wasm32-wasi) - #81480 (Add suggestion for nested fields) - #81549 (Misc ip documentation fixes) - #81566 (Add a test for #71202) - #81568 (Fix an old FIXME in redundant paren lint) - #81571 (Fix typo in E0759) - #81572 (Edit multiple error code Markdown files) - #81589 (Fix small typo in string.rs) - #81590 (Stabilize int_bits_const) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/array-slice-vec')
| -rw-r--r-- | src/test/ui/array-slice-vec/repeat_empty_ok.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/array-slice-vec/repeat_empty_ok.stderr | 19 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/repeat_empty_ok.rs b/src/test/ui/array-slice-vec/repeat_empty_ok.rs new file mode 100644 index 00000000000..25463ea5ee8 --- /dev/null +++ b/src/test/ui/array-slice-vec/repeat_empty_ok.rs @@ -0,0 +1,15 @@ +#![crate_type = "lib"] + +pub struct Header<'a> { + pub value: &'a [u8], +} + +pub fn test() { + let headers = [Header{value: &[]}; 128]; + //~^ ERROR the trait bound +} + +pub fn test2() { + let headers = [Header{value: &[0]}; 128]; + //~^ ERROR the trait bound +} diff --git a/src/test/ui/array-slice-vec/repeat_empty_ok.stderr b/src/test/ui/array-slice-vec/repeat_empty_ok.stderr new file mode 100644 index 00000000000..85baa1268bf --- /dev/null +++ b/src/test/ui/array-slice-vec/repeat_empty_ok.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied + --> $DIR/repeat_empty_ok.rs:8:19 + | +LL | let headers = [Header{value: &[]}; 128]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>` + | + = note: the `Copy` trait is required because the repeated element will be copied + +error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied + --> $DIR/repeat_empty_ok.rs:13:19 + | +LL | let headers = [Header{value: &[0]}; 128]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>` + | + = note: the `Copy` trait is required because the repeated element will be copied + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. |
