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

Open
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
9 participants
@Nemo157
Contributor

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 5, 2018

r? @dtolnay

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

@dtolnay

This comment has been minimized.

Member

dtolnay commented Nov 5, 2018

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

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 5, 2018

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 6, 2018

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

This comment has been minimized.

Contributor

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'.

@Nemo157 Nemo157 force-pushed the Nemo157:pinned-generators branch from ded732d to dea099a Nov 6, 2018

@withoutboats

This comment has been minimized.

Contributor

withoutboats commented Nov 6, 2018

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 6, 2018

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 7, 2018

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

This comment has been minimized.

Contributor

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 referenced this pull request Nov 7, 2018

Open

[Stabilization] Pin APIs #55766

0 of 5 tasks complete
@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 7, 2018

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 7, 2018

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 8, 2018

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 8, 2018

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"

This comment has been minimized.

@Nemo157

Nemo157 Nov 8, 2018

Contributor

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

This comment has been minimized.

Contributor

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.

@Mark-Simulacrum

This comment has been minimized.

Member

Mark-Simulacrum commented Nov 15, 2018

@eddyb Can you take a look at the latest status here? I think @Nemo157 may have resolved your comments/requests.

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 15, 2018

r? @Zoxc

@rust-highfive rust-highfive assigned Zoxc and unassigned eddyb Nov 15, 2018

@Zoxc

This comment has been minimized.

Contributor

Zoxc commented Nov 15, 2018

@Nemo157 Did you print the MIR output of the generator transformation to check that it is now correct and no longer just happens to work?

@Nemo157

This comment has been minimized.

Contributor

Nemo157 commented Nov 15, 2018

@Zoxc yep, here's one MIR dump I had laying around still. Once I changed the generator transform itself I actually got an assertion during codegen because the signature didn't match, that's how I found the signature being generated here and updated that as well. So I'm fairly confident it's all lining up correctly now.

