]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agorustbuild: drop color handling
Marc-Antoine Perennou [Tue, 18 Sep 2018 12:58:11 +0000 (14:58 +0200)]
rustbuild: drop color handling

Let cargo handle that for us

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
5 years agoAuto merge of #54319 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 18 Sep 2018 09:06:42 +0000 (09:06 +0000)]
Auto merge of #54319 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 9 pull requests

Successful merges:

 - #53522 (Add doc for impl From for Addr)
 - #54097 (rustdoc: Remove namespace for keywords)
 - #54205 (Add treat-err-as-bug flag in rustdoc)
 - #54225 (Regression test for rust-lang/rust#53675.)
 - #54232 (add `-Z dont-buffer-diagnostics`)
 - #54273 (Suggest to change numeric literal instead of casting)
 - #54299 (Issue 54246)
 - #54311 (Remove README with now-out-of-date docs about docs.)
 - #54313 (OsStr: Document that it's not NUL terminated)

Failed merges:

r? @ghost

5 years agoRollup merge of #54313 - cgwalters:osstr-ref-cstr, r=joshtriplett
Guillaume Gomez [Tue, 18 Sep 2018 08:21:44 +0000 (10:21 +0200)]
Rollup merge of #54313 - cgwalters:osstr-ref-cstr, r=joshtriplett

OsStr: Document that it's not NUL terminated

I somehow got confused into thinking this was the case, but
it's definitely not.  Let's help the common case of people who
have an `OsStr` and need to call e.g. Unix APIs.

5 years agoRollup merge of #54311 - frewsxcv:frewsxcv-readme, r=GuillaumeGomez
Guillaume Gomez [Tue, 18 Sep 2018 08:21:42 +0000 (10:21 +0200)]
Rollup merge of #54311 - frewsxcv:frewsxcv-readme, r=GuillaumeGomez

Remove README with now-out-of-date docs about docs.

These docs haven't really been touched in years, and from what I tried, the `rustdoc` commands don't work. Seems like we don't need this?

5 years agoRollup merge of #54299 - snaedis:issue-54246, r=varkor
Guillaume Gomez [Tue, 18 Sep 2018 08:21:41 +0000 (10:21 +0200)]
Rollup merge of #54299 - snaedis:issue-54246, r=varkor

Issue 54246

I added the option of providing a help message for deprecated features, that takes precedence over the default `help: remove this attribute` message, along with messages for the features that mention replacements in the reason for deprecation.

Fixes #54246.

5 years agoRollup merge of #54273 - csmoe:lint_ty_lit, r=estebank
Guillaume Gomez [Tue, 18 Sep 2018 08:21:40 +0000 (10:21 +0200)]
Rollup merge of #54273 - csmoe:lint_ty_lit, r=estebank

Suggest to change numeric literal instead of casting

Closes #54160
r? @estebank

5 years agoRollup merge of #54232 - pnkfelix:add-way-to-disable-diagnostic-buffering, r=nikomatsakis
Guillaume Gomez [Tue, 18 Sep 2018 08:21:39 +0000 (10:21 +0200)]
Rollup merge of #54232 - pnkfelix:add-way-to-disable-diagnostic-buffering, r=nikomatsakis

add `-Z dont-buffer-diagnostics`

Add `-Z dont-buffer-diagnostics`, a way to force NLL to immediately its diagnostics.

This is mainly intended for developers who want to see the error in its original context in the control flow. Two uses cases for that are:

  1. `-Z treat-err-as-bug` (which then allows extraction of a stack-trace to the origin of the error)

  2. RUST_LOG=... rustc, in which case it is often useful to see the logging statements that occurred immediately prior to the point where the diagnostic was signalled.

5 years agoRollup merge of #54225 - pnkfelix:issue-53675-add-test-called-panic, r=petrochenkov
Guillaume Gomez [Tue, 18 Sep 2018 08:21:37 +0000 (10:21 +0200)]
Rollup merge of #54225 - pnkfelix:issue-53675-add-test-called-panic, r=petrochenkov

Regression test for rust-lang/rust#53675.

(Includes a couple variations on the theme. I confirmed that the ones
in `in_expression_position` and `what_if_we_use_panic_directly_in_expr`
both failed back on "rustc 1.30.0-nightly (0f063aef6 2018-09-03)".)

Fix #53675

5 years agoRollup merge of #54205 - GuillaumeGomez:treat-err-as-bug, r=QuietMisdreavus
Guillaume Gomez [Tue, 18 Sep 2018 08:21:36 +0000 (10:21 +0200)]
Rollup merge of #54205 - GuillaumeGomez:treat-err-as-bug, r=QuietMisdreavus

Add treat-err-as-bug flag in rustdoc

cc @nikomatsakis
r? @QuietMisdreavus

5 years agoRollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, r=QuietMisdreavus
Guillaume Gomez [Tue, 18 Sep 2018 08:21:35 +0000 (10:21 +0200)]
Rollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, r=QuietMisdreavus

rustdoc: Remove namespace for keywords

Fixes #54084.

r? @QuietMisdreavus

5 years agoRollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNN
Guillaume Gomez [Tue, 18 Sep 2018 08:21:33 +0000 (10:21 +0200)]
Rollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNN

Add doc for impl From for Addr

As part of issue #51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.

Additionally, I added `#[inline]` for the conversion method, let me know if it is un-necessary or might break something.

5 years agoAuto merge of #53900 - davidtwco:issue-53771, r=nikomatsakis
bors [Tue, 18 Sep 2018 06:24:56 +0000 (06:24 +0000)]
Auto merge of #53900 - davidtwco:issue-53771, r=nikomatsakis

NLL regresses diagnostic for impl-trait/static-return-lifetime-infered.rs

Fixes #53771.

r? @nikomatsakis
cc @pnkfelix @estebank

5 years agoAuto merge of #54286 - nnethercote:BitSet, r=pnkfelix
bors [Tue, 18 Sep 2018 03:52:39 +0000 (03:52 +0000)]
Auto merge of #54286 - nnethercote:BitSet, r=pnkfelix

Merge `bitvec.rs` and `indexed_set.rs`

Because it's not good to have two separate implementations. Also, I will combine the best parts of each to improve NLL memory usage on some benchmarks significantly.

5 years agoOsStr: Document that it's not NUL terminated
Colin Walters [Tue, 18 Sep 2018 01:10:36 +0000 (21:10 -0400)]
OsStr: Document that it's not NUL terminated

I somehow got confused into thinking this was the case, but
it's definitely not.  Let's help the common case of people who
have an `OsStr` and need to call e.g. Unix APIs.

5 years agoRemove REAMDE with now-out-of-date docs about docs.
Corey Farwell [Tue, 18 Sep 2018 00:11:29 +0000 (20:11 -0400)]
Remove REAMDE with now-out-of-date docs about docs.

5 years agoAuto merge of #52036 - collin5:b50509-2, r=collin5
bors [Mon, 17 Sep 2018 21:15:12 +0000 (21:15 +0000)]
Auto merge of #52036 - collin5:b50509-2, r=collin5

Clean up dependency tracking in Rustbuild [2/2]

Make `clear_if_dirty` calls in `Builder::cargo` with stamp dependencies for the given Mode.

Continuation of #50904
Ref issue #50509
r? @Mark-Simulacrum

5 years agoSome "word"-related improvements.
Nicholas Nethercote [Mon, 17 Sep 2018 04:39:59 +0000 (14:39 +1000)]
Some "word"-related improvements.

- Rename `BitSet::data` and `BitMatrix::vector` as `words`, because that's
  what they are.

- Remove `BitSet::words_mut()`, which is no longer necessary.

- Better distinguish multiple meanins of "word", i.e. "word index" vs
  "word ref" vs "word" (i.e. the value itself).

5 years agoEliminate `BitwiseOperator`.
Nicholas Nethercote [Mon, 17 Sep 2018 03:52:35 +0000 (13:52 +1000)]
Eliminate `BitwiseOperator`.

`BitwiseOperator` is an unnecessarily low-level thing. This commit
replaces it with `BitSetOperator`, which works on `BitSet`s instead of
words. Within `bit_set.rs`, the commit eliminates `Intersect`, `Union`,
and `Subtract` by instead passing a function to `bitwise()`.

5 years agoMerge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.
Nicholas Nethercote [Fri, 14 Sep 2018 05:07:25 +0000 (15:07 +1000)]
Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.

Currently we have two files implementing bitsets (and 2D bit matrices).
This commit combines them into one, taking the best features from each.

