Commit Graph

81910 Commits

Author SHA1 Message Date
Guillaume Gomez d509e31b93
Rollup merge of #53165 - jakllsch:netbsd-ad22a005-b917-47f3-8156-f717d36f6bbe, r=estebank
Add aarch64-unknown-netbsd target

Depends on #53116.
2018-08-12 23:26:52 +02:00
Guillaume Gomez 28e1a7ba5e
Rollup merge of #53059 - ljedrz:unneeded_returns, r=kennytm
Remove explicit returns where unnecessary
2018-08-12 23:26:51 +02:00
Guillaume Gomez fbe6241064
Rollup merge of #53025 - ljedrz:debug_asserts_limited, r=varkor
Consider changing assert! to debug_assert! when it calls visit_with

The perf run from #52956 revealed that there were 3 benchmarks that benefited most from changing `assert!`s to `debug_assert!`s:

- issue #46449: avg -4.7% for -check
- deeply-nested (AKA #38528): avg -3.4% for -check
- regression #31157: avg -3.2% for -check

I analyzed their fixing PRs and decided to look for potentially heavy assertions in the files they modified. I noticed that all of the non-trivial ones contained indirect calls to `visit_with()`.

It might be a good idea to consider changing `assert!` to `debug_assert!` in those places in order to get the performance wins shown by the benchmarks.
2018-08-12 23:26:50 +02:00
Guillaume Gomez 7d3864954e
Rollup merge of #53019 - ljedrz:bad_collects, r=estebank
Don't collect() when size_hint is useless

This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.

It is a performance win.
2018-08-12 23:26:49 +02:00
Guillaume Gomez 0653c259c2
Rollup merge of #52955 - tromey:compiler-test-docs, r=nikomatsakis
Update compiler test documentation

Update the compiler test documentation to document ignore-gdb-version
and min-system-llvm-version; and expand the min-gdb-version,
min-lldb-version, and min-llvm-version documentation a little.
2018-08-12 23:26:48 +02:00
Jonathan A. Kollasch 538d1ba6d7 aarch64-unknown-netbsd: add openssl configuration 2018-08-10 15:53:20 -05:00
bors 0aa8d03202 Auto merge of #53177 - nikomatsakis:nll-redundant-borrows-and-escaping-values, r=pnkfelix
optimize redundant borrows and escaping paths in NLL

This builds on https://github.com/rust-lang/rust/pull/53168 and adds a commit that addresses https://github.com/rust-lang/rust/issues/53176 -- or at least I think it does. I marked this as WIP because I want to see the test results (and measure the performance). I also want to double check we're not adding in any unsoundness here.
2018-08-10 19:18:22 +00:00
Tom Tromey 8a76656435 Link compiler test documentation to rustc-guide
Update the compiler test documentation to point to the relevant
rustc-guide page.
2018-08-10 08:05:48 -06:00
Niko Matsakis ff7f6d57de don't walk MIR if no local variables need liveness
This is true for tuple-stress and html5ever
2018-08-10 04:17:46 -04:00
bors a77dfcc79f Auto merge of #53131 - davidtwco:issue-52663-thread-local-static, r=nikomatsakis
NLL says something "does not live long enough" when talking about a (thread-local) static

Part of #52663.

r? @nikomatsakis
2018-08-10 06:54:11 +00:00
ljedrz b187c4268c Consider changing assert! to debug_assert! when it calls visit_with 2018-08-10 08:40:30 +02:00
bors f6d43ed842 Auto merge of #53124 - davidtwco:issue-52742, r=nikomatsakis
region error messages involving impls are confusing

Part of #52742.

r? @nikomatsakis
2018-08-10 02:18:21 +00:00
bors db1acaac7f Auto merge of #53073 - Mark-Simulacrum:data-structures, r=pnkfelix
Cleanup to librustc::session and related code

No functional changes, just some cleanup.

This also creates the `rustc_fs_util` crate, but I can remove that change if desired. It felt a little odd to force crates to depend on librustc for some fs utilities; and also seemed good to generally keep the size of librustc lower (for compile times); fs_util will compile in parallel with essentially the first crate since it has no dependencies beyond std.
2018-08-10 00:14:52 +00:00
bors fb65d7563c Auto merge of #52788 - LukasKalbertodt:improve-index-mut-error, r=estebank
Add help message for missing `IndexMut` impl

Code:
```rust
let mut map = HashMap::new();
map.insert("peter", 23);
map["peter"] = 27;
```

Before:
```
error[E0594]: cannot assign to immutable indexed content
 --> src/main.rs:7:5
  |
7 |     map["peter"] = 27;
  |     ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
```

With this change (just the `help` was added):
```
error[E0594]: cannot assign to immutable indexed content
 --> index-error.rs:7:5
  |
7 |     map["peter"] = 27;
  |     ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
  |
  = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for std::collections::HashMap<&str, i32>
```

---

Yesterday I did some pair programming with a Rust-beginner. We created a type and implemented `Index` for it. Trying to modify the value returned by the index operation returns in a rather vague error that was not very clear for the Rust beginner. So I tried to improve the situation.

## Notes/questions for reviewers:
- Is the formulation OK like that? I'm fine with changing it.
- Can we be absolutely sure that `IndexMut` is actually not implemented in the case my `help` message is added? I'm fairly sure myself, but there could be some cases I didn't think of. Also, I don't know the compiler very well, so I don't know what exactly certain enum variants are used for.
  - It would be nice to test if `IndexMut` is in fact not implemented for the type, but I couldn't figure out how to check that. If you think that additional check would be beneficial, could you tell me how to check if a trait is implemented?
- Do you think I should change the error message instead of only adding an additional help message?
2018-08-09 22:05:18 +00:00
bors 8958ed6722 Auto merge of #53216 - kennytm:rollup, r=kennytm
Rollup of 15 pull requests

Successful merges:

 - #52773 (Avoid unnecessary pattern matching against Option and Result)
 - #53082 (Fix doc link (again))
 - #53094 (Automatically expand section if url id point to one of its component)
 - #53106 (atomic ordering docs)
 - #53110 (Account for --remap-path-prefix in save-analysis)
 - #53116 (NetBSD: fix signedess of char)
 - #53179 (Whitelist wasm32 simd128 target feature)
 - #53183 (Suggest comma when missing in macro call)
 - #53207 (Add individual docs for rotate_{left, right})
 - #53211 ([nll] enable feature(nll) on various crates for bootstrap)
 - #53214 ([nll] enable feature(nll) on various crates for bootstrap: part 2)
 - #53215 (Slightly refactor syntax_ext/format)
 - #53217 (inline some short functions)
 - #53219 ([nll] enable feature(nll) on various crates for bootstrap: part 3)
 - #53222 (A few cleanups for rustc_target)
2018-08-09 19:05:14 +00:00
kennytm 9f55705a24
Rollup merge of #53207 - llogiq:num-rotate-docs, r=QuietMisdreavus
Add individual docs for rotate_{left, right}
2018-08-10 01:55:31 +08:00
kennytm f067f3a45d
Rollup merge of #53222 - ljedrz:cleanup_rustc_target, r=Mark-Simulacrum
A few cleanups for rustc_target

- remove redundant struct field names
- shorten a self-assignment
- prefer `unwrap_or_else` in case of function calls
- collapse an `if`
- collapse a double `map()`
- match on dereferenced objects
- consume `self` if it implements `Copy`
2018-08-10 01:04:10 +08:00
kennytm 762855d23a
Rollup merge of #53215 - ljedrz:refactor_format, r=estebank
Slightly refactor syntax_ext/format

expand_preparsed_format_args:
- move a potential error `return` earlier in the processing
- pre-allocate some of the required space for `cx.pieces` and `cx.str_pieces`
- create `cx`-independent objects before `cx`
- build `pieces` and `errs` using `collect` instead of a `push` loop

describe_num_args:
- return `Cow<str>` instead of `String`
2018-08-10 01:03:45 +08:00
kennytm e2d0e3f6ac
Rollup merge of #53219 - memoryruins:nll_bootstrap_3, r=nikomatsakis
[nll] enable feature(nll) on various crates for bootstrap: part 3

#53172
2018-08-10 01:01:33 +08:00
kennytm 62d70c9d47
Rollup merge of #53214 - memoryruins:nll_bootstrap_2, r=nikomatsakis
[nll] enable feature(nll) on various crates for bootstrap: part 2

#53172
2018-08-10 01:01:31 +08:00
kennytm bb0151c6d4
Rollup merge of #53211 - memoryruins:nll_bootstrap, r=nikomatsakis
[nll] enable feature(nll) on various crates for bootstrap

#53172
2018-08-10 01:01:30 +08:00
kennytm 746abc3265
Rollup merge of #53082 - felixrabe:fix-doc-link-again, r=GuillaumeGomez
Fix doc link (again)

Similar to #52404. The link for comparison:

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (broken)

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, stable 2nd ed)

-   https://doc.rust-lang.org/nightly/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, nightly 2nd ed)

-   https://doc.rust-lang.org/nightly/book/2018-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, nightly 2018 ed)

This commit is the result of (first) searching via ripgrep (0.8.1 -SIMD -AVX):

    rg -l dynamically-sized-types-and-sized

and then replacing all relevant occurrences via:

    find src/{libcore,test/ui} -type f -print0 | xargs -0 sed -i.bak \
      s/dynamically-sized-types-and-sized/dynamically-sized-types-and-the-sized-trait/g
    find src/{libcore,test/ui} -type f -name '*.bak' -print0 | xargs -0 rm

(Note: Tested on on macOS 10.13 (BSD). `sed -i.bak` should work on Linux
(GNU sed) as well, but not tested.)
2018-08-10 01:01:28 +08:00
kennytm 410f63dbb7
Rollup merge of #53217 - strake:inline, r=nagisa
inline some short functions

I found these were outline in binaries i link. I think they ought to be inline, considering their size.
2018-08-10 01:01:27 +08:00
kennytm db74946803
Rollup merge of #53106 - RalfJung:ordering, r=stjepang
atomic ordering docs

Discussion in https://github.com/rust-lang/rfcs/pull/2503 revealed that this could be improved. I hope this helps.
2018-08-10 01:01:24 +08:00
kennytm 8188f12aaa
Rollup merge of #53183 - estebank:println-comma, r=oli-obk
Suggest comma when missing in macro call

