Skip to content
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

Use pinning for generators to make trait safe #55704

Merged
merged 7 commits into from Jan 28, 2019

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Nov 5, 2018

I'm unsure whether there needs to be any changes to the actual generator transform. Tests are passing so the fact that Pin<&mut T> is fundamentally the same as &mut T seems to allow it to still work, but maybe there's something subtle here that could go wrong.

This is specified in RFC 2349 § Immovable generators (although, since that RFC it has become safe to create an immovable generator, and instead it's unsafe to resume any generator; with these changes both are now safe and instead the unsafety is moved to creating a Pin<&mut [static generator]> which there are safe APIs for).

CC #43122

@rust-highfive
Copy link
Collaborator

r? @dtolnay

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 5, 2018
@dtolnay
Copy link
Member

dtolnay commented Nov 5, 2018

r? @withoutboats

@rust-highfive rust-highfive assigned withoutboats and unassigned dtolnay Nov 5, 2018
@rust-highfive
Copy link
Collaborator

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:end:2f3792ee:start=1541438200611337114,finish=1541438203249678271,duration=2638341157
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:48:02] .................................................................................................... 1200/4990
[00:48:05] .................................................................................................... 1300/4990
[00:48:07] .................................................................................................... 1400/4990
[00:48:10] ...................................................................................i................ 1500/4990
[00:48:13] .....F...............................................i.............................................. 1600/4990
[00:48:20] .................................................................................................... 1800/4990
[00:48:23] ..............................................................................................i..... 1900/4990
[00:48:26] .................................................................................................... 2000/4990
[00:48:30] .................................................................................................... 2100/4990
---
[00:49:50] ............................................................i....................................... 4600/4990
[00:49:54] .................................................................................................... 4700/4990
[00:49:57] .................................................................................................... 4800/4990
[00:49:59] .................................................................................................... 4900/4990
2] -    |     ^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:19:25: 21:6 _]`
[00:50:02] +    |     ^^^^^^^^^^^^ the trait `std::pin::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:19:25: 21:6 _]`
[00:50:02] 6    |
[00:50:02] 7 note: required by `assert_unpin`
[00:50:02] 8   --> $DIR/static-not-unpin.rs:15:1
[00:50:02] 
[00:50:02] The actual stderr differed from the expected stderr.
[00:50:02] The actual stderr differed from the expected stderr.
[00:50:02] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/static-not-unpin/static-not-unpin.stderr
[00:50:02] To update references, rerun the tests and pass the `--bless` flag
[00:50:02] To only update this specific test, also pass `--test-args generator/static-not-unpin.rs`
[00:50:02] error: 1 errors occurred comparing output.
[00:50:02] status: exit code: 1
[00:50:02] status: exit code: 1
[00:50:02] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/generator/static-not-unpin.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/generator/static-not-unpin/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/generator/static-not-unpin/auxiliary" "-A" "unused"
[00:50:02] ------------------------------------------
[00:50:02] 
[00:50:02] ------------------------------------------
[00:50:02] stderr:
[00:50:02] stderr:
[00:50:02] ------------------------------------------
[00:50:02] {"message":"the trait bound `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]: std::pin::Unpin` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":633,"byte_end":645,"line_start":22,"line_end":22,"column_start":5,"column_end":17,"is_primary":true,"text":[{"text":"    assert_unpin(generator);","highlight_start":5,"highlight_end":17}],"label":"the trait `std::pin::Unpin` is not implemented for `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"required by `assert_unpin`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":522,"byte_end":553,"line_start":15,"line_end":15,"column_start":1,"column_end":32,"is_primary":true,"text":[{"text":"fn assert_uned; 24 ignored; 0 measured; 0 filtered out
[00:50:02] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:50:02] 
[00:50:02] 
[00:50:02] 
[00:50:02] 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:50:02] 
[00:50:02] 
[00:50:02] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:02] Build completed unsuccessfully in 0:03:39
[00:50:02] Build completed unsuccessfully in 0:03:39
[00:50:02] Makefile:58: recipe for target 'check' failed
travis_time:end:28d14aaf:start=1541438213255111125,finish=1541441215701361951,duration=3002446250826

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:008a4ce9
---
travis_time:end:21a2fd98:start=1541441216704983568,finish=1541441216711152187,duration=6168619
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:06437460
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'

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)

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 5, 2018