This involves renaming a lot of things. The high level changes are as
follows.
- bitvec.rs              --> bit_set.rs
- indexed_set.rs         --> (removed)
- BitArray + IdxSet      --> BitSet (merged, see below)
- BitVector              --> GrowableBitSet
- {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet
- BitMatrix              --> BitMatrix
- SparseBitMatrix        --> SparseBitMatrix

The changes within the bitset types themselves are as follows.

```
OLD             OLD             NEW
BitArray<C>     IdxSet<T>       BitSet<T>
--------        ------          ------
grow            -               grow
new             -               (remove)
new_empty       new_empty       new_empty
new_filled      new_filled      new_filled
-               to_hybrid       to_hybrid
clear           clear           clear
set_up_to       set_up_to       set_up_to
clear_above     -               clear_above
count           -               count
contains(T)     contains(&T)    contains(T)
contains_all    -               superset
is_empty        -               is_empty
insert(T)       add(&T)         insert(T)
insert_all      -               insert_all()
remove(T)       remove(&T)      remove(T)
words           words           words
words_mut       words_mut       words_mut
-               overwrite       overwrite
merge           union           union
-               subtract        subtract
-               intersect       intersect
iter            iter            iter
```

In general, when choosing names I went with:
- names that are more obvious (e.g. `BitSet` over `IdxSet`).
- names that are more like the Rust libraries (e.g. `T` over `C`,
  `insert` over `add`);
- names that are more set-like (e.g. `union` over `merge`, `superset`
  over `contains_all`, `domain_size` over `num_bits`).

Also, using `T` for index arguments seems more sensible than `&T` --
even though the latter is standard in Rust collection types -- because
indices are always copyable. It also results in fewer `&` and `*`
sigils in practice.

5 years agoAuto merge of #54277 - petrochenkov:afterder, r=alexcrichton
bors [Mon, 17 Sep 2018 18:13:26 +0000 (18:13 +0000)]
Auto merge of #54277 - petrochenkov:afterder, r=alexcrichton

Temporarily prohibit proc macro attributes placed after derives

... and also proc macro attributes used together with `#[test]`/`#[bench]`.

Addresses item 6 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393.

The end goal is straightforward predictable left-to-right expansion order for attributes.
Right now derives are expanded last regardless of their relative ordering with macro attributes and right now it's simpler to temporarily prohibit macro attributes placed after derives than changing the expansion order.
I'm not sure whether the new beta is already released or not, but if it's released, then this patch needs to be backported, so the solution needs to be minimal.

How to fix broken code (derives):
- Move macro attributes above derives. This won't change expansion order, they are expanded before derives anyway.

Using attribute macros on same items with `#[test]` and `#[bench]` is prohibited for similar expansion order reasons, but this one is going to be reverted much sooner than restrictions on derives.

How to fix broken code (test/bench):
- Enable `#![feature(plugin)]` (don't ask why).

r? @ghost

5 years agolibsyntax: add optional help message for deprecated features
Alva Snædís [Mon, 17 Sep 2018 03:40:31 +0000 (03:40 +0000)]
libsyntax: add optional help message for deprecated features

5 years agoAuto merge of #54293 - flip1995:clippyup, r=Manishearth
bors [Mon, 17 Sep 2018 15:39:00 +0000 (15:39 +0000)]
Auto merge of #54293 - flip1995:clippyup, r=Manishearth

Update Clippy

Fix Clippy test-fail due to #53910

r? @Manishearth @SimonSapin

5 years agoUpdate Clippy
flip1995 [Mon, 17 Sep 2018 13:37:19 +0000 (15:37 +0200)]
Update Clippy

5 years agoAdd -Z dont-buffer-diagnostics, a way to force NLL to immediately emit its diagnostics.
Felix S. Klock II [Sat, 15 Sep 2018 04:27:55 +0000 (06:27 +0200)]
Add -Z dont-buffer-diagnostics, a way to force NLL to immediately emit its diagnostics.

This is mainly intended for `rustc` developers who want to see a
diagnostic in its original context in the control flow.  Two uses
cases for that are:

 * `-Z treat-err-as-bug` which then allows extraction of a stack-trace to the origin of the error
   (a case that is so important that we make that flag imply this one, effectively).

 * `RUST_LOG=... rustc`, in which case it is often useful to see the logging statements that
   occurred immediately prior to the point where the diagnostic was signalled.

Drive-by: Added some documentation pointing future devs at
HandlerFlags, and documented the fields of `HandlerFlags` itself.

5 years agolibsyntax: fix casing in error message
Alva Snædís [Mon, 17 Sep 2018 03:38:15 +0000 (03:38 +0000)]
libsyntax: fix casing in error message

5 years agorefactor Builder::cargo, clean deps for cmd!=test
Collins Abitekaniza [Mon, 17 Sep 2018 11:19:44 +0000 (14:19 +0300)]
refactor Builder::cargo, clean deps for cmd!=test

5 years agoAuto merge of #54249 - RalfJung:miri, r=eddyb
bors [Mon, 17 Sep 2018 08:59:11 +0000 (08:59 +0000)]
Auto merge of #54249 - RalfJung:miri, r=eddyb

Update miri

5 years agoupdate miri
Ralf Jung [Mon, 17 Sep 2018 07:20:03 +0000 (09:20 +0200)]
update miri

5 years agoAuto merge of #54260 - maxdeviant:public-scope-fields, r=petrochenkov
bors [Mon, 17 Sep 2018 06:34:29 +0000 (06:34 +0000)]
Auto merge of #54260 - maxdeviant:public-scope-fields, r=petrochenkov

Make rustc::middle::region::Scope's fields public

This PR makes the following changes to `rustc::middle::region::Scope`:

- [x] Makes `region::Scope`'s fields public
- [x] Removes the `impl Scope` block with constructors (as per [this comment](https://github.com/rust-lang/rust/pull/54032#discussion_r216618208))
- [x] Updates call sites throughout the compiler

Closes #54122.

5 years agoadd test for float/integer
csmoe [Mon, 17 Sep 2018 01:29:57 +0000 (09:29 +0800)]
add test for float/integer

5 years agomerge into/literal suggestion for DRY
csmoe [Mon, 17 Sep 2018 01:24:33 +0000 (09:24 +0800)]
merge into/literal suggestion for DRY

5 years agoAuto merge of #54254 - RalfJung:miri-dangling, r=eddyb
bors [Mon, 17 Sep 2018 03:58:41 +0000 (03:58 +0000)]
Auto merge of #54254 - RalfJung:miri-dangling, r=eddyb

miri engine: keep around some information for dead allocations

We use it to test if a dangling ptr is aligned and non-NULL. This makes some code pass that should pass (writing a ZST to a properly aligned dangling pointer), and makes some code fail that should fail (writing a ZST to a pointer obtained via pointer arithmetic from a real location, but ouf-of-bounds -- that pointer could be NULL, so we cannot allow writing to it).

CTFE does not allow these operations; tests are added to miri with https://github.com/solson/miri/pull/453.

5 years agoAuto merge of #54247 - Munksgaard:better-error-message-in-no_lookup_host_duplicates...
bors [Mon, 17 Sep 2018 01:36:58 +0000 (01:36 +0000)]
Auto merge of #54247 - Munksgaard:better-error-message-in-no_lookup_host_duplicates, r=alexcrichton

Improve output if no_lookup_host_duplicates test fails

If the test fails, output the offending addresses and a helpful error message.
Also slightly improve legibility of the preceding line that puts the addresses
into a HashMap.

5 years agoAuto merge of #53910 - IsaacWoods:unify_cvoid, r=SimonSapin
bors [Sun, 16 Sep 2018 23:13:30 +0000 (23:13 +0000)]
Auto merge of #53910 - IsaacWoods:unify_cvoid, r=SimonSapin

Move std::os::raw::c_void into libcore and re-export in libstd

Implements the first part of [RFC 2521](https://github.com/rust-lang/rfcs/pull/2521).

cc #53856

5 years agoAuto merge of #53461 - petrochenkov:pmu, r=alexcrichton
bors [Sun, 16 Sep 2018 20:28:21 +0000 (20:28 +0000)]
Auto merge of #53461 - petrochenkov:pmu, r=alexcrichton

resolve: Do not error on access to proc macros imported with `#[macro_use]`

This error is artificial, but previously, when `#[macro_use] extern crate x;` was stable, but non-derive proc macros were not, it worked like kind of a feature gate. Now both features are stable, so the error is no longer necessary.

This PR simplifies how `#[macro_use] extern crate x;` works - it takes all items from macro namespace of `x`'s root and puts them into macro prelude from which they all can now be accessed.

5 years agoresolve: Do not error on access to proc macros imported with `#[macro_use]`
Vadim Petrochenkov [Fri, 17 Aug 2018 23:04:50 +0000 (02:04 +0300)]
resolve: Do not error on access to proc macros imported with `#[macro_use]`

5 years agoAuto merge of #53804 - RalfJung:ptr-invalid, r=nagisa
bors [Sun, 16 Sep 2018 18:03:39 +0000 (18:03 +0000)]
Auto merge of #53804 - RalfJung:ptr-invalid, r=nagisa

fix some uses of pointer intrinsics with invalid pointers

[Found by miri](https://github.com/solson/miri/pull/446):

* `Vec::into_iter` calls `ptr::read` (and the underlying `copy_nonoverlapping`) with an unaligned pointer to a ZST. [According to LLVM devs](https://bugs.llvm.org/show_bug.cgi?id=38583), this is UB because it contradicts the metadata we are attaching to that pointer.
* `HashMap` creation calls `ptr:.write_bytes` on a NULL pointer with a count of 0. This is likely not currently UB *currently*, but it violates the rules we are setting in https://github.com/rust-lang/rust/pull/53783, and we might want to exploit those rules later (e.g. with more `nonnull` attributes for LLVM).

    Probably what `HashMap` really should do is use `NonNull::dangling()` instead of 0 for the empty case, but that would require a more careful analysis of the code.

It seems like ideally, we should do a review of usage of such intrinsics all over libstd to ensure that they use valid pointers even when the size is 0. Is it worth opening an issue for that?

5 years agoTemporarily prohibit proc macro attributes placed after derives
Vadim Petrochenkov [Sun, 16 Sep 2018 14:15:07 +0000 (17:15 +0300)]
Temporarily prohibit proc macro attributes placed after derives

... and also proc macro attributes used together with test/bench.

5 years agoAuto merge of #54270 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sun, 16 Sep 2018 15:42:02 +0000 (15:42 +0000)]
Auto merge of #54270 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #53941 (rustdoc: Sort implementors)
 - #54181 (Suggest && and || instead of 'and' and 'or')
 - #54209 (Partially revert 674a5db "Fix undesirable fallout [from macro modularization]")
 - #54213 (De-overlap the lifetimes of `flow_inits` and `flow_{un,ever_}inits`.)
 - #54244 (Add a small search box to seach Rust's standary library)

Failed merges:

r? @ghost

5 years agotrim type numeric literal suffix
csmoe [Sun, 16 Sep 2018 15:13:17 +0000 (23:13 +0800)]
trim type numeric literal suffix

5 years agoadd test for numeric literal cast
csmoe [Sun, 16 Sep 2018 13:13:11 +0000 (21:13 +0800)]
add test for numeric literal cast

5 years agoreplace old literal in expr
csmoe [Sun, 16 Sep 2018 13:12:23 +0000 (21:12 +0800)]
replace old literal in expr

5 years agouse mem::zeroed to make up ZST values
Ralf Jung [Sun, 16 Sep 2018 12:26:27 +0000 (14:26 +0200)]
use mem::zeroed to make up ZST values

5 years agolint to change numeric literal instead of into
csmoe [Sun, 16 Sep 2018 12:03:44 +0000 (20:03 +0800)]
lint to change numeric literal instead of into

5 years agoRollup merge of #54244 - kzys:search-box, r=GuillaumeGomez
Guillaume Gomez [Sun, 16 Sep 2018 10:25:46 +0000 (12:25 +0200)]
Rollup merge of #54244 - kzys:search-box, r=GuillaumeGomez

Add a small search box to seach Rust's standary library

This change partially addresses #14572. No CSS doesn't look fancy
but at least it is functional.

5 years agoRollup merge of #54213 - nnethercote:keccak-flow_inits-memory, r=nikomatsakis
Guillaume Gomez [Sun, 16 Sep 2018 10:25:45 +0000 (12:25 +0200)]
Rollup merge of #54213 - nnethercote:keccak-flow_inits-memory, r=nikomatsakis

De-overlap the lifetimes of `flow_inits` and `flow_{un,ever_}inits`.

This reduces `max-rss` for an `nll-check` build by 27% for `keccak`, and
by 8% for `inflate`.

r? @nikomatsakis

5 years agoRollup merge of #54209 - petrochenkov:mexpr, r=pnkfelix
Guillaume Gomez [Sun, 16 Sep 2018 10:25:43 +0000 (12:25 +0200)]
Rollup merge of #54209 - petrochenkov:mexpr, r=pnkfelix

Partially revert 674a5db "Fix undesirable fallout [from macro modularization]"

Partially revert https://github.com/rust-lang/rust/commit/674a5db1a50e25dd60a8ee6669edee9a366c9fab

~~Closes~~ (see pnkfelix comments below) https://github.com/rust-lang/rust/issues/53675

5 years agoRollup merge of #54181 - vi:hint_and_or, r=estebank
Guillaume Gomez [Sun, 16 Sep 2018 10:25:42 +0000 (12:25 +0200)]
Rollup merge of #54181 - vi:hint_and_or, r=estebank

Suggest && and || instead of 'and' and 'or'

Resolves #54109.

Note: competing pull reqeust: #54179

r? @csmoe

5 years agoRollup merge of #53941 - kzys:sort-impls, r=GuillaumeGomez
Guillaume Gomez [Sun, 16 Sep 2018 10:25:41 +0000 (12:25 +0200)]
Rollup merge of #53941 - kzys:sort-impls, r=GuillaumeGomez

rustdoc: Sort implementors

Fixes #53812

5 years agoAuto merge of #54157 - euclio:structured-suggestion, r=estebank
bors [Sun, 16 Sep 2018 09:47:05 +0000 (09:47 +0000)]
Auto merge of #54157 - euclio:structured-suggestion, r=estebank

use structured suggestion for "missing mut" label

Fixes #54133 for both NLL and non-NLL.

r? @estebank

I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable: `mut foo`"?

Also, are the `HELP` and `SUGGESTION` comments necessary?

5 years agoCheck the remaining nodes
Kazuyoshi Kato [Sun, 16 Sep 2018 07:39:12 +0000 (00:39 -0700)]
Check the remaining nodes

5 years agoAuto merge of #53754 - RalfJung:slice_align_to, r=alexcrichton
bors [Sun, 16 Sep 2018 07:22:24 +0000 (07:22 +0000)]
Auto merge of #53754 - RalfJung:slice_align_to, r=alexcrichton

stabilize slice_align_to

This is very hard to implement correctly, and leads to [serious bugs](https://github.com/llogiq/bytecount/pull/42) when done incorrectly. Moreover, this is needed to be able to run code that opportunistically exploits alignment on miri. So code using `align_to`/`align_to_mut` gets the benefit of a well-tested implementation *and* of being able to run in miri to test for (some kinds of) UB.

This PR also clarifies the guarantee wrt. the middle part being as long as possible.  Should the docs say under which circumstances the middle part could be shorter? Currently, that can only happen when running in miri.

5 years agoAuto merge of #54116 - eddyb:extern-prelude, r=petrochenkov
bors [Sat, 15 Sep 2018 19:50:26 +0000 (19:50 +0000)]
Auto merge of #54116 - eddyb:extern-prelude, r=petrochenkov

rustc_resolve: allow only core, std, meta and --extern in Rust 2018 paths.

As per https://github.com/rust-lang/rust/issues/53166#issuecomment-419265401:
* Rust 2018 imports can no longer refer to crates not in "extern prelude"
  * `::foo` won't load a crate named `foo` unless `foo` is in the "extern prelude"
  * `extern crate foo;`, however, remains unchanged (can load arbitrary crates)
* `--extern crate_name` is added (note the lack of `=path`) as an unstable option
  * adds `crate_name` to the "extern prelude" (see above)
  * crate is searched in sysroot & library paths, just like `extern crate crate_name`.
  * `Cargo` support will be added later
* `core`, `std` and ~~`proc_macro`~~ `meta` are *always* available in the extern prelude
  * warning for interaction with `no_std` / `no_core` will be added later
  * **EDIT**: `proc_macro` was replaced by `meta`, see https://github.com/rust-lang/rust/issues/53166#issuecomment-421137230
    * note that there is no crate named `meta` being added, so `use meta::...;` will fail, we're only whitelisting it so we can start producing `uniform_paths` compatibility errors

Fixes #54006 (as the example now requires `--extern alloc`, which is unstable).
Fixes #54253 (hit during fixing RLS).

r? @petrochenkov cc @aturon @alexcrichton @Centril @joshtriplett

5 years agoRevert "Auto merge of #53527 - Emerentius:test_all, r=nrc"
Eduard-Mihai Burtescu [Sat, 15 Sep 2018 19:48:38 +0000 (22:48 +0300)]
Revert "Auto merge of #53527 - Emerentius:test_all, r=nrc"

This reverts commit 9f53c87b4b1f097e111c9525d60470ed22631018, reversing
changes made to cba0fdf43c22795822e1d7c751a69e6c85007221.

5 years agoUpdate submodules to include rust-lang-nursery/rust-clippy#3189 and rust-lang-nursery...
Eduard-Mihai Burtescu [Sat, 15 Sep 2018 08:40:25 +0000 (11:40 +0300)]
Update submodules to include rust-lang-nursery/rust-clippy#3189 and rust-lang-nursery/rls#1054.

5 years agorustc_resolve: use `continue` instead of `return` to "exit" a loop iteration.
Eduard-Mihai Burtescu [Sat, 15 Sep 2018 14:52:59 +0000 (17:52 +0300)]
rustc_resolve: use `continue` instead of `return` to "exit" a loop iteration.

5 years agorustc_resolve: always include core, std and meta in the extern prelude.
Eduard-Mihai Burtescu [Mon, 10 Sep 2018 16:41:30 +0000 (19:41 +0300)]
rustc_resolve: always include core, std and meta in the extern prelude.

5 years agorustc_resolve: don't allow `::crate_name` to bypass `extern_prelude`.
Eduard-Mihai Burtescu [Fri, 24 Aug 2018 15:51:32 +0000 (18:51 +0300)]
rustc_resolve: don't allow `::crate_name` to bypass `extern_prelude`.

5 years agorustc: add unstable support for --extern crate_name without a path.
Eduard-Mihai Burtescu [Fri, 24 Aug 2018 15:51:10 +0000 (18:51 +0300)]
rustc: add unstable support for --extern crate_name without a path.

5 years agorustc: support extern crates loaded after query engine creation.
Eduard-Mihai Burtescu [Wed, 12 Sep 2018 07:31:00 +0000 (10:31 +0300)]
rustc: support extern crates loaded after query engine creation.

5 years agoFix missing struct name
Marshall Bowers [Sat, 15 Sep 2018 19:43:44 +0000 (15:43 -0400)]
Fix missing struct name

5 years agoMake rustc::middle::region::Scope's fields public
Marshall Bowers [Sat, 15 Sep 2018 17:10:29 +0000 (13:10 -0400)]
Make rustc::middle::region::Scope's fields public

5 years agoImprove output if no_lookup_host_duplicates fails
Philip Munksgaard [Sat, 15 Sep 2018 09:50:41 +0000 (11:50 +0200)]
Improve output if no_lookup_host_duplicates fails

If the test fails, output the offending addresses and a helpful error message.
Also slightly improve legibility of the preceding line that puts the addresses
into a HashMap.

5 years agoAuto merge of #53527 - Emerentius:test_all, r=nrc
bors [Sat, 15 Sep 2018 15:01:51 +0000 (15:01 +0000)]
Auto merge of #53527 - Emerentius:test_all, r=nrc

Add option to run all tests

This adds the "--include-ignored" flag to libtest, which allows running ignored and unignored tests in one go.

Closes #50363

5 years agokeep around some information for dead allocations so that we can use it to make sure...
Ralf Jung [Sat, 15 Sep 2018 14:34:30 +0000 (16:34 +0200)]
keep around some information for dead allocations so that we can use it to make sure a dangling ptr aligned and non-NULL

5 years agoAuto merge of #52896 - SergioBenitez:master, r=alexcrichton
bors [Sat, 15 Sep 2018 12:33:44 +0000 (12:33 +0000)]
Auto merge of #52896 - SergioBenitez:master, r=alexcrichton

Add inspection and setter methods to proc_macro::Diagnostic.

A few useful methods for `proc_macro::Diagnostic`.

r? @alexcrichton

5 years agoAuto merge of #54227 - flip1995:clippyup, r=kennytm
bors [Sat, 15 Sep 2018 10:09:25 +0000 (10:09 +0000)]
Auto merge of #54227 - flip1995:clippyup, r=kennytm

Update Clippy

Clippy one commit behind #54226. This should work

r? @Manishearth

5 years agoAuto merge of #54177 - nnethercote:streamline-bit-stuff, r=Mark-Simulacrum
bors [Sat, 15 Sep 2018 06:36:22 +0000 (06:36 +0000)]
Auto merge of #54177 - nnethercote:streamline-bit-stuff, r=Mark-Simulacrum

Remove bitslice.rs

As the comment in `bitslice.rs` says:

> FIXME: merge with `bitvec`

5 years agoAdd a small search box to seach Rust's standary library
Kazuyoshi Kato [Sat, 15 Sep 2018 06:28:32 +0000 (23:28 -0700)]
Add a small search box to seach Rust's standary library

This change partially addresses #14572. No CSS doesn't look fancy
but at least it is functional.

5 years agoAdd a test to prevent regression
Kazuyoshi Kato [Sat, 15 Sep 2018 05:42:44 +0000 (22:42 -0700)]
Add a test to prevent regression

The way it defines implementations is unrealistic though.

5 years agoRegression test for rust-lang/rust#53675.
Felix S. Klock II [Fri, 14 Sep 2018 12:06:05 +0000 (14:06 +0200)]
Regression test for rust-lang/rust#53675.

(Includes a couple variations on the theme. I confirmed that the ones
in `in_expression_position` and `what_if_we_use_panic_directly_in_expr`
both failed back on "rustc 1.30.0-nightly (0f063aef6 2018-09-03)".)

5 years agoAuto merge of #54151 - ljedrz:cleanup_hir, r=michaelwoerister
bors [Sat, 15 Sep 2018 02:56:13 +0000 (02:56 +0000)]
Auto merge of #54151 - ljedrz:cleanup_hir, r=michaelwoerister

A few cleanups for hir

- prefer `if let` to `match` when only 1 branch matters
- `chain` iterable items that are looped over in sequence
- `sort_by_key` instead of `sort_by` when possible
- change cloning `map`s to `cloned()`
- use `unwrap_or_else` and `ok` when applicable
- a few other minor readability improvements
- whitespace fixes

5 years agoissue 54109: use short suggestions
Vitaly _Vi Shukela [Fri, 14 Sep 2018 23:05:32 +0000 (02:05 +0300)]
issue 54109: use short suggestions

5 years agoAuto merge of #54069 - petrochenkov:subns, r=aturon
bors [Fri, 14 Sep 2018 22:17:45 +0000 (22:17 +0000)]
Auto merge of #54069 - petrochenkov:subns, r=aturon

resolve: Introduce two sub-namespaces in macro namespace

Two sub-namespaces are introduced in the macro namespace - one for bang macros and one for attribute-like macros (attributes, derives).

"Sub-namespace" means this is not a newly introduced full namespace, the single macro namespace is still in place.
I.e. you still can't define/import two macros with the same name in a single module, `use` imports still import only one name in macro namespace (from any sub-namespace) and not possibly two.

However, when we are searching for a name used in a `!` macro call context (`my_macro!()`) we skip attribute names in scope, and when we are searching for a name used in attribute context (`#[my_macro]`/`#[derive(my_macro)]`) we are skipping bang macro names in scope.
In other words, bang macros cannot shadow attribute macros and vice versa.

For a non-macro analogy, we could e.g. skip non-traits when searching for `MyTrait` in `impl MyTrait for Type { ... }`.
However we do not do it in non-macro namespaces because we don't have practical issues with e.g. non-traits shadowing traits with the same name, but with macros we do, especially after macro modularization.

For `#[test]` and `#[bench]` we have a hack in the compiler right now preventing their shadowing by `macro_rules! test` and similar things. This hack was introduced after making `#[test]`/`#[bench]` built-in macros instead of built-in attributes (https://github.com/rust-lang/rust/pull/53410), something that needed to be done from the start since they are "active" attributes transforming their inputs.
Now they are passed through normal name resolution and can be shadowed, but that's a breaking change, so we have  a special hack basically applying this PR for `#[test]` and `#[bench]` only.

Soon all potentially built-in attributes will be passed through normal name resolution (https://github.com/rust-lang/rust/pull/53913) and that uncovers even more cases where the strict "macro namespace is a single namespace" rule needs to be broken.
For example, with strict rules, built-in macro `cfg!(...)` would shadow built-in attribute `#[cfg]` (they are different things), standard library macro `thread_local!(...)` would shadow built-in attribute `#[thread_local]` - both of these cases are covered by special hacks in https://github.com/rust-lang/rust/pull/53913 as well.
Crater run uncovered more cases of attributes being shadowed by user-defined macros (`warn`, `doc`, `main`, even `deprecated`), we cannot add exceptions in the compiler for all of them.

Regressions with user-defined attributes like https://github.com/rust-lang/rust/issues/53583 and https://github.com/rust-lang/rust/issues/53898 also appeared after enabling macro modularization.

People are also usually confused (https://github.com/rust-lang/rust/issues/53205#issuecomment-411552763, https://github.com/rust-lang/rust/issues/53583#issuecomment-415447800) when they see conflicts between attributes and non-attribute macros for the first time.

So my proposed solution is to solve this issue by introducing two sub-namespaces and thus skipping resolutions of the wrong kind and preventing more error-causing cases of shadowing.

Fixes https://github.com/rust-lang/rust/issues/53583

5 years agoAuto merge of #54201 - eddyb:reflexive-disambiguation, r=petrochenkov
bors [Fri, 14 Sep 2018 19:52:13 +0000 (19:52 +0000)]
Auto merge of #54201 - eddyb:reflexive-disambiguation, r=petrochenkov

rustc_resolve: don't treat uniform_paths canaries as ambiguities unless they resolve to distinct Def's.

In particular, this allows this pattern that @cramertj mentioned in https://github.com/rust-lang/rust/issues/53130#issuecomment-420848814:
```rust
use log::{debug, log};
fn main() {
    use log::{debug, log};
    debug!(...);
}
```
The canaries for the inner `use log::...;`, *in the macro namespace*, see the `log` macro imported at the module scope, and the (same) `log` macro, imported in the block scope inside `main`.

Previously, these two possible (macro namspace) `log` resolutions would be considered ambiguous (from a forwards-compat standpoint, where we might make imports aware of block scopes).

With this PR, such a case is allowed *if and only if* all the possible resolutions refer to the same definition (more specifically, because the *same* `log` macro is being imported twice).
This condition subsumes previous (weaker) checks like #54005 and the second commit of #54011.

Only the last commit is the main change, the other two are cleanups.

r? @petrochenkov cc @Centril @joshtriplett

5 years agoRemove treat-err-as-bug test
Guillaume Gomez [Fri, 14 Sep 2018 18:58:58 +0000 (20:58 +0200)]
Remove treat-err-as-bug test

5 years agoAuto merge of #54088 - matthewjasper:use-reason-in-dlle-errors, r=pnkfelix
bors [Fri, 14 Sep 2018 15:45:02 +0000 (15:45 +0000)]
Auto merge of #54088 - matthewjasper:use-reason-in-dlle-errors, r=pnkfelix

[NLL] Suggest let binding

Closes #49821

Also adds an alternative to `explain_why_borrow_contains_point` that allows changing error messages based on the reason that will be given. This will also be useful for #51026, #51169 and maybe further changes to does not live long enough messages.

5 years agoMove std::os::raw::c_void into libcore and re-export in libstd
Isaac Woods [Sun, 2 Sep 2018 21:06:32 +0000 (22:06 +0100)]
Move std::os::raw::c_void into libcore and re-export in libstd

5 years agoAuto merge of #54080 - PramodBisht:issue/53692, r=estebank
bors [Fri, 14 Sep 2018 13:06:23 +0000 (13:06 +0000)]
Auto merge of #54080 - PramodBisht:issue/53692, r=estebank

Addressed #53692

@sunjay @estebank  @csmoe hopefully this answer #53692
Please let me know if you have any suggestion

5 years agoUpdate Clippy
flip1995 [Fri, 14 Sep 2018 12:00:32 +0000 (14:00 +0200)]
Update Clippy

5 years agoAuto merge of #54032 - oli-obk:layout_scalar_ranges, r=eddyb
bors [Fri, 14 Sep 2018 09:47:21 +0000 (09:47 +0000)]
Auto merge of #54032 - oli-obk:layout_scalar_ranges, r=eddyb

Add forever unstable attribute to allow specifying arbitrary scalar ranges

r? @eddyb for the first commit and @nikomatsakis for the second one

5 years agoAuto merge of #54215 - kennytm:rollup, r=kennytm
bors [Fri, 14 Sep 2018 07:18:25 +0000 (07:18 +0000)]
Auto merge of #54215 - kennytm:rollup, r=kennytm

Rollup of 8 pull requests

Successful merges:

 - #53218 (Add a implementation of `From` for converting `&'a Option<T>` into `Option<&'a T>`)
 - #54024 (Fix compiling some rustc crates to wasm)
 - #54095 (Rename all mentions of `nil` to `unit`)
 - #54173 (Suggest valid crate type if invalid crate type is found)
 - #54194 (Remove println!() statement from HashMap unit test)
 - #54203 (Fix the stable release of os_str_str_ref_eq)
 - #54207 (re-mark the never docs as unstable)
 - #54210 (Update Cargo)

Failed merges:

r? @ghost

5 years agoRollup merge of #54210 - alexcrichton:update-cargo, r=kennytm
kennytm [Fri, 14 Sep 2018 06:50:18 +0000 (14:50 +0800)]
Rollup merge of #54210 - alexcrichton:update-cargo, r=kennytm

Update Cargo

Should bring in some nice progress bars for compilations!

5 years agoRollup merge of #54207 - QuietMisdreavus:never-docs-stab, r=kennytm
kennytm [Fri, 14 Sep 2018 06:50:16 +0000 (14:50 +0800)]
Rollup merge of #54207 - QuietMisdreavus:never-docs-stab, r=kennytm

re-mark the never docs as unstable

Fixes https://github.com/rust-lang/rust/issues/54198

This stability attribute was removed in https://github.com/rust-lang/rust/pull/47630, but not replaced with a `#[stable]` attribute, and when https://github.com/rust-lang/rust/pull/50121 reverted that stabilization, it didn't set the docs back to unstable. I'm concerned as to why it was allowed to not have the stability attribute at all, but at least this can put it back.

I'm nominating this for beta backport because it's a really small change, and right now our docs are in an awkward position where the `!` type is technically unstable to use, but the docs don't say so the same way any other library feature would. (And this is also the case *on stable* now, but i'm not suggesting a stable backport for a docs fix.)

5 years agoRollup merge of #54203 - cuviper:stable-os_str_str_ref_eq, r=estebank
kennytm [Fri, 14 Sep 2018 06:50:15 +0000 (14:50 +0800)]
Rollup merge of #54203 - cuviper:stable-os_str_str_ref_eq, r=estebank

Fix the stable release of os_str_str_ref_eq

This was added and stabilized in commit 02503029b83a, but while that
claimed to be for 1.28.0, it didn't actually make it until 1.29.0.

Fixes #54195.

5 years agoRollup merge of #54194 - fintelia:patch-3, r=cramertj
kennytm [Fri, 14 Sep 2018 06:50:14 +0000 (14:50 +0800)]
Rollup merge of #54194 - fintelia:patch-3, r=cramertj

Remove println!() statement from HashMap unit test

5 years agoRollup merge of #54173 - phansch:suggest_valid_crate_type, r=estebank
kennytm [Fri, 14 Sep 2018 06:50:13 +0000 (14:50 +0800)]
Rollup merge of #54173 - phansch:suggest_valid_crate_type, r=estebank

Suggest valid crate type if invalid crate type is found

This adds a suggestion to the `invalid_crate_types` lint.

The suggestion is based on the Levenshtein distance to existing crate
types. If no suggestion is found it will show the lint without any
suggestions.

Closes #53958

5 years agoRollup merge of #54095 - kenta7777:kenta7777#53719, r=davidtwco
kennytm [Fri, 14 Sep 2018 06:50:11 +0000 (14:50 +0800)]
Rollup merge of #54095 - kenta7777:kenta7777#53719, r=davidtwco

Rename all mentions of `nil` to `unit`

Fixes #53719.

Renamed keywords nil to unit.

5 years agoRollup merge of #54024 - alexcrichton:compile-to-wasm, r=petrochenkov
kennytm [Fri, 14 Sep 2018 06:50:10 +0000 (14:50 +0800)]
Rollup merge of #54024 - alexcrichton:compile-to-wasm, r=petrochenkov

Fix compiling some rustc crates to wasm

I was dabbling recently seeing what it would take to compile `rustfmt` to the
`wasm32-unknown-unknown` target and it turns out not much effort is needed!
Currently `rustfmt` depends on a few rustc crates published to crates.io, so
this commit touches up those crates to compile for wasm themselves. Notably:

* The `rustc_data_structures` crate's `flock` implementation is stubbed out to
  unconditionally return errors on unsupported platforms.
* The `rustc_errors` crate is extended to not do any locking for all non-windows
  platforms.

In both of these cases if we port the compiler to new platforms the
functionality isn't critical but will be discovered over time as it comes up, so
this hopefully doesn't make it too too hard to compile to new platforms!

5 years agoRollup merge of #53218 - weiznich:feature/option_ref_into, r=KodrAus
kennytm [Fri, 14 Sep 2018 06:50:09 +0000 (14:50 +0800)]
Rollup merge of #53218 - weiznich:feature/option_ref_into, r=KodrAus

Add a implementation of `From` for converting `&'a Option<T>` into `Option<&'a T>`

I'm not sure if any annotations regarding the stabilization are needed or in general what's the correct process of adding such an impl.

cc @sgrif (We have talked about this)

5 years agoDe-overlap the lifetimes of `flow_inits` and `flow_{un,ever_}inits`.
Nicholas Nethercote [Fri, 14 Sep 2018 04:55:21 +0000 (14:55 +1000)]
De-overlap the lifetimes of `flow_inits` and `flow_{un,ever_}inits`.

This reduces `max-rss` for an `nll-check` build by 27% for `keccak`, and
by 8% for `inflate`.

5 years agoAuto merge of #53751 - F001:tuple-struct-self-ctor, r=petrochenkov,varkor
bors [Fri, 14 Sep 2018 03:34:14 +0000 (03:34 +0000)]
Auto merge of #53751 - F001:tuple-struct-self-ctor, r=petrochenkov,varkor

Implement RFC 2302: tuple_struct_self_ctor

Tracking issue: https://github.com/rust-lang/rust/issues/51994

5 years agoUpdate Cargo
Alex Crichton [Fri, 14 Sep 2018 01:35:08 +0000 (18:35 -0700)]
Update Cargo

Should bring in some nice progress bars for compilations!

5 years agoAuto merge of #52962 - GuillaumeGomez:few-things, r=QuietMisdreavus
bors [Fri, 14 Sep 2018 01:07:21 +0000 (01:07 +0000)]
Auto merge of #52962 - GuillaumeGomez:few-things, r=QuietMisdreavus

Fix trait item doc setting, add new setting, start hiding elements by default and then showing them up

r? @QuietMisdreavus

5 years agoPartially revert 674a5db "Fix undesirable fallout [from macro modularization]"
Vadim Petrochenkov [Thu, 13 Sep 2018 23:37:12 +0000 (02:37 +0300)]
Partially revert 674a5db "Fix undesirable fallout [from macro modularization]"

5 years agoRemove `Iter` and `SparseIter` in indexed_set.rs.
Nicholas Nethercote [Thu, 13 Sep 2018 22:06:52 +0000 (08:06 +1000)]
Remove `Iter` and `SparseIter` in indexed_set.rs.

Because they're just thin wrappers around `BitIter` and `slice::Iter`.

5 years agoAuto merge of #54168 - kennytm:rollup, r=kennytm
bors [Thu, 13 Sep 2018 22:40:35 +0000 (22:40 +0000)]
Auto merge of #54168 - kennytm:rollup, r=kennytm

Rollup of 11 pull requests

Successful merges:

 - #53371 (Do not emit E0277 on incorrect tuple destructured binding)
 - #53829 (Add rustc SHA to released DWARF debuginfo)
 - #53950 (Allow for opting out of ThinLTO and clean up LTO related cli flag handling.)
 - #53976 (Replace unwrap calls in example by expect)
 - #54070 (Add Error::description soft-deprecation to RELEASES)
 - #54076 (miri loop detector hashing)
 - #54119 (Add some unit tests for find_best_match_for_name)
 - #54147 (Add a test that tries to modify static memory at compile-time)
 - #54150 (Updated 1.29 release notes with --document-private-items flag)
 - #54163 (Update stage 0 to latest beta)
 - #54170 (COMPILER_TESTS.md has been moved)

5 years agore-mark the never docs as unstable
QuietMisdreavus [Thu, 13 Sep 2018 22:31:56 +0000 (17:31 -0500)]
re-mark the never docs as unstable

5 years agoFix the stable release of os_str_str_ref_eq
Josh Stone [Thu, 13 Sep 2018 21:25:43 +0000 (14:25 -0700)]
Fix the stable release of os_str_str_ref_eq

This was added and stabilized in commit 02503029b83a, but while that
claimed to be for 1.28.0, it didn't actually make it until 1.29.0.

5 years agoAdd treat-err-as-bug flag in rustdoc
Guillaume Gomez [Thu, 13 Sep 2018 21:00:10 +0000 (23:00 +0200)]
Add treat-err-as-bug flag in rustdoc