Use pinning for generators to make trait safe by Nemo157 · Pull Request #55704 · rust-lang/rust (original) (raw)
The job x86_64-gnu-llvm-5.0
of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.
Click to expand the log.
travis_time🔚006a0653:start=1541510755552850360,finish=1541510956949816547,duration=201396966187
$ git checkout -qf FETCH_HEAD
travis_fold🔚git.checkout
Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:49:50] running 4996 tests
[00:49:53] .................................................................................................... 100/4996
[00:49:56] .................................................................................................... 200/4996
[00:49:59] .................................................................................................... 300/4996
[00:50:02] .............................................F...............................................F...... 400/4996
[00:50:09] .........................i.......................................................................... 600/4996
[00:50:13] .................................................................................................... 700/4996
[00:50:20] ...................................................................i...........i.................... 800/4996
[00:50:23] ......................................................................................iiiii......... 900/4996
[00:50:23] ......................................................................................iiiii......... 900/4996
[00:50:27] .................................................................................................... 1000/4996
[00:50:29] .................................................................................................... 1100/4996
[00:50:32] .................................................................................................... 1200/4996
[00:50:34] .................................................................................................... 1300/4996
[00:50:37] .................................................................................................... 1400/4996
[00:50:39] ......................................................................................i....F........ 1500/4996
[00:50:46] .................................................................................................... 1700/4996
[00:50:50] .................................................................................................... 1800/4996
[00:50:53] ..................................................................................................i. 1900/4996
[00:50:57] .................................................................................................... 2000/4996
[00:50:57] .................................................................................................... 2000/4996
[00:51:01] .................................................................................................... 2100/4996
[00:51:05] .................................................................................................... 2200/4996
[00:51:10] .................................................................................................... 2300/4996
[00:51:13] .................................................................................................... 2400/4996
[00:51:17] ....................................................................F............................... 2500/4996
[00:51:22] .................................................................................................... 2600/4996
[00:51:25] .................F.................................................................................. 2700/4996
[00:51:32] .................................................................................................... 2900/4996
[00:51:36] .................................................................................................... 3000/4996
[00:51:39] .......................i............................................................................ 3100/4996
[00:51:42] .....................................................................................i.i..ii........ 3200/4996
[00:51:42] .....................................................................................i.i..ii........ 3200/4996
[00:51:46] .................................................................................................... 3300/4996
[00:51:50] ..........................F......................................................................... 3400/4996
[00:51:52] ..........................................................i.ii...................................... 3500/4996
[00:51:56] .................................................................................................... 3700/4996
[00:51:58] ..................................i................................................................. 3800/4996
[00:52:00] .................................................................................................... 3900/4996
[00:52:03] .................................................................................................... 4000/4996
---
[00:52:26] ..................................................................i................................. 4600/4996
[00:52:29] .................................................................................................... 4700/4996
[00:52:33] .................................................................................................... 4800/4996
[00:52:35] .................................................................................................... 4900/4996
e(x: Option<isize>) -> isize {
[00:52:38]
[00:52:38] The actual stderr differed from the expected stderr.
[00:52:38] The actual stderr differed from the expected stderr.
[00:52:38] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-ref-mut-of-imm/borrowck-ref-mut-of-imm.stderr
[00:52:38] To update references, rerun the tests and pass the `--bless` flag
[00:52:38] To only update this specific test, also pass `--test-args borrowck/borrowck-ref-mut-of-imm.rs`
[00:52:38] error: 1 errors occurred comparing output.
[00:52:38] status: exit code: 1
[00:52:38] status: exit code: 1
[00:52:38] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-ref-mut-of-imm/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-ref-mut-of-imm/auxiliary" "-A" "unused"
[00:52:38] ------------------------------------------
[00:52:38]
[00:52:38] ------------------------------------------
[00:52:38] stderr:
[00:52:38] stderr:
[00:52:38] ------------------------------------------
[00:52:38] {"message":"cannot borrow field `(x as std::option::Option::Some).0` of immutable binding as mutable","code":{"code":"E0596","explanation":"\nThis error occurs because you tried to mutably borrow a non-mutable variable.\n\nExample of erroneous code:\n\n```compile_fail,E0596\nlet x = 1;\nlet wck/issue-41962.rs`
[00:52:38] error: 1 errors occurred comparing output.
[00:52:38] status: exit code: 1
[00:52:38] status: exit code: 1
[00:52:38] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/issue-41962.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=compare" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/issue-41962/auxiliary" "-A" "unused"
[00:52:38] ------------------------------------------
[00:52:38]
[00:52:38] ------------------------------------------
[00:52:38] stderr:
[00:52:38] stderr:
[00:52:38] ------------------------------------------
[00:52:38] {"message":"use of partially moved value: `maybe` (Ast)","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = MyStruct{ s: 5u32 };\n let y = x;\n x.s = 6;\n println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value witwnership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n let mut p1 = Point{ x: -1, y: 2 };\n let p2 = p1;\n p1.x = 1;\n println!(\"p1: {}, {}\", p1.x, p1.y);\n println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n let y = x.clone();\n x.borrow_mut().s = 6;\n println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":602,"byte_end":607,"line_start":17,"line_end":17,"column_start":30,"column_end":35,"is_primary":true,"text":[{"text":" if let Some(thing) = maybe {","highlight_start":30,"highlight_end":35}],"label":"value used here after move","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_start":17,"lin_applicability":null,"expansion":null}],"children":[{"message":"move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value: `(maybe as std::option::Option::Some).0` (Ast)\n --> /checkout/src/test/ui/borrowck/issue-41962.rs:17:21\n |\nLL | if let Some(thing) = maybe {\n | ^^^^^ value moved here in previous iteration of loop\n |\n = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:52:38] {"message":"use of moved value (Mir)","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = MyStruct{ s: 5u32 };\n let y = x;\n x.s = 6;\n println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n let s1 = String::from(\"hello\");\n\n let len = calculate_length(&s1);\n\x, p1.y);\n println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n let y = x.clone();\n x.borrow_mut().s = 6;\n println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/borrowck/issue-41962.rs","byte_start":593,"byte_end":598,"line_start":17,"line_end":17,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" if let Some(thing) = maybe {","highlight_start":21,"highlight_end":26}],"label":"value moved here, in previous iteration of loop","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value (Mir)\n --> /checkout/src/test/ui/borrowck/issue-41962.rs:17:21\n |\nLL | if let Some(thing) = maybe {\n | ^^^^^ value moved here, in previous iteration of loop\n |\n = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:52:38] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:52:38] {"message":"For more information about this error, try `rustc --explain E0382`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0382`.\n"}
[00:52:38] ------------------------------------------
[00:52:38]
[00:52:38] thread '[ui] ui/borrowck/issue-41962.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[00:52:38]
[00:52:38]
[00:52:38] ---- [ui] ui/fully-qualified-type/fully-qualified-type-name1.rs stdout ----
[00:52:38] diff of stderr:
[00:52:38]
[00:52:38] 5 | ^
[00:52:38] 6 | |
[00:52:38] 7 | expected enum `std::option::Option`, found integral variable
[00:52:38] - | help: try using a variant of the expected type: `Some(5)`
[00:52:38] + | help: try using a variant of the expected type: `std::option::Option::Some(5)`
[00:52:38] 10 = note: expected type `std::option::Option<usize>`
[00:52:38] 10 = note: expected type `std::option::Option<usize>`
[00:52:38] 11 found type `{integer}`
[00:52:38]
[00:52:38] The actual stderr differed from the expected stderr.
[00:52:38] The actual stderr differed from the expected stderr.
[00:52:38] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fully-qualified-type/fully-qualified-type-name1/fully-qual~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs","byte_start":580,"byte_end":581,"line_start":15,"line_end":15,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" x = 5;","highlight_start":9,"highlight_end":10}],"label":"expected enum `std::option::Option`, found integral variable","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::option::Option<usize>`\n found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a variant of the expected type","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs","byte_start":580,"byte_end":581,"line_start":15,"line_end":15,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" x = 5;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"std::option::Option::Some(5)","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0308]: mismatched types\n --> /checkout/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs:15:9\n |\nLL | x = 5;\n | ^\n | |\n | expected enum `std::option::Option`, found integral variable\n | help: try using a variant of the expected type: `std::option::Op
[00:52:38] error: 1 errors occurred comparing output.
[00:52:38] status: exit code: 1
[00:52:38] status: exit code: 1
[00:52:38] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-39175.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-39175/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-39175/auxiliary" "-A" "unused"
[00:52:38] ------------------------------------------
[00:52:38]
[00:52:38] ------------------------------------------
[00:52:38] stderr:
[00:52:38] stderr:
[00:52:38] ------------------------------------------
[00:52:38] {"message":"no method named `exec` found for type `&mut std::process::Command` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n // in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-39175.rs","byte_start":893,"byte_end":897,"line_start":24,"line_end":24,"column_start":39,"column_end":43,"is_primary":true,"text":[{"text":" Command::new(\"echo\").arg(\"hello\").exec();","highlight_start":39,"highlight_end":43}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-39175.rs","byte_start":772,"byte_end":772,"line_start":20,"line_end":20,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"use std::process::Command;","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::os::unix::prelude::CommandExt;\n","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `exec` found for type `&mut std::process::Command` in the current scope\n --> /checkout/src/test/ui/issues/issue-39175.rs:24:39\n |\nLL | Command::new(\"echo\").arg(\"hello\").exec();\n | ^^^^\n |\n = help: items from traits can only be used if the trait is in scope\nhelp: the following trait is implemented but not in scope, perhaps add a `use` for it:\n |\nLL | use std::os::unix::prelude::CommandExt;\n |\n\n"}
[00:52:38] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:52:38] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-46112/auxiliary" "-A" "unused"
[00:52:38] ------------------------------------------
[00:52:38]
[00:52:38] ------------------------------------------
[00:52:38] stderr:
[00:52:38] stderr:
[00:52:38] ------------------------------------------
[00:52:38] {"message":"mismatched types","code":{"code":"E0308","explanation":"\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can occur for several cases, the most common of which is a\nmismatch in the expected type that the compiler inferred for a variable's\ninitializing expression, and the actual type explicitly assigned to the\nvariable.\n\nFor example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n// ~~~ ~~~~~~~~~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-46112.rs","byte_start":790,"byte_end":792,"line_start":19,"line_end":19,"column_start":21,"column_end":23,"is_primary":true,"text":[{"text":"fn main() { test(Ok(())); }","highlight_start":21,"highlight_end":23}],"label":"expected enum `std::option::Option`, found ()","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::option::Option<()>`\n found type `()`","code":null,"level":"note","spans":[],"childreen the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n let mut s1 = String::from(\"many\");\n let s2 = s1.clone();\n s1.remove(0);\n println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`. Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n let mut p1 = Point{ x: -1, y: 2 };\n let p2 = p1;\n p1.x = 1;\n println!(\"p1: {}, {}\", p1.x, p1.y);\n println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n let y = x.clone();\n x.borrow_mut().s = 6;\n println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount tpe `std::vec::Vec<bool>`, which does not implement the `Copy` trait\n\n"}
[00:52:38] {"message":"use of moved value: `(maybe as std::option::Option::Some).0`","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = MyStruct{ s: 5u32 };\n let y = x;\n x.s = 6;\n println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n let s1 = String::from(\"hello\");\n\n let len = calculate_length(&s1);\n\n println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n let mut s1 = String::from(\"many\");\n let s2 = s1.clone();\n s1.remove(0);\n println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`. Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n let mut p1 = Point{ x: -1, y: 2 };\n let p2 = p1;\n p1.x = 1;\n println!(\"p1: {}, {}\", p1.x, p1.y);\n println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n let y = x.clone();\n x.borrow_mut().s = 6;\n println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference:[],"rendered":"For more information about this error, try `rustc --explain E0382`.\n"}
[00:52:38] ------------------------------------------
[00:52:38]
[00:52:38] thread '[ui] ui/nll/issue-53807.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[00:52:38]
---
[00:52:38] test result: FAILED. 4966 passed; 6 failed; 24 ignored; 0 measured; 0 filtered out
[00:52:38]
[00:52:38]
[00:52:38]
[00:52:38] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:52:38]
[00:52:38]
[00:52:38] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:52:38] Build completed unsuccessfully in 0:03:49
[00:52:38] Build completed unsuccessfully in 0:03:49
[00:52:38] Makefile:58: recipe for target 'check' failed
[00:52:38] make: *** [check] Error 1
2344532 ./obj
2344492 ./obj/build
1708724 ./obj/build/x86_64-unknown-linux-gnu
1193616 ./.git
---
149112 ./src/llvm-emscripten/test
142856 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc
137072 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu
137068 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release
134668 ./obj/build/bootstrap/debug/incremental/ravis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold🔚after_failure.4
travis_fold:start:after_failure.5
travis_time:start:11fa9e42
travis_time:start:11fa9e42
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold🔚after_failure.5
travis_fold:start:after_failure.6
travis_time:start:01aa3540
$ dmesg | grep -i kill
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN
. (Feature Requests)