-	error[E0277]: the trait bound `[static generator@$DIR/static-not-unpin.rs:19:25: 21:6 _]: std::marker::Unpin` is not satisfied
+	error[E0277]: the trait bound `[static generator@$DIR/static-not-unpin.rs:19:25: 21:6 _]: std::pin::Unpin` is not satisfied

It definitely mentions std::marker::Unpin when I run this test locally (on x86_64-apple-darwin). Is the choice of which path to use maybe not guaranteed?

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 6, 2018

And testing on an x86_64-unknown-linux-gnu device at work with ./x.py test src/test/ui --test-args generator/static-not-unpin.rs also passes. I've pushed a test commit that ensures items are iterated in a canonical order while building the visible_parent_map used for displaying types in diagnostics, if that fixes it then I'm not sure what the proper solution is, but at least know where the issue seems to be.

@rust-highfive
Copy link
Collaborator

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:end:006a0653:start=1541510755552850360,finish=1541510956949816547,duration=201396966187
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:end: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:end: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)

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 6, 2018

So, that caused my new test case to pass, but broke a lot of other cases that relied on the previous ordering. I would have thought that the default ordering would be by declaration order, but I don't know how that could be different between my machines and travis'.

@withoutboats
Copy link
Contributor

So this is basically what we always meant to do, just at the time Zoxc implemented the previous iteration of the generator API, Pin didn't exist yet. This will require a significant rewrite of futures-async-await, though my impression is that no one is using that and we maybe should just consider it completely deprecated instead.

std API changes look good. 👍

@bors r? @eddyb can you review the compiler changes here and also confirm that the generator transform doesn't need to be changed with this PR

@rust-highfive rust-highfive assigned eddyb and unassigned withoutboats Nov 6, 2018
@eddyb
Copy link
Member

eddyb commented Nov 6, 2018

The generator transform should use *(self.0) to refer to the state of type Self, instead of *self - I'm kind of surprised this doesn't trip anything already.

cc @Zoxc

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 6, 2018

I think I can see how to update the transform. At a guess it currently works because the output MIR is self-consistent with what type it thinks the generator argument is, and the type it thinks the argument is is layout compatible with the actual type passed in. There must not be any validation of the signature after the transform happens.

@Zoxc
Copy link
Contributor

Zoxc commented Nov 6, 2018

I suggesting replacing self with self.0 in create_generator_resume_function as we still use just self in the destructor.

@rust-highfive
Copy link
Collaborator

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:end:007b4bd6:start=1541530034381336574,finish=1541530110132424044,duration=75751087470
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:51:07] .................................................................................................... 1200/4996
[00:51:10] .................................................................................................... 1300/4996
[00:51:12] .................................................................................................... 1400/4996
[00:51:14] ......................................................................................i............. 1500/4996
[00:51:18] .........F..............................................i........................................... 1600/4996
[00:51:25] .................................................................................................... 1800/4996
[00:51:28] ..................................................................................................i. 1900/4996
[00:51:31] .................................................................................................... 2000/4996
[00:51:35] .................................................................................................... 2100/4996
---
[00:53:08] .................................................................................................... 4900/4996
----------------------------
[00:53:10] stderr:
[00:53:10] ------------------------------------------
[00:53:10] {"message":"the trait bound `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]: std::pin::Unpin` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":633,"byte_end":645,"line_start":22,"line_end":22,"column_start":5,"column_end":17,"is_primary":true,"text":[{"text":"    assert_unpin(generator);","highlight_start":5,"highlight_end":17}],"label":"the trait `std::pin::Unpin` is not implemented for `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"required by `assert_unpin`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":522,"byte_end":553,"line_start":15,"line_end":15,"column_start":1,"column_end":32,"is_primary":true,"text":[{"text":"fn assert_unpin<T: Unpin>(_: T) {","highlight_start":1,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]: std::pin::Unpin` is not satisfied\n  --> /checkout/src/test/ui/generator/static-not-unpin.rs:22:5\n   |\nLL |     assert_unpin(generator);\n   |     ^^^^^^^^^^^^ the trait `std::pin::Unpin` is not implemented for `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]`\n   |\nnote: required by `assert_unpin`\n  --> /checkout/src/test/ui/generator/static-not-unpin.rs:15:1\n   |\nLL | fn assert_unpin<T: Unpin>(_: T) {\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:53:10] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:53:10] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:53:10] ------------------------------------------
[00:53:10] 
[00:53:10] thread '[ui] ui/generator/static-not-unpin.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[00:53:10] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:53:10] 
[00:53:10] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:53:10] 
[00:53:10] 
[00:53:10] 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:53:10] 
[00:53:10] 
[00:53:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:53:10] Build completed unsuccessfully in 0:03:48
[00:53:10] Build completed unsuccessfully in 0:03:48
[00:53:10] Makefile:58: recipe for target 'check' failed
[00:53:10] make: *** [check] Error 1
55844 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib
55744 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu
55740 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release
52788 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/release/deps

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)

@rust-highfive
Copy link
Collaborator

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:end:0a6e59d7:start=1541545954255986712,finish=1541546010564436411,duration=56308449699
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:48:33] .................................................................................................... 1200/4996
[00:48:36] .................................................................................................... 1300/4996
[00:48:38] .................................................................................................... 1400/4996
[00:48:40] ......................................................................................i............. 1500/4996
[00:48:43] .........F..............................................i........................................... 1600/4996
[00:48:50] .................................................................................................... 1800/4996
[00:48:53] ..................................................................................................i. 1900/4996
[00:48:57] .................................................................................................... 2000/4996
[00:49:00] .................................................................................................... 2100/4996
---
[00:50:21] ..................................................................i................................. 4600/4996
[00:50:24] .................................................................................................... 4700/4996
[00:50:28] .................................................................................................... 4800/4996
[00:50:30] .................................................................................................... 4900/4996
ent the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":633,"byte_end":645,"line_start":22,"line_end":22,"column_start":5,"column_end":17,"is_primary":true,"text":[{"text":"    assert_unpin(generator);","highlight_start":5,"highlight_end":17}],"label":"the trait `std::pin::Unpin` is not implemented for `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"required by `assert_unpin`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":522,"byte_end":553,"line_start":15,"line_end":15,"column_start":1,"column_end":32,"is_primary":true,"text":[{"text":"fn assert_unpin<T: Unpin>(_: T) {","highlight_start":1,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]: std::pin::Unpin` is not satisfied\n  --> /checkout/src/test/ui/generator/static-not-unpin.rs:22:5\n   |\nLL |     assert_unpin(generator);\n   |     ^^^^^^^^^^^^ the trait `std::pin::Unpin` is not implemented for `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:19:25: 21:6 _]`\n   |\nnote: required by `assert_unpin`\n  --> /checkout/src/test/ui/generator/static-not-unpin.rs:15:1\n   |\nLL | fn assert_unpin<T: Unpin>(_: T) {\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:50:33] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:50:33] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:50:33] ------------------------------------------
[00:50:33] 
[00:50:33] thread '[ui] ui/generator/static-not-unpin.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[00:50:33] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:50:33] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:50:33] 
[00:50:33] 
[00:50:33] failures:
[00:50:33]     [ui] ui/generator/static-not-unpin.rs
[00in 0:03:38
[00:50:33] make: *** [check] Error 1
[00:50:33] Makefile:58: recipe for target 'check' failed
bootstrap-zemjd6kcyh2u
134664 ./obj/build/bootstrap/debug/incremental/bootstrap-zemjd6kcyh2u/s-f6fkjatig4-tz1331-22tmsi8iacpi9
130760 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu
130756 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release
123684 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps
111072 ./src/llvm/test/CodeGen
---
56044 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/release/build
55860 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot
55856 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib
55852 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib
55848 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-vis_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:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0b4a5ee4
travis_time:start:0b4a5ee4
$ 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:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:1fa6b13b
$ 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)

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 7, 2018

I think I have to also update the debug-info generation:

// Or is it the closure environment?
let (closure_layout, env_ref) = match arg.layout.ty.sty {
ty::RawPtr(ty::TypeAndMut { ty, .. }) |
ty::Ref(_, ty, _) => (bx.cx.layout_of(ty), true),
_ => (arg.layout, false)
};

I have a patch to do that, but I still have to figure out how to test it. There appear to be some debuginfo tests, but nothing covering generators, and when I run the existing tests I get

During startup program terminated with signal SIG113, Real-time event 113.

EDIT: Found the gdb issue, need to sign it for macOS, guess I just need to look into how to write the test for it now.

@withoutboats withoutboats mentioned this pull request Nov 7, 2018
5 tasks
@rust-highfive
Copy link
Collaborator

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:end:06075942:start=1541613675795346667,finish=1541613734053839950,duration=58258493283
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:44:58] .................................................................................................... 1200/4998
[00:45:00] .................................................................................................... 1300/4998
[00:45:02] .................................................................................................... 1400/4998
[00:45:04] ........................................................................................i........... 1500/4998
[00:45:07] ...........F..............................................i......................................... 1600/4998
[00:45:13] .................................................................................................... 1800/4998
[00:45:16] .................................................................................................... 1900/4998
[00:45:19] i................................................................................................... 2000/4998
[00:45:23] .................................................................................................... 2100/4998
---
[00:46:38] ....................................................................i............................... 4600/4998
[00:46:41] .................................................................................................... 4700/4998
[00:46:44] .................................................................................................... 4800/4998
[00:46:47] .................................................................................................... 4900/4998
st-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generator/static-not-unpin/auxiliary" "-A" "unused"
[00:46:49] ------------------------------------------
[00:46:49] 
[00:46:49] ------------------------------------------
[00:46:49] stderr:
[00:46:49] stderr:
[00:46:49] ------------------------------------------
[00:46:49] {"message":"the trait bound `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:21:25: 23:6 _]: std::pin::Unpin` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: Txpansion":null}],"children":[{"message":"required by `assert_unpin`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/generator/static-not-unpin.rs","byte_start":590,"byte_end":621,"line_start":17,"line_end":17,"column_start":1,"column_end":32,"is_primary":true,"text":[{"text":"fn assert_unpin<T: Unpin>(_: T) {","highlight_start":1,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:21:25: 23:6 _]: std::pin::Unpin` is not satisfied\n  --> /checkout/src/test/ui/generator/static-not-unpin.rs:24:5\n   |\nLL |     assert_unpin(generator);\n   |     ^^^^^^^^^^^^ the trait `std::pin::Unpin` is not implemented for `[static generator@/checkout/src/test/ui/generator/static-not-unpin.rs:21:25: 23:6 _]`\n   |\nnote: required by `assert_unpin`\n  --> /checkout/src/test/ui/generator/static-not-unpin.rs:17:1\n   |\nLL | fn assert_unpin<T: Unpin>(_: T) {\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:46:49] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:46:49] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:46:49] ------------------------------------------
[00:46:49] 
[00:46:49] 
[00:46:49] thread '[ui] ui/generator/static-not-unpin.r"--android-cross-path" "" "--color" "always"
[00:46:49] 
[00:46:49] 
[00:46:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:46:49] Build completed unsuccessfully in 0:03:25
[00:46:49] Build completed unsuccessfully in 0:03:25
[00:46:49] Makefile:58: recipe for target 'check' failed
[00:46:49] make: *** [check] Error 1

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)

@rust-highfive
Copy link
Collaborator

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:end:096a2d20:start=1541618766415612960,finish=1541618845949374911,duration=79533761951
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:53:45] .................................................................................................... 100/4998
[00:53:48] .................................................................................................... 200/4998
[00:53:51] ........................................................................ii...................ii..... 300/4998
[00:53:54] ...........................................................................................iii...... 400/4998
[00:53:57] ..iiiiiiii.iii...........................iii...........................................i...........i 500/4998
[00:54:04] .................................................................................................... 700/4998
[00:54:11] .....................................................................i...........i.................. 800/4998
[00:54:14] ........................................................................................iiiii....... 900/4998
[00:54:17] ...........ii.iiii.................................................................................. 1000/4998
---
[00:54:55] .................................................................................................... 2200/4998
[00:54:59] .................................................................................................... 2300/4998
[00:55:03] .................................................................................................... 2400/4998
[00:55:07] .................................................................................................... 2500/4998
[00:55:10] ...............................................................................iiiiiiiii............ 2600/4998
[00:55:18] ..............................ii.................................................................... 2800/4998
[00:55:20] .................................................................................................... 2900/4998
[00:55:24] .................................................................................................... 3000/4998
[00:55:27] .........................i.......................................................................... 3100/4998
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:09:38] 
[01:09:38] running 115 tests
[01:09:41] i..ii...iii..iii.....i...i.........i..iii...........i.....i.....ii...i..i.ii..............i...ii..ii 100/115
[01:09:41] .i....iiii.....
[01:09:41] 
[01:09:41]  finished in 3.593
[01:09:41] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:09:57] 
[01:09:57] running 119 tests
[01:10:22] .iiiii...i.....i..i...i..i.i..i.i...i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i. 100/119
[01:10:26] i......iii.i.....ii
[01:10:26] 
[01:10:26]  finished in 29.880
[01:10:26] travis_fold:end:test_debuginfo

---
[01:27:18] .................................................................................................... 1400/2170
[01:27:31] .................................................................................................... 1500/2170
[01:27:43] .................................................................................................... 1600/2170
[01:27:56] .................................................................................................... 1700/2170
[01:28:11] ................................................................................F................... 1800/2170
[01:28:39] .................................................................................................... 2000/2170
[01:28:57] ......................................................................................i............. 2100/2170
07] 
[01:29:07] error: test failed, to rerun pass '--doc'
[01:29:07] error: test failed, to rerun pass '--doc'
[01:29:07] 
[01:29:07] 
[01:29:07] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "core" "--" "--quiet"
[01:29:07] 
[01:29:07] 
[01:29:07] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:29:07] Build completed unsuccessfully in 0:39:17
[01:29:07] Build completed unsuccessfully in 0:39:17
[01:29:07] Makefile:58: recipe for target 'check' failed
[01:29:07] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0d6e2ed4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:131193ca:start=1541624207332080369,finish=1541624207338344236,duration=6263867
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:17838ed6
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); 

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)

@rust-highfive
Copy link
Collaborator

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:end:17ab3d7e:start=1541630891639197812,finish=1541630946689239275,duration=55050041463
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:48:01] .................................................................................................... 100/5000
[00:48:03] .................................................................................................... 200/5000
[00:48:06] ........................................................................ii...................ii..... 300/5000
[00:48:09] ...........................................................................................iii...... 400/5000
[00:48:11] ..iiiiiiii.iii...........................iii...........................................i...........i 500/5000
[00:48:18] .................................................................................................... 700/5000
[00:48:24] .....................................................................i...........i.................. 800/5000
[00:48:27] ........................................................................................iiiii....... 900/5000
[00:48:30] ...........ii.iiii.................................................................................. 1000/5000
---
[00:49:04] .................................................................................................... 2200/5000
[00:49:08] .................................................................................................... 2300/5000
[00:49:12] .................................................................................................... 2400/5000
[00:49:15] .................................................................................................... 2500/5000
[00:49:18] ....................................................................iiiiiiiii....................... 2600/5000
[00:49:25] ................................ii.................................................................. 2800/5000
[00:49:27] .................................................................................................... 2900/5000
[00:49:31] .................................................................................................... 3000/5000
[00:49:33] ...........................i........................................................................ 3100/5000
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:01:25] 
[01:01:25] running 115 tests
[01:01:28] i..ii...iii..iii.....i...i.........i..iii...........i.....i.....ii...i..i.ii..............i...ii..ii 100/115
[01:01:29] .i....iiii.....
[01:01:29] 
[01:01:29]  finished in 3.308
[01:01:29] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:01:42] 
[01:01:42] running 119 tests
[01:02:06] .iiiii...i.....i..i...i..i.i..i.i...i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i. 100/119
[01:02:09] i......iii.i.....ii
[01:02:09] 
[01:02:09]  finished in 27.163
[01:02:09] travis_fold:end:test_debuginfo

---
[01:32:47] 
[01:32:47] failures:
[01:32:47] 
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10741) stdout ----
[01:32:47] error[E0599]: no method named `resume` found for type `[generator@/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5:13: 9:2 _]` in the current scope
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10749:12
[01:32:47]    |
[01:32:47] 10 | unsafe { b.resume() };
[01:32:47] 
[01:32:47] 
[01:32:47] thread '/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10741)' panicked at 'Some expected error codes were not found: ["E0626"]', librustdoc/test.rs:328:9
[01:32:47] 
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10759) stdout ----
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10759) stdout ----
[01:32:47] error[E0599]: no method named `resume` found for type `[generator@/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5:13: 9:2 _]` in the current scope
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10767:12
[01:32:47]    |
[01:32:47] 10 | unsafe { b.resume() };
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10763:9
[01:32:47] 6 |     let a = 3;
[01:32:47]   |         ^
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10764:5
[01:32:47]   |
[01:32:47] 7 |     yield ();
[01:32:47] 
[01:32:47] thread '/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10759)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:32:47] 
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10776) stdout ----
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10776) stdout ----
[01:32:47] error[E0599]: no method named `resume` found for type `[generator@/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5:13: 10:2 _]` in the current scope
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10785:12
[01:32:47]    |
[01:32:47] 11 | unsafe { b.resume() };
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10780:7
[01:32:47]   |
[01:32:47] 6 |   let v = vec![1,2,3];
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10781:13
[01:32:47]   |
[01:32:47] 7 |   for &x in &v { // <-- borrow of `v` is still in scope...
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10781:14
[01:32:47]   |
[01:32:47] 7 |   for &x in &v { // <-- borrow of `v` is still in scope...
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10781:13
[01:32:47]   |
[01:32:47] 7 |   for &x in &v { // <-- borrow of `v` is still in scope...
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10781:8
[01:32:47]   |
[01:32:47] 7 |   for &x in &v { // <-- borrow of `v` is still in scope...
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:11
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10782:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // ...when this yield occurs.
[01:32:47] 
[01:32:47] 
[01:32:47] thread '/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10776)' panicked at 'Some expected error codes were not found: ["E0626"]', librustdoc/test.rs:328:9
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10791) stdout ----
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10791) stdout ----
[01:32:47] error[E0599]: no method named `resume` found for type `[generator@/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5:13: 10:2 _]` in the current scope
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10800:12
[01:32:47]    |
[01:32:47] 11 | unsafe { b.resume() };
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10795:7
[01:32:47]   |
[01:32:47] 6 |   let v = vec![1,2,3];
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10797:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10796:12
[01:32:47]   |
[01:32:47] 7 |   for x in v { // <-- Take ownership of the values instead!
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10797:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10796:12
[01:32:47]   |
[01:32:47] 7 |   for x in v { // <-- Take ownership of the values instead!
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10797:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10796:7
[01:32:47]   |
[01:32:47] 7 |   for x in v { // <-- Take ownership of the values instead!
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10797:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10797:11
[01:32:47]   |
[01:32:47] 8 |     yield x; // <-- Now yield is OK.
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10797:5
[01:32:47]   |
[01:32:47] 8 |     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] thread '/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10791)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:32:47] 
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10805) stdout ----
[01:32:47] ---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10805) stdout ----
[01:32:47] error[E0599]: no method named `resume` found for type `[generator@/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5:13: 12:2 _]` in the current scope
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10816:12
[01:32:47]    |
[01:32:47] 13 | unsafe { b.resume() };
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10809:7
[01:32:47]   |
[01:32:47] 6 |   let v = vec![1,2,3];
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10813:5
[01:32:47]   |
[01:32:47] 10|     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10812:9
[01:32:47]   |
[01:32:47] 9 |     let x = v[i]; // (*)
[01:32:47]   |
[01:32:47]   |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]  --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10813:5
[01:32:47]   |
[01:32:47] 10|     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] 
[01:32:47] error[E0698]: type inside generator must be known in this context
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10813:11
[01:32:47]    |
[01:32:47] 10 |     yield x; // <-- Now yield is OK.
[01:32:47]    |
[01:32:47]    |
[01:32:47] note: the type is part of the generator because of this `yield`
[01:32:47]   --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:10813:5
[01:32:47]    |
[01:32:47] 10 |     yield x; // <-- Now yield is OK.
[01:32:47] 
[01:32:47] thread '/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0626 (line 10805)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:32:47] 
[01:32:47] 
---
[01:32:47] 
[01:32:47] 
[01:32:47] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:32:47] Build completed unsuccessfully in 0:48:18
[01:32:47] make: *** [check] Error 1
[01:32:47] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:34c7013c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:17097852:start=1541636526678707974,finish=1541636526683975158,duration=5267184
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:222e35ec
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_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:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:344802da
travis_time:start:344802da
$ 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:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:00ee78e8
$ 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)

@rust-highfive
Copy link
Collaborator

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:end:14ce8bca:start=1541698916665810205,finish=1541698988581294421,duration=71915484216
$ git checkout -qf FETCH_HEAD
travis_fold:end: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:50:09] .................................................................................................... 100/5000
[00:50:12] .................................................................................................... 200/5000
[00:50:14] ........................................................................ii...................ii..... 300/5000
[00:50:17] ...........................................................................................iii...... 400/5000
[00:50:20] ..iiiiiiii.iii...........................iii...........................................i...........i 500/5000
[00:50:27] .................................................................................................... 700/5000
[00:50:33] .....................................................................i...........i.................. 800/5000
[00:50:36] ........................................................................................iiiii....... 900/5000
[00:50:39] ............iiiiii.................................................................................. 1000/5000
---
[00:51:14] .................................................................................................... 2200/5000
[00:51:19] .................................................................................................... 2300/5000
[00:51:22] .................................................................................................... 2400/5000
[00:51:26] .................................................................................................... 2500/5000
[00:51:29] ....................................................................iiiiiiiii....................... 2600/5000
[00:51:36] ................................ii.................................................................. 2800/5000
[00:51:39] .................................................................................................... 2900/5000
[00:51:43] .................................................................................................... 3000/5000
[00:51:46] ...........................i........................................................................ 3100/5000
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:10] 
[01:05:10] running 115 tests
[01:05:13] i..ii...iii..iii.....i...i.........i..iii...........i.....i.....ii...i..i.ii..............i...ii..ii 100/115
[01:05:13] .i.....iiii....
[01:05:13] 
[01:05:13]  finished in 3.416
[01:05:13] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:28] 
[01:05:28] running 119 tests
[01:05:53] .iiiii...i.....i..i...i..i.i..i.i...i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i. 100/119
[01:05:57] i......iii.i.....ii
[01:05:57] 
[01:05:57]  finished in 29.050
[01:05:57] travis_fold:end:test_debuginfo

---
[01:39:34] doc tests for: /checkout/src/doc/unstable-book/src/language-features/const-fn.md
[01:39:35] doc tests for: /checkout/src/doc/unstable-book/src/language-features/crate-visibility-modifier.md
[01:39:35] doc tests for: /checkout/src/doc/unstable-book/src/language-features/custom-test-frameworks.md
[01:39:35] doc tests for: /checkout/src/doc/unstable-book/src/language-features/doc-alias.md
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
[01:39:36]    |
[01:39:36]    = note: expected type `fn(std::pin::Pin<&mut main::__Generator>) -> std::ops::GeneratorState<i32, &'static str>`
[01:39:36]               found type `unsafe fn(&mut main::__Generator) -> std::ops::GeneratorState<i32, &'static str>`
[01:39:36] thread '/checkout/src/doc/unstable-book/src/language-features/generators.md - generators::_::Generators_as_state_machines (line 185)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:39:36] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:39:36] 
[01:39:36] ---- /checkout/src/doc/unstable-book/src/language-features/generators.md - generators (line 59) stdout ----
[01:39:36] ---- /checkout/src/doc/unstable-book/src/language-features/generators.md - generators (line 59) stdout ----
[01:39:36] error[E0599]: no method named `resume` found for type `[generator@/checkout/src/doc/unstable-book/src/language-features/generators.md:7:25: 11:6 _]` in the current scope
[01:39:36]    |
[01:39:36]    |
[01:39:36] 14 |     unsafe { generator.resume() };
[01:39:36] 
[01:39:36] 
[01:39:36] error[E0599]: no method named `resume` found for type `[generator@/checkout/src/doc/unstable-book/src/language-features/generators.md:7:25: 11:6 _]` in the current scope
[01:39:36]    |
[01:39:36]    |
[01:39:36] 16 |     unsafe { generator.resume() };
[01:39:36] 
[01:39:36] thread '/checkout/src/doc/unstable-book/src/language-features/generators.md - generators (line 59)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:39:36] 
[01:39:36] ---- /checkout/src/doc/unstable-book/src/language-features/generators.md - generators::_::Generators_as_state_machines (line 166) stdout ----
[01:39:36] ---- /checkout/src/doc/unstable-book/src/language-features/generators.md - generators::_::Generators_as_state_machines (line 166) stdout ----
[01:39:36] error[E0599]: no method named `resume` found for type `[generator@/checkout/src/doc/unstable-book/src/language-features/generators.md:8:25: 11:6 ret:_ _]` in the current scope
[01:39:36]    |
[01:39:36]    |
[01:39:36] 13 |     unsafe { generator.resume() };
[01:39:36] 
[01:39:36] 
[01:39:36] error[E0599]: no method named `resume` found for type `[generator@/checkout/src/doc/unstable-book/src/language-features/generators.md:8:25: 11:6 ret:_ _]` in the current scope
[01:39:36]    |
[01:39:36]    |
[01:39:36] 14 |     unsafe { generator.resume() };
[01:39:36] 
[01:39:36] 
[01:39:36] error[E0698]: type inside generator must be known in this context
[01:39:36]   |
[01:39:36] 9 |         yield 1;
[01:39:36]   |               ^
[01:39:36]   |
[01:39:36]   |
[01:39:36] note: the type is part of the generator because of this `yield`
[01:39:36]   |
[01:39:36] 9 |         yield 1;
[01:39:36]   |         ^^^^^^^
[01:39:36] 
---
[01:39:36] 
[01:39:36] 
[01:39:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:39:36] Build completed unsuccessfully in 0:53:09
[01:39:36] Makefile:58: recipe for target 'check' failed
[01:39:36] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:02b0a750
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:03da6a5a:start=1541704977904294335,finish=1541704977910144702,duration=5850367
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1314644c
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1

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)

// option. This file may not be copied, modified, or distributed
// except according to those terms.

// normalize-stderr-test "std::pin::Unpin" -> "std::marker::Unpin"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not been able to figure out why travis shows a different path for this compared to the two machines with rustc I've been able to test on. I attempted to trace through where the diagnostics get the path from, and as far as I can tell everything should be deterministic. The path chosen appears to come from the visible_parent_map built here, this is done as a BFS, and should be deterministic within a single crate. Following the order of an items children back from here through the different representations all the way to libsyntax there doesn't appear to be anything that should change the order, then in libsyntax an items children come out in parse order. std re-exports the core::marker module before the core::pin module, so the path chosen to be displayed should be std::marker::Pin.

Parse/declaration order is also consistent with the failures in https://travis-ci.org/rust-lang/rust/jobs/451369080, that test commit forced the child order while constructing visible_parent_map to be sorted by name. All the failures were swapping paths that were declared earlier with paths declared later but alphabetically sorted earlier.

This will also become moot soon as #55766 is proposing to remove the std::pin::Unpin re-export (although, it does plan to add it to the prelude which will then become the preferred path).

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 8, 2018

Travis appears to have found all the test cases I didn't...

Other than the comment I just left this is complete as far as I'm aware. I'd prefer to land this with that workaround and I'll open an issue about the non-deterministic diagnostics. Let me know whether there's anything else and I can squash all the fixups in.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 27, 2019
@bors
Copy link
Contributor

bors commented Jan 27, 2019

☔ The latest upstream changes (presumably #57765) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 27, 2019
@Nemo157
Copy link
Member Author

Nemo157 commented Jan 27, 2019

Pushed an untested rebase, there were only trivial import conflicts in the run-pass tests (that didn't even renumber the error logs) so shouldn't have broken anything.

@Zoxc
Copy link
Contributor

Zoxc commented Jan 28, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jan 28, 2019

📌 Commit a21c95f has been approved by Zoxc

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 28, 2019
@bors
Copy link
Contributor

bors commented Jan 28, 2019

⌛ Testing commit a21c95f with merge d8a0dd7...

bors added a commit that referenced this pull request Jan 28, 2019
Use pinning for generators to make trait safe

I'm unsure whether there needs to be any changes to the actual generator transform. Tests are passing so the fact that `Pin<&mut T>` is fundamentally the same as `&mut T` seems to allow it to still work, but maybe there's something subtle here that could go wrong.

This is specified in [RFC 2349 § Immovable generators](https://github.com/rust-lang/rfcs/blob/master/text/2349-pin.md#immovable-generators) (although, since that RFC it has become safe to create an immovable generator, and instead it's unsafe to resume any generator; with these changes both are now safe and instead the unsafety is moved to creating a `Pin<&mut [static generator]>` which there are safe APIs for).

CC #43122
@bors
Copy link
Contributor

bors commented Jan 28, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Zoxc
Pushing d8a0dd7 to master...

@bors bors merged commit a21c95f into rust-lang:master Jan 28, 2019
@inkyu-prestolabs
Copy link

Can I ask a question? previously, i was storing a generator using this way:

pub struct MyStruct {
    pub gen: Box<dyn std::ops::Generator<Return = Result<(), Error>, Yield = MyYield>>,
}

But after this change, how can I store a generator in a struct?

@Arnavion
Copy link

pub struct MyStruct {
    pub gen: std::pin::Pin<Box<dyn std::ops::Generator<Return = Result<(), Error>, Yield = MyYield>>>,
}

which you can get from Box::pin

@Nemo157 Nemo157 deleted the pinned-generators branch January 31, 2019 08:28
@inkyu-prestolabs
Copy link

@Arnavion wow.. thank you very much!!

@Nemo157
Copy link
Member Author

Nemo157 commented Jan 31, 2019

As a side note, to then poll it you can use self.gen.as_mut().resume() (via Pin::as_mut).

phil-opp added a commit to embed-rs/stm32f7-discovery that referenced this pull request Feb 1, 2019
Generators now use `Pin` to make `resume` safe: rust-lang/rust#55704
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet