Commit Graph

82152 Commits

Author SHA1 Message Date
Michael Woerister
88d84b38f1 Introduce SmallCStr and use it where applicable. 2018-08-10 11:13:00 +02:00
Michael Woerister
9585c5dc1f Introduce const_cstr!() macro and use it where applicable. 2018-08-10 10:22:44 +02: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
Josh Stone
763e72110a rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.
This hack was removed in #50949, but without it I found that building
`std` with full debuginfo would print many LLVM `DW_OP_LLVM_fragment`
errors, then die `LLVM ERROR: Failed to strip malformed debug info`.

It doesn't seem to be a problem for LLVM 6, so we can re-enable the hack
just for older LLVM.

This reverts commit da579ef75e.
Fixes #53204.
r? @eddyb
2018-08-09 16:35:25 -07: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
memoryruins
ef34a16c61 [nll] librustc_data_structures: remove unused mut annotation in test 2018-08-09 17:31:15 -04:00
Sunjay Varma
644765197a Preferring BuiltInCandidate { has_nested: false } in all cases 2018-08-09 15:05:24 -06:00
Marko Mijalkovic
c7a39b190e Export WASM table by default 2018-08-09 16:19:16 -04:00
Andre Richter
898950caf1
targets: aarch64: Add bare-metal aarch64 target
A generic AArch64 target that can be used for writing bare-metal code
for 64-bit ARM architectures.
2018-08-09 22:10:11 +02:00
memoryruins
4aced68e18 [nll] librustdoc: enable feature(nll) for bootstrap 2018-08-09 15:35:06 -04:00
memoryruins
ac9b7be50b [nll] librustc_typeck: enable feature(nll) for bootstrap 2018-08-09 15:34:54 -04:00
memoryruins
58407351dd [nll] librustc_platform_intrinsics: enable feature(nll) for bootstrap 2018-08-09 15:34:31 -04:00
memoryruins
d9f2b51a89 [nll] librustc_msan: enable feature(nll) for bootstrap 2018-08-09 15:34:05 -04:00
memoryruins
588dbed392 [nll] librustc_lsan: enable feature(nll) for bootstrap 2018-08-09 15:33:50 -04:00
memoryruins
8172485b4d [nll] librustc_llvm: enable feature(nll) for bootstrap 2018-08-09 15:33:24 -04:00
memoryruins
4b42a2100b [nll] librustc_codegen_utils: enable feature(nll) for bootstrap 2018-08-09 15:33:06 -04:00
memoryruins
48616432ba [nll] libproc_macro: enable feature(nll) for bootstrap 2018-08-09 15:32:45 -04:00
memoryruins
ce5b9c662f [nll] libsyntax_ext: remove unnecessary mut annotation on variable
Pointed out by nll. It is correct that the mut annotation is not needed.
2018-08-09 15:32:23 -04:00
memoryruins
2cb91dad9f [nll] libsyntax_ext: enable feature(nll) for bootstrap 2018-08-09 15:28:39 -04: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
varkor
82a704abe7 Add a safety check for compiletest rlimit 2018-08-09 19:40:49 +01:00
varkor
6563803ed3 Don't set rlimit to a lower value than the current 2018-08-09 19:38:41 +01: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
ljedrz
94c3856804 A few cleanups for rustc_data_structures 2018-08-09 19:50:12 +02:00
ljedrz
160187937d Change transmute()s in IdxSet::{from_slice, from_slice_mut} to casts 2018-08-09 19:50:12 +02:00
ljedrz
ffdac5d592 Make SnapshotMap::{commit, rollback_to} take references 2018-08-09 19:50:11 +02: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
BurntPizza
c9aca02320 Don't panic on std::env::vars() when env in null.
Fixes #53200
2018-08-09 12:56:42 -04:00
QuietMisdreavus
0511b01506 set the syntax edition in the driver's phase 1 2018-08-09 11:46:39 -05: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