if lang_items.unpin_trait() == Some(def_id) {
// OK to skip binder because the substs on generator types never
// touch bound regions, they just capture the in-scope
// type/region parameters

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

It is ok to skip the binder here because we aren't looking at any regions, just if the generator is immovable.
I'm not sure this is the correct place for this check. I'd expect it to be in some auto trait related code, creating !Unpin impls for immovable generators. This may have the same effect though.

This comment has been minimized.

@Nemo157

Nemo157 Nov 15, 2018

Contributor

Updated comment.

That's what I was thinking of initially, but I couldn't find anything similar to that (if you have some pointers for where to look I can take another look at it). This definitely gives the correct error message.

This comment has been minimized.

@Nemo157

Nemo157 Nov 15, 2018

Contributor

Actually, I think I've found a better place to put this. In assemble_candidates_from_auto_impls I can just suppress adding a candidate for static generators when the trait is Unpin. I'll check whether that works now.

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

@nikomatsakis @arielb1 Where would the correct place to put this be? Or does it not matter since the user can't write impls since generators are unnameable?

set_task_waker(lw, || match unsafe { Pin::get_mut_unchecked(self).0.resume() } {
// Safe because we're !Unpin + !Drop mapping to a ?Unpin value
let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };
set_task_waker(lw, || match gen.resume() {

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

@withoutboats Did you look at this?

use std::ops::Generator;
fn msg() -> u32 {
0
}
pub fn foo() -> impl Generator<Yield=(), Return=u32> {
pub fn foo() -> impl Generator<Yield=(), Return=u32> + Unpin {

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

Why did you add the Unpin bound here and on other tests?

This comment has been minimized.

@Nemo157

Nemo157 Nov 15, 2018

Contributor

Unpin is necessary to use Pin::new, otherwise the tests would need to use the unsafe Pin::new_unchecked (this may not actually be necessary with impl Trait, Unpin probably leaks like other auto-traits, I didn't check that).

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

Yeah, I was expecting Unpin to leak here, so this change shouldn't be necessary.

This comment has been minimized.

@Nemo157

Nemo157 Nov 21, 2018

Contributor

Removed the leaking Unpins.

|| {
if false {
yield;
}
}
}
pub fn bar<T: 'static>(t: T) -> Box<Generator<Yield = T, Return = ()>> {
pub fn bar<T: Unpin + 'static>(t: T) -> Box<Generator<Yield = T, Return = ()> + Unpin> {

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

The Unpin bound on T here is strange too.

This comment has been minimized.

@Nemo157

Nemo157 Nov 15, 2018

Contributor

I think that's necessary because non-static generators are still subject to the normal structural Unpin checks. Rebuilding without it now to check (will be a while as I've got to do a fresh build).

This comment has been minimized.

@Nemo157

Nemo157 Nov 15, 2018

Contributor

Yep, without it gives:

   | |______^ within `[generator@/Users/Nemo157/sources/rust/src/test/run-pass/generator/auxiliary/xcrate.rs:25:14: 27:6 t:T _]`, the trait `std::marker::Unpin` is not implemented for `T`

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

Is that correct? Should movable generators always implement Unpin? I why is Unpin an auto trait? I haven't looked at this stuff in a while =P

This comment has been minimized.

@Nemo157

Nemo157 Nov 16, 2018

Contributor

So, I haven't spent time verifying this, but having non-static generators use the structural definition of pinning makes this sound code:

fn foo() -> impl Generator<Yield = usize, Return = ()> {
    static || {
        let x = 5;
        let x = &x;
        yield *x;
        yield *x;
    }
}

fn bar() -> impl Generator<Yield = usize, Return = ()> {
    || {
        let mut foo = foo();
        loop {
            let val = {
                let mut foo = unsafe { Pin::new_unchecked(&mut foo) };
                match foo.resume() {
                    GeneratorState::Yielded(val) => val,
                    GeneratorState::Complete(()) => break,
                }
            };
            yield val;
        }
    }
}

I don't know if there would be a way to make this safe code, the stack pinning macro would require borrows to persist across yields, but maybe something like this would be useful?

It also seems to me that this should be investigated for both closures and generators at the same time, they likely have similar reasons to either propagate or force Unpin.

@withoutboats any opinion (and does closures interaction with Unpin matter for stabilization of Pin)?

This comment has been minimized.

@withoutboats

withoutboats Nov 16, 2018

Contributor

There should be some way to make generators which are checked for Unpin, so they can be moved in and out of pins (and thus moved between resume calls). Currently its not annotating the generator static.

It might not be correct for that behavior to check that their members are unpin, maybe it only should check that they don't themselves borrow across yields, and omit the generated negative impl of unpin.

I think the current closure behavior around Unpin is correct in that it is consistent with other auto traits like Send etc; if anything should change (not sure that it should) it would be generator syntax.

This comment has been minimized.

@Nemo157

Nemo157 Nov 16, 2018

Contributor

maybe it only should check that they don't themselves borrow across yields, and omit the generated negative impl of unpin.

That's basically what is happening now, for static annotated generators there's an implicit negative impl of Unpin, for other generators there's no implicit impl (either positive or negative) and it's falling back to structural checking of the upvars and state that is live across yield points (the closed over environment).

We could force a positive impl of Unpin for non-static generators instead and say that it's unsound to create a pinned reference into the environment, even just between yield points. You would still be able to create pinned references to values that are only live between yield points since they are true stack variables. And if you need pinned references into the environment you can force the generator to be immovable via static. As far as I'm aware this wouldn't remove any capabilities; a non-static generator that is !Unpin because of structural recursion and a static generator appear the same externally, and when implementing the generator you always have the choice to add or remove the static annotation


Thinking about it a bit more I guess this doesn't matter for closure's as we don't have FnPin, there's no way to call a closure such that it could soundly create a pinned reference into its environment (EDIT: other than FnOnce, but at that point you can't move the closure after calling anyway).

This comment has been minimized.

@Nemo157

Nemo157 Nov 21, 2018

Contributor

I've added an unconditional implementation of Unpin for movable generators.

assert_eq!(generator.resume(), GeneratorState::Yielded(()));
assert_eq!(generator.resume(), GeneratorState::Complete(()));
}
let mut generator = unsafe { Pin::new_unchecked(&mut generator) };

This comment has been minimized.

@Zoxc

Zoxc Nov 15, 2018

Contributor

Why does this use unsafe code?

This comment has been minimized.

@Nemo157

Nemo157 Nov 16, 2018

Contributor

Constructing a Pin to a reference to !Unpin value is unsafe. There is a safe macro-based solution to do so on the stack, but it's not included in std. I could use a Pin<Box> here instead safely, but I thought better to just keep it on the stack.

I can add a note about why this is safe (same reason as pin_mut! is safe, it shadows the owning binding so the value cannot be moved after this line).

This comment has been minimized.

@Nemo157

Nemo157 Nov 21, 2018

Contributor

Added a note on the safety here.

@bors

This comment has been minimized.

Contributor

bors commented Nov 17, 2018

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

@Nemo157 Nemo157 force-pushed the Nemo157:pinned-generators branch 2 times, most recently from aae512c to 10fccf0 Nov 21, 2018

@bors

This comment has been minimized.

Contributor

bors commented Dec 2, 2018

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

@Dylan-DPC

This comment has been minimized.

Member

Dylan-DPC commented Dec 10, 2018

ping from triage
@Zoxc awaiting your review on this
@Nemo157 can you update this by resolving the conflicts?

@Nemo157 Nemo157 force-pushed the Nemo157:pinned-generators branch from 10fccf0 to 84363df Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment