bors [Fri, 23 Nov 2018 11:26:48 +0000 (11:26 +0000)]
Auto merge of #55808 - estebank:type-arguments, r=petrochenkov
Suggest correct syntax when writing type arg instead of assoc type
- When confusing an associated type with a type argument, suggest the appropriate syntax. Given `Iterator<isize>`, suggest `Iterator<Item = isize>`.
- When encountering multiple missing associated types, emit only one diagnostic.
- Point at associated type def span for context.
- Point at each extra type argument.
bors [Fri, 23 Nov 2018 01:02:21 +0000 (01:02 +0000)]
Auto merge of #54071 - eddyb:alignsssss, r=oli-obk
rustc_target: separate out an individual alignment quantity type from Align.
Before this PR, `rustc_target::abi::Align` combined "power-of-two alignment quantity" semantics, with a distinction between ABI (required) and preferred alignment (by having two quantities).
After this PR, `Align` is only *one* such quantity, and a new `AbiAndPrefAlign` type is introduced to hold the pair of ABI and preferred `Align` quantities.
`Align` is used everywhere one quantity is necessary/sufficient, simplifying some of the code in codegen/miri, while `AbiAndPrefAlign` only in layout computation (to propagate preferred alignment).
bors [Thu, 22 Nov 2018 20:29:51 +0000 (20:29 +0000)]
Auto merge of #56143 - nikomatsakis:issue-56128-segment-id-ice-nightly, r=petrochenkov
Issue 56128 segment id ice nightly
Tentative fix for #56128
From what I can tell, the problem is that if you have `pub(super) use foo::{a, b}`, then when we explode the `a` and `b`, the segment ids from the `super` path were not getting cloned. However, once I fixed *that*, then I ran into a problem that the "visibility" node-ids were not present in the final HIR -- this is because the visibility of the "stem" that is returned in this case was getting reset to inherited. I don't *think* it is a problem to undo that, so that the visibility is returned unmodified.
````
missed another one in the README
run "util/dev update_lints"
rust-lang-nursery/rust-clippy => rust-lang/rust-clippy
Address 'clippy::single-match' dogfood lint
Fix nit
Address travis CI lint failure
Update trivially_copy_pass_by_ref with Trait stderr output
issue#3318 run trivially_copy_pass_by_ref for traits
Update trivially_copy_pass_by_ref with Trait examples
Fix awkward wording
Document how to lint local Clippy changes with locally built Clippy
Enable rustup clippy to refer to the correct documentation
rustup https://github.com/rust-lang/rust/pull/52591
remove unused allow() attributes, NFC
Add regression test
Don't emit suggestion when inside of a macro
````
````
missed another one in the README
run "util/dev update_lints"
rust-lang-nursery/rust-clippy => rust-lang/rust-clippy
Address 'clippy::single-match' dogfood lint
Fix nit
Address travis CI lint failure
Update trivially_copy_pass_by_ref with Trait stderr output
issue#3318 run trivially_copy_pass_by_ref for traits
Update trivially_copy_pass_by_ref with Trait examples
Fix awkward wording
Document how to lint local Clippy changes with locally built Clippy
Enable rustup clippy to refer to the correct documentation
rustup https://github.com/rust-lang/rust/pull/52591
remove unused allow() attributes, NFC
Add regression test
Don't emit suggestion when inside of a macro
````
bors [Thu, 22 Nov 2018 06:50:18 +0000 (06:50 +0000)]
Auto merge of #53918 - Havvy:doc-sort-by, r=GuillaumeGomez
Doc total order requirement of sort(_unstable)_by
I took the definition of what a total order is from the Ord trait
docs. I specifically put "elements of the slice" because if you
have a slice of f64s, but know none are NaN, then sorting by
partial ord is total in this case. I'm not sure if I should give
such an example in the docs or not.
Niko Matsakis [Wed, 21 Nov 2018 20:34:11 +0000 (15:34 -0500)]
preserve the original visibility for the "list stem" node
Without this, the `vis` does not wind up in the tree anywhere, and
then we get ICEs because the node-ids it refers to are not present.
The motivation seemed to be documentation, but `ListStem` HIR nodes
are ignored in rustdoc, from what I can tell.
bors [Wed, 21 Nov 2018 15:56:32 +0000 (15:56 +0000)]
Auto merge of #56118 - steveklabnik:update-books, r=alexcrichton
Update books for Rust 2018
This PR:
1. updates all of the books
* I don't know if @Gankro has further plans for the nomicon or not
2. updates the build process because TRPL is only distributing one edition now
3. fixes up the stdlib links
I think that this passes but it's 3:20 am and so I'm sending it in and will fix up anything i missed in the morning.
bors [Wed, 21 Nov 2018 12:54:10 +0000 (12:54 +0000)]
Auto merge of #56117 - petrochenkov:iempty, r=eddyb
resolve: Make "empty import canaries" invisible from other crates
Empty imports `use prefix::{};` are desugared into `use prefix::{self as _};` to make sure the prefix is checked for privacy/stability/etc.
This caused issues in cross-crate scenarios because gensyms are lost in crate metadata (the `_` is a gensym).
bors [Tue, 20 Nov 2018 15:15:53 +0000 (15:15 +0000)]
Auto merge of #55663 - varkor:must_use-traits, r=estebank
Allow #[must_use] on traits
Addresses https://github.com/rust-lang/rust/issues/55506, but we'll probably want to add it to some library traits like `Iterator` before the issue is considered fixed. Fixes https://github.com/rust-lang/rust/issues/51560.
`#[must_use]` is already permitted on traits, with no effect, so this seems like a bug fix, but I might be overlooking something. This currently warns for `impl Trait` or `dyn Trait` when the `Trait` is `#[must_use]` (although I don't think the latter is currently possible, so it's simply future-proofed).
bors [Mon, 19 Nov 2018 14:07:45 +0000 (14:07 +0000)]
Auto merge of #56051 - pietroalbini:rollup, r=pietroalbini
Rollup of 25 pull requests
Successful merges:
- #55562 (Add powerpc- and powerpc64-unknown-linux-musl targets)
- #55564 (test/linkage-visibility: Ignore on musl targets)
- #55827 (A few tweaks to iterations/collecting)
- #55834 (Forward the ABI of the non-zero sized fields of an union if they have the same ABI)
- #55857 (remove unused dependency)
- #55862 (in which the E0618 "expected function" diagnostic gets a makeover)
- #55867 (do not panic just because cargo failed)
- #55894 (miri enum discriminant handling: Fix treatment of pointers, better error when it is undef)
- #55916 (Make miri value visitor useful for mutation)
- #55919 (core/tests/num: Simplify `test_int_from_str_overflow()` test code)
- #55923 (reword #[test] attribute error on fn items)
- #55949 (ty: return impl Iterator from Predicate::walk_tys)
- #55952 (Update to Clang 7 on CI.)
- #55953 (#53488 Refactoring UpvarId)
- #55962 (rustdoc: properly calculate spans for intra-doc link resolution errors)
- #55963 (Stress test for MPSC)
- #55968 (Clean up some non-mod-rs stuff.)
- #55970 (Miri backtrace improvements)
- #56007 (CTFE: dynamically make sure we do not call non-const-fn)
- #56011 (Replace data.clone() by Arc::clone(&data) in mutex doc.)
- #56012 (avoid shared ref in UnsafeCell::get)
- #56016 (Add VecDeque::resize_with)
- #56027 (docs: Add missing backtick in object_safety.rs docs)
- #56043 (remove "approx env bounds" if we already know from trait)
- #56059 (Increase `Duration` approximate equal threshold to 1us)
kennytm [Mon, 19 Nov 2018 08:20:13 +0000 (16:20 +0800)]
Rollup merge of #56059 - alexcrichton:fix-tests, r=sfackler
Increase `Duration` approximate equal threshold to 1us
Previously this threshold when testing was 100ns, but the Windows
documentation states:
> which is a high resolution (<1us) time stamp
which presumably means that we could have up to 1us resolution, which
means that 100ns doesn't capture "equivalent" time intervals due to
various bits of rounding here and there.
Pietro Albini [Sun, 18 Nov 2018 22:25:00 +0000 (23:25 +0100)]
Rollup merge of #56043 - nikomatsakis:issue-55756-via-outlives, r=eddyb
remove "approx env bounds" if we already know from trait
Alternative to https://github.com/rust-lang/rust/pull/55988 that fixes #55756 -- smaller fix that I cannot see having (correctness) repercussions beyond the test at hand, and hence better for backporting. (Famous last words, I know.)
Pietro Albini [Sun, 18 Nov 2018 22:24:58 +0000 (23:24 +0100)]
Rollup merge of #56016 - scottmcm:vecdeque-resize-with, r=joshtriplett
Add VecDeque::resize_with
This already exists on `Vec`; I'm just adding it to `VecDeque`.
I wanted to resize a `VecDeque<Vec<T>>` when I didn't know `T: Clone`, so I couldn't use `.resize(n, Vec::new())`. With this I could do `.resize_with(n, Vec::new)` instead, which doesn't need `T: Clone`.
Pietro Albini [Sun, 18 Nov 2018 22:24:57 +0000 (23:24 +0100)]
Rollup merge of #56012 - RalfJung:unsafe-cell, r=nikomatsakis
avoid shared ref in UnsafeCell::get
Avoid taking a shared reference in `UnsafeCell::get`. This *should* be taking a raw reference (see https://github.com/rust-lang/rfcs/pull/2582), but that operation is not currently available, so I propose we exploit `repr(transparent)` instead and cast the pointer around.
This is required to make `UnsafeCell::get` pass the [stacked borrows implementation](https://www.ralfj.de/blog/2018/11/16/stacked-borrows-implementation.html) in miri (currently, `UnsafeCell::get` is on a whitelist, but that is of course not very satisfying). It shouldn't affect normal execution/codegen. Would be great if we could get this landed and shrink miri's whitelist!
Pietro Albini [Sun, 18 Nov 2018 22:24:56 +0000 (23:24 +0100)]
Rollup merge of #56011 - CBenoit:master, r=QuietMisdreavus
Replace data.clone() by Arc::clone(&data) in mutex doc.
Arc::clone(&from) is considered as more idiomatic because it conveys more explicitly the meaning of the code.
Since this clone is visible in the official documentation, I thought it could be better to use the more idiomatic version.
Pietro Albini [Sun, 18 Nov 2018 22:24:53 +0000 (23:24 +0100)]
Rollup merge of #55970 - RalfJung:miri-backtrace, r=@oli-obk
Miri backtrace improvements
Nicer pretty-printing of the `RUST_CTFE_BACKTRACE`-backtraces:
```
0: backtrace::backtrace::libunwind::trace::hc410fcb66fe85b11
at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/libunwind.rs:53
backtrace::backtrace::trace::h2106294a22648407
at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/mod.rs:42
1: backtrace::capture::Backtrace::new_unresolved::h5d8d98b993d092ba
at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:88
2: <rustc::mir::interpret::error::EvalError<'tcx> as core::convert::From<rustc::mir::interpret::error::EvalErrorKind<'tcx, u64>>>::from::h6355269b2a661412
at librustc/mir/interpret/error.rs:236
3: <T as core::convert::Into<U>>::into::h70fcb917509539bd
at /home/r/src/rust/rustc.2/src/libcore/convert.rs:455
4: <rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, miri::Evaluator<'tcx>> as miri::fn_call::EvalContextExt<'tcx, 'mir>>::emulate_foreign_item::h9cde0e3ce7455a4a
at src/fn_call.rs:292
5: <rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, miri::Evaluator<'tcx>> as miri::fn_call::EvalContextExt<'tcx, 'mir>>::find_fn::h83f89524b9d1a49a
at src/fn_call.rs:74
6: <miri::Evaluator<'tcx> as rustc_mir::interpret::machine::Machine<'a, 'mir, 'tcx>>::find_fn::hf9980473c4775f0c
at src/lib.rs:345
rustc_mir::interpret::terminator::<impl rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, M>>::eval_fn_call::h401dec4a687f96e9
at /home/r/src/rust/rustc.2/src/librustc_mir/interpret/terminator.rs:285
```
Indentation is now consistent with `RUST_BACKTRACE`, and the frame number is not repeated when there are multiple symbols for a frame.
Also preserve the `ty::Instance` for the internal backtrace (showing which frames in the user code where on the interpreter stack when the error happened), used by miri to avoid printing spans for libstd internals:
```
error[E0080]: constant evaluation error: the evaluated program panicked
--> /home/r/src/rust/rustc.2/src/libstd/panicking.rs:525:9
|
525 | __rust_start_panic(obj as usize)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked
|
= note: inside call to `std::panicking::rust_panic` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:496:5
= note: inside call to `std::panicking::rust_panic_with_hook` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:390:5
= note: inside call to `std::panicking::continue_panic_fmt` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:345:5
note: inside call to `std::rt::begin_panic_fmt` at <::std::macros::panic macros>:8:1
--> tests/compile-fail/panic.rs:4:5
|
4 | assert_eq!(5, 6);
| ^^^^^^^^^^^^^^^^^
= note: inside call to `main` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:74:34
= note: inside call to closure at /home/r/src/rust/rustc.2/src/libstd/rt.rs:59:75
= note: inside call to closure at /home/r/src/rust/rustc.2/src/libstd/sys_common/backtrace.rs:136:5
= note: inside call to `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1/1:1913 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:59:13
= note: inside call to closure at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:310:40
= note: inside call to `std::panicking::try::do_call::<[closure@DefId(1/1:1912 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:306:5
= note: inside call to `std::panicking::try::<i32, [closure@DefId(1/1:1912 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/r/src/rust/rustc.2/src/libstd/panic.rs:398:9
= note: inside call to `std::panic::catch_unwind::<[closure@DefId(1/1:1912 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:58:25
= note: inside call to `std::rt::lang_start_internal` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:74:5
= note: inside call to `std::rt::lang_start::<()>`
```
Also notice that we show filenames and line numbers here now.
Pietro Albini [Sun, 18 Nov 2018 22:24:52 +0000 (23:24 +0100)]
Rollup merge of #55968 - ehuss:non-mod-rs-tests, r=petrochenkov
Clean up some non-mod-rs stuff.
This includes the following:
- Remove unused `non_modrs_mods` from `ParseSess` which as only used for feature gate diagnostics.
- Remove the vestiges of the feature gate tests in `test/ui`, they were only partially removed during stabilization.
- Fix the run-pass test, it was accidentally removed during stabilization.
- Add a ui test to verify error behavior for missing inline-nested mods.
- Add some tests for `#[path]` for inline-nested mods (both mod and non-mod-rs).
- Enable the diagnostic tests on windows, they should be fixed by #49478.