Alex Crichton [Wed, 7 Mar 2018 02:01:12 +0000 (20:01 -0600)]
Rollup merge of #48778 - sinkuu:rls_crash_tuple_struct, r=nrc
Fix save-analysis generation crash with invalid tuple access
Reproduction:
```rust
fn invalid_tuple_struct_accessing() {
bar.0;
}
```
```
error[E0425]: cannot find value `bar` in this scope
--> test.rs:2:5
|
2 | bar.0;
| ^^^ not found in this scope
error[E0601]: main function not found
error: internal compiler error: librustc_save_analysis/dump_visitor.rs:1678: Expected struct or tuple type, found TyError
--> test.rs:2:5
|
2 | bar.0;
| ^^^^^
thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:482:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```
This should fix a crash in RLS when editing such code. cc @nrc
Alex Crichton [Wed, 7 Mar 2018 02:01:07 +0000 (20:01 -0600)]
Rollup merge of #48618 - scottmcm:elaborate-exitcode, r=alexcrichton
Better docs and associated SUCCESS/FAILURE for process::ExitCode
Follow-up to https://github.com/rust-lang/rust/pull/48497#discussion_r170676525, since that PR was the minimal thing to unblock https://github.com/rust-lang/rust/issues/48453#issuecomment-368155082.
bors [Tue, 6 Mar 2018 22:40:15 +0000 (22:40 +0000)]
Auto merge of #48642 - alexcrichton:compile-cargo-once, r=michaelwoerister
Update env_logger to 0.5.4
It looks like this cuts down on the number of dependencies in env_logger and
notably cuts out a difference between a shared dependency of rls/cargo. My goal
here is to ensure that when we compile the RLS/Cargo on CI we only compile Cargo
once, and this is one step towards that!
Alex Crichton [Thu, 1 Mar 2018 19:08:48 +0000 (11:08 -0800)]
Update env_logger to 0.5.4
It looks like this cuts down on the number of dependencies in env_logger and
notably cuts out a difference between a shared dependency of rls/cargo. My goal
here is to ensure that when we compile the RLS/Cargo on CI we only compile Cargo
once, and this is one step towards that!
kennytm [Tue, 6 Mar 2018 10:21:35 +0000 (18:21 +0800)]
Rollup merge of #47463 - bluss:fused-iterator, r=alexcrichton
Stabilize FusedIterator
FusedIterator is a marker trait that promises that the implementing
iterator continues to return `None` from `.next()` once it has returned
`None` once (and/or `.next_back()`, if implemented).
The effects of FusedIterator are already widely available through
`.fuse()`, but with stable `FusedIterator`, stable Rust users can
implement this trait for their iterators when appropriate.
This Python script converts documentation comments from the
`#[doc = "..."]` attribute to the `///` syntax. It was added six
years ago, presumably to help with the transition when `///` was
implemented and hasn't really been touched since. I don't think there's
much value in keeping it around at this point.
bors [Tue, 6 Mar 2018 11:52:16 +0000 (11:52 +0000)]
Auto merge of #48611 - michaelwoerister:share-generics2, r=alexcrichton
Don't recompute SymbolExportLevel for upstream crates.
The data collected in #48373 suggests that we can avoid generating up to 30% of the LLVM definitions by only instantiating function monomorphizations once with a given crate graph. Some more data, collected with a [proof-of-concept implementation](https://github.com/michaelwoerister/rust/commits/share-generics) of re-using monomorphizations, which is less efficient than the MIR-only RLIB approach, suggests that it's still around 25% LLVM definitions that we can save.
So far, this PR only cleans up handling of symbol export status. Too early to review still.
kennytm [Tue, 6 Mar 2018 08:25:30 +0000 (16:25 +0800)]
Rollup merge of #48432 - flip1995:lit_diag, r=oli-obk
Suggest type for overflowing bin/hex-literals
Fixes #48073
For hexadecimal and binary literals, which overflow, it gives an additional note to the warning message, like in this [comment](https://github.com/rust-lang/rust/issues/48073#issuecomment-365370113).
Additionally it will suggest a type (`X < Y`):
- `iX`: if literal fits in `uX` => `uX`, else => `iY`
- `-iX` => `iY`
- `uX` => `uY`
Exceptions: `isize`, `usize`. I don't think you can make a good suggestion here. The programmer has to figure it out on it's own in this case.
bors [Tue, 6 Mar 2018 06:14:11 +0000 (06:14 +0000)]
Auto merge of #48509 - Phlosioneer:option-doc-change, r=TimNN
Slight modification to the as_ref example of std::option::Option
A user in a reddit thread was confused by the name of the variable
"num_as_int"; they thought the example was trying to convert the
string "10" as if it were binary 2 by calling str::len(). In reality,
the example is simply demonstrating how to take an immutable reference
to the value of an Option. The confusion comes from the coincidence
that the length of the string "10" is also its binary representation,
and the implication from the variable names that a conversion was
occuring ("num_as_str" to "num_as_int").
This PR changes the example number to 12 instead of 10, and changes
the variable name from "num_as_int" to "num_length" to better
communicate what the example is doing.
The reddit thread:
https://www.reddit.com/r/rust/comments/7zpvev/notyetawesome_rust_what_use_cases_would_you_like/dur39xw/
This Python script converts documentation comments from the
`#[doc = "..."]` attribute to the `///` syntax. It was added six
years ago, presumably to help with the transition when `///` was
implemented and hasn't really been touched since. I don't think there's
much value in keeping it around at this point.
bors [Mon, 5 Mar 2018 18:39:40 +0000 (18:39 +0000)]
Auto merge of #48208 - michaelwoerister:track-features, r=petrochenkov
Turn feature-gate table into a query so it is covered by dependency tracking.
Turn access to feature gates into a query so we handle them correctly during incremental compilation.
Features are still available via `Session` through `features_untracked()`. I wish we had a better way of hiding untracked information. It would be great if we could remove the `sess` field from `TyCtxt`.
bors [Sun, 4 Mar 2018 18:16:43 +0000 (18:16 +0000)]
Auto merge of #48592 - spastorino:borrowed_value_error, r=nikomatsakis
[NLL] Avoid borrowed value must be valid for lifetime '_#2r..." in errors
Closes #48428
- [x] If NLL is enabled, [do not invoke `note_and_explain_region`](https://github.com/rust-lang/rust/issues/48428#issuecomment-367691123)
- [x] Modify `-Zdump-nll-cause` to not print [the overwhelming debug output here](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/nll/region_infer/mod.rs#L1288-L1299). This way we should I believe at least get nice-ish output for [our original example](https://github.com/rust-lang/rust/issues/48428#issue-299364536).
- [x] Extend `explain_why_borrow_contains_point` to also work for "universal lifetimes" like the `'a` in [the example at the end of this comment](https://github.com/rust-lang/rust/issues/48428#issuecomment-367691123).
- [ ] Figure out how to enable causal information all the time (but that is https://github.com/rust-lang/rust/issues/46590).