When missing a comma in a macro call, suggest it, regardless of
position. When a macro call doesn't match any of the patterns, check
if the call's token stream could be missing a comma between two idents,
and if so, create a new token stream containing the comma and try to
match against the macro patterns. If successful, emit the suggestion.

This works on arbitrary macros, with no need of special support from
the macro writers.

```
error: no rules expected the token `d`
  --> $DIR/missing-comma.rs:26:18
   |
LL |     foo!(a, b, c d, e);
   |                 -^
   |                 |
   |                 help: missing comma here
```
Follow up to #52397.
2018-08-10 01:01:22 +08:00
kennytm 7f886cf12b
Rollup merge of #53179 - gnzlbg:patch-3, r=alexcrichton
Whitelist wasm32 simd128 target feature

r? @alexcrichton
2018-08-10 01:01:20 +08:00
Mark Rousskov a8e19bec37 Move span_bug and bug helper functions to util 2018-08-09 10:01:45 -06:00
Mark Rousskov ed246fcc95 Cache ignored attributes inside ICH entirely 2018-08-09 10:00:25 -06:00
Mark Rousskov bd6fe1e700 Move Fingerprint to data structures 2018-08-09 10:00:25 -06:00
Mark Rousskov ac4439c5b6 Reuse Hash impls for session data structures 2018-08-09 10:00:25 -06:00
Mark Rousskov 7f138e1e55 Remove dependency on rustc::ty from code_stats 2018-08-09 10:00:25 -06:00
Mark Rousskov dea13b4bc7 Move path2cstr to rustc_fs_util 2018-08-09 10:00:25 -06:00
Mark Rousskov e3177c6f3f Move rustc::util::fs into separate (new) crate 2018-08-09 10:00:25 -06:00
Mark Rousskov bf103700c6 Move SVH structure to data structures 2018-08-09 10:00:25 -06:00
Andre Bogus cc2503a4f4 Add individual docs for rotate_{left, right} 2018-08-09 17:10:27 +02:00
ljedrz 25a58af064 A few cleanups for rustc_target 2018-08-09 15:42:43 +02:00
bors b73535f1e9 Auto merge of #53031 - michaelwoerister:cross-lto, r=alexcrichton
Apply some fixes to cross-language LTO (especially when targeting MSVC)

This PR contains a few fixes that were needed in order to get Firefox compiling with Rust/C++ cross-language ThinLTO on Windows. The commits are self-contained and should be self-explanatory.

r? @alexcrichton
2018-08-09 13:20:14 +00:00
memoryruins d25dbc5d84 [nll] libunwind: enable feature(nll) for bootstrap 2018-08-09 06:52:12 -04:00
memoryruins 58836e8a6f [nll] libterm: enable feature(nll) for bootstrap 2018-08-09 06:51:56 -04:00
memoryruins 01c598aa0d [nll] libsyntax_pos: enable feature(nll) for bootstrap 2018-08-09 06:51:42 -04:00
memoryruins f331401e1e [nll] librustc_target: enable feature(nll) for bootstrap 2018-08-09 06:51:13 -04:00
memoryruins a37360c330 [nll] librustc_incremental: enable feature(nll) for bootstrap 2018-08-09 06:50:57 -04:00
memoryruins fd4b1a73bf [nll] librustc_driver: enable feature(nll) for bootstrap 2018-08-09 06:50:40 -04:00
memoryruins c6be5551be [nll] librustc_cratesio_shim: enable feature(nll) for bootstrap 2018-08-09 06:50:25 -04:00
memoryruins b340f56316 [nll] librustc_apfloat: enable feature(nll) for bootstrap 2018-08-09 06:49:31 -04:00
memoryruins 7e78e7570f [nll] libpanic_unwind: enable feature(nll) for bootstrap 2018-08-09 06:49:12 -04:00
memoryruins 04bd6146c3 [nll] libpanic_abort: enable feature(nll) for bootstrap 2018-08-09 06:48:53 -04:00
memoryruins 3ed965ab58 [nll] libfmt_macros: enable feature(nll) for bootstrap 2018-08-09 06:48:10 -04:00
David Wood 31657c9953
Updated tests after rebase. 2018-08-09 12:03:20 +02:00
M Farkas-Dyck b78201aee5 inline some short functions 2018-08-09 01:27:48 -08:00