Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 15 pull requests #54389

Merged
merged 49 commits into from
Sep 21, 2018
Merged

Rollup of 15 pull requests #54389

merged 49 commits into from
Sep 21, 2018

Conversation

kennytm
Copy link
Member

@kennytm kennytm commented Sep 20, 2018

Successful merges:

newpavlov and others added 30 commits July 29, 2018 07:00
The names `Math_*` were given to help undefined symbol messages indicate how to
implement them, but these are all implemented in compiler-rt now so there's no
need to rename them! This change should make it so wasm binaries by default, no
matter the math symbols used, will not have unresolved symbols.
Historically LLD has emitted warnings for various reasons but all the bugs have
since been fixed (yay!) and by enabling fatal warnings we should be able to head
off bugs like rust-lang#53390 sooner.
The expected.clone() calls were not needed for the tests. This is
just to keep consistency between the test cases.
@kennytm
Copy link
Member Author

kennytm commented Sep 20, 2018

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:57:58] ....................................................................................................
[00:58:01] .....................................................i..............................................
[00:58:04] ....................................................................................................
[00:58:07] ....................................................................................................
[00:58:10] .iiiiiiiii..........................................................................................
[00:58:17] ....................................................................................................
[00:58:20] .....................................................................................i..............
[00:58:23] ....................................................................................................
[00:58:26] ........................................i.i..ii.....................................................
[00:58:26] ........................................i.i..ii.....................................................
[00:58:29] ....................................................................................................
[00:58:32] ........................................................i......................i....................
[00:58:36] ....................................................................................................
[00:58:39] ............................................................................................i..i..i.
[00:58:41] ....................i...i.............ii.......................ii........................iiiii......
[00:58:45] .....................................................................iiiii......................i...
[00:58:51] .........................................F..........................................................
[00:59:07] ....................................................................................................
[00:59:15] ....................................................................................................
[00:59:23] ....................................................................................................
[00:59:37] ....................................................................................................
---
[01:03:52] .........i.ii.ii.ii.............................i...................................................
[01:03:52] .........
[01:03:52] failures:
[01:03:52] 
[01:03:52] ---- [ui (nll)] ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs stdout ----
[01:03:52] 
[01:03:52] 
[01:03:52] 9    = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
[01:03:52] 11 
[01:03:52] - error[E0382]: borrow of moved value: `a`
[01:03:52] -   --> $DIR/dbg-macro-move-semantics.rs:11:18
[01:03:52] -    |
[01:03:52] -    |
[01:03:52] - LL |     let _ = dbg!(a);
[01:03:52] -    |             ------- value moved here
[01:03:52] - LL |     let _ = dbg!(a);
[01:03:52] -    |                  ^ value borrowed here after move
[01:03:52] -    |
[01:03:52] -    = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
[01:03:52] - 
[01:03:52] - error[E0382]: use of moved value: `a`
[01:03:52] -   --> $DIR/dbg-macro-move-semantics.rs:11:13
[01:03:52] -    |
[01:03:52] -    |
[01:03:52] - LL |     let _ = dbg!(a);
[01:03:52] -    |             ------- value moved here
[01:03:52] - LL |     let _ = dbg!(a);
[01:03:52] -    |             ^^^^^^^ value used here after move
[01:03:52] -    |
[01:03:52] -    = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
[01:03:52] - 
[01:03:52] - error: aborting due to 3 previous errors
[01:03:52] + error: aborting due to previous error
[01:03:52] 35 
[01:03:52] 35 
[01:03:52] 36 For more information about this error, try `rustc --explain E0382`.
[01:03:52] 37 
[01:03:52] 
[01:03:52] 
[01:03:52] The actual stderr differed from the expected stderr.
[01:03:52] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll/dbg-macro-move-semantics.nll.stderr
[01:03:52] To update references, rerun the tests and pass the `--bless` flag
[01:03:52] To only update this specific test, also pass `--test-args rfc-2361-dbg-macro/dbg-macro-move-semantics.rs`
[01:03:52] error: 1 errors occurred comparing output.
[01:03:52] status: exit code: 1
[01:03:52] status: exit code: 1
[01:03:52] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.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/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll/a" "-Zborrowck=mir" "-Ztwo-phase-borrows" "-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/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll/auxiliary" "-A" "unused"
[01:03:52] ------------------------------------------
[01:03:52] 
[01:03:52] ------------------------------------------
[01:03:52] stderr:
[01:03:52] stderr:
[01:03:52] ------------------------------------------
[01:03:52] {"message":"use of moved value: `a`","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\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":"<dbg macros>","byte_start":36,"byte_end":39,"line_start":3,"line_end":3,"column_start":1,"column_end":4,"is_primary":false,"text":[{"text":"tmp => {","highlight_start":1,"highlight_end":4}],"label":"value moved here","suggested_replacement":null,"suggestion_applicability":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs","byte_start":184,"byte_end":191,"line_start":10,"line_end":10,"column_start":13,"column_end":20,"is_primary":false,"text":[{"text":"    let _ = dbg!(a);","highlight_start":13,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},"macro_decl_name":"dbg!","def_site_span":{"file_name":"<dbg macros>","byte_start":0,"byte_end":152,"line_start":1,"line_end":6,"column_start":1,"column_end":18,"is_primary":false,"text":[{"text":"( $ val : expr ) => {","highlight_start":1,"highlight_end":22},{"text":"match $ val {","highlight_start":1,"highlight_end":14},{"text":"tmp => {","highlight_start":1,"highlight_end":9},{"text":"eprintln ! (","highlight_start":1,"highlight_end":13},{"text":"\"[{}:{}] {} = {:#?}\" , file ! (  ) , line ! (  ) , stringify ! ( $ val ) , &","highlight_start":1,"highlight_end":77},{"text":"tmp ) ; tmp } } }","highlight_start":1,"highlight_end":18}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}}},{"file_name":"/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs","byte_start":210,"byte_end":211,"line_start":11,"line_end":11,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":"    let _ = dbg!(a);","highlight_start":18,"highlight_end":19}],"label":"value used here after move","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value: `a`\n  --> /checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs:11:18\n   |\nLL |     let _ = dbg!(a);\n   |             ------- value moved here\nLL |     let _ = dbg!(a);\n   |                  ^ value used here after move\n   |\n   = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait\n   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n"}
[01:03:52] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:03:52] {"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"}
[01:03:52] ------------------------------------------
[01:03:52] 
[01:03:52] 
[01:03:52] thread '[ui (nll)] ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3205:9
[01:03:52] 
[01:03:52] 
[01:03:52] failures:
[01:03:52] failures:
[01:03:52]     [ui (nll)] ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs
[01:03:52] test result: FAILED. 6720 passed; 1 failed; 88 ignored; 0 measured; 0 filtered out
[01:03:52] 
[01:03:52] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:496:22
[01:03:52] 
[01:03:52] 
[01:03:52] 
[01:03:52] 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" "--compare-mode" "nll"
[01:03:52] 
[01:03:52] 
[01:03:52] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:03:52] Build completed unsuccessfully in 0:15:02
[01:03:52] Build completed unsuccessfully in 0:15:02
[01:03:52] Makefile:58: recipe for target 'check' failed
[01:03:52] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0b5b2f56
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:04fa5074:start=1537454605543258552,finish=1537454605547278048,duration=4019496
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0395b4be
$ 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:0ec5ff88
travis_time:start:0ec5ff88
$ 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:0e6ee1cb
$ 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)

@kennytm
Copy link
Member Author

kennytm commented Sep 20, 2018

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 20, 2018
…imulacrum

Remove unneeded clone() from tests in librustdoc

The expected.clone() calls were not needed for the tests. This is
just to keep consistency between the test cases.
rustc: future-proof error reporting for polymorphic constants in types.

Currently, we have 3 categories of positions where a constant can be used (`const` and associated `const` can be considered "aliases" for an expression):
* runtime - if the function is polymorphic, we could even just warn and emit a panic
* `static` - always monomorphic, so we can error at definition site
* type-system - **must** *enforce* evaluation success where it was written

That last one is the tricky one, because we can't easily turn *the presence* a type with an erroring const into a runtime panic, and we'd have to do post-monomorphization errors (which we'd rather avoid).

<hr/>

The solution we came up with, as part of the plans for const generics, is to require successful evaluation wherever a constant shows up in a type (currently in array lengths, and values for const parameters in the future), *through* the WF system, which means that in certain situations (e.g. function signatures) we can assume evaluation *will* succeed, and require it of users (e.g. callers) instead (we've been doing this for lifetime bounds, for a long time now, and it's pretty ergonomic).

So once we do sth about rust-lang#43408, this example *should* work, by propagating the responsability, to callers of `foo::<X>`, of proving `std::mem::size_of::<X>()` succeeds (and those callers can do the same).
```rust
pub fn foo<T>(_: [u8; std::mem::size_of::<T>()]) {}
```
But this one *shouldn't*, as there is nothing in the signature/bounds to indicate it:
```rust
pub fn bar<T>() {
    let _: [u8; std::mem::size_of::<T>()];
}
```

<hr/>

I've come across some bit of code in the compiler that ignores const-evaluation errors *even when* they come from a constant in a type, and I've added an ICE *only when* there are no other reported errors (e.g. it's fine to ignore evaluation errors if the constant doesn't even type-check).

r? @nikomatsakis cc @oli-obk @RalfJung @Centril
…omatsakis

Pass --batch to gdb

In one of my travis builds, I was surprised to find that the gdb
pager was in use and caused travis to time out.  Adding `--batch`
to the gdb invocation will disable the pager.  Note that the
`-ex q` is retained, to make sure gdb exits with status 0, just in
case `set -e` is in effect somehow.
…borrow-test, r=pnkfelix

Add regression test for thread local static mut borrows

FIXME(rust-lang#54366) - We probably shouldn't allow `#[thread_local] static mut` to get a `'static` lifetime, but for now, we should at least test the behavior that `rustc` currently has.
@kennytm
Copy link
Member Author

kennytm commented Sep 20, 2018

@bors r+

Removed #54317 (UI test not up-to-date).

@bors
Copy link
Contributor

bors commented Sep 20, 2018

📌 Commit ec08596 has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 20, 2018
@kennytm kennytm changed the title Rollup of 16 pull requests Rollup of 15 pull requests Sep 20, 2018
@bors
Copy link
Contributor

bors commented Sep 20, 2018

⌛ Testing commit ec08596 with merge 2fa1390...

bors added a commit that referenced this pull request Sep 20, 2018
Rollup of 15 pull requests

Successful merges:

 - #52813 (Duration div mul extras)
 - #53470 (Warn about metadata loader errors)
 - #54233 (Remove LLVM 3.9 workaround.)
 - #54257 (Switch wasm math symbols to their original names)
 - #54258 (Enable fatal warnings for the wasm32 linker)
 - #54266 (Update LLVM to fix "bool" arguments on PPC32)
 - #54290 (Switch linker for aarch64-pc-windows-msvc from LLD to MSVC)
 - #54292 (Suggest array indexing when tuple indexing on an array)
 - #54295 (A few cleanups and minor improvements to rustc/traits)
 - #54298 (miri: correctly compute expected alignment for field)
 - #54333 (Update The Book to latest)
 - #54337 (Remove unneeded clone() from tests in librustdoc)
 - #54346 (rustc: future-proof error reporting for polymorphic constants in types.)
 - #54362 (Pass --batch to gdb)
 - #54367 (Add regression test for thread local static mut borrows)
@bors
Copy link
Contributor

bors commented Sep 21, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: kennytm
Pushing 2fa1390 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet