Commit Graph

99010 Commits

Author SHA1 Message Date
Ralf Jung
75fe84f4fc factor getting the discriminant layout to a new method 2019-09-16 13:15:56 +02:00
Ralf Jung
b73f1a51dc better and more consistent variable names 2019-09-16 13:08:21 +02:00
Ralf Jung
8c0f601105 fix Miri discriminant load/store when overflows are involved 2019-09-16 12:33:47 +02:00
bors
3e3e06dfdd Auto merge of #64487 - Xanewok:update-rls, r=jonas-schievink
Update RLS

Fixes the toolstate.

Closes #64480

r? @jonas-schievink
2019-09-16 00:15:45 +00:00
bors
06c94ee79b Auto merge of #64491 - Centril:rollup-21wkl69, r=Centril
Rollup of 3 pull requests

Successful merges:

 - #63872 (Document platform-specific behavior of the iterator returned by std::fs::read_dir)
 - #64250 (save-analysis: Nest typeck tables when processing functions/methods)
 - #64472 (Don't mark expression with attributes as not needing parentheses)

Failed merges:

r? @ghost
2019-09-15 20:06:49 +00:00
Mazdak Farrokhzad
0592d13757
Rollup merge of #64472 - Mark-Simulacrum:unused-parens-attr, r=varkor
Don't mark expression with attributes as not needing parentheses

This is not perfectly correct as `#[attr] (5)` will still not lint, but it does seem good enough, in particular as the parentheses in that case are not unambiguously incorrect; I might personally prefer to see them for clarity.

Fixes https://github.com/rust-lang/rust/issues/43279.
2019-09-15 19:36:01 +02:00
Mazdak Farrokhzad
2e11e81f1e
Rollup merge of #64250 - Xanewok:save-analysis-assoc-nested, r=varkor
save-analysis: Nest typeck tables when processing functions/methods

Fixes an issue where we did not nest tables correctly when resolving
associated types in formal argument/return type positions.

This was the minimized reproduction case that I tested the fix on:
```rust
pub trait Trait {
    type Assoc;
}

pub struct A;

pub fn func() {
    fn _inner1<U: Trait>(_: U::Assoc) {}
    fn _inner2<U: Trait>() -> U::Assoc { unimplemented!() }

    impl A {
        fn _inner1<U: Trait>(self, _: U::Assoc) {}
        fn _inner2<U: Trait>(self) -> U::Assoc { unimplemented!() }
    }
}
```
using `debug_assertions`-enabled rustc and by additionally passing `-Zsave-analysis`.

Unfortunately the original assertion fired is a *debug* one and from what I can tell we don't run the tests with these on, so I'm not adding a test here. If I missed it and there is a way to run tests with these on, I'd love to add a test case for this.

Closes #63663
Closes #50328
Closes #43982
2019-09-15 19:35:59 +02:00
Mazdak Farrokhzad
0a2e07ec1d
Rollup merge of #63872 - marmistrz:readdir, r=jonas-schievink
Document platform-specific behavior of the iterator returned by std::fs::read_dir
2019-09-15 19:35:58 +02:00
bors
96d07e0ac9 Auto merge of #64474 - Mark-Simulacrum:permit-err-overlap, r=matthewjasper
Permit impls referencing errors to overlap

Fixes #43400; previously this would emit an overlapping impls error, but no longer does.
2019-09-15 16:21:34 +00:00
Igor Matuszewski
f90f7ac46a Update RLS 2019-09-15 16:00:01 +02:00
Mark Rousskov
959c710e85 Permit impls referencing errors to overlap 2019-09-15 08:33:00 -04:00
bors
60895fd1f9 Auto merge of #64483 - petrochenkov:expectattr2, r=Centril
resolve: Tweak some "cannot find" wording for macros
2019-09-15 12:24:32 +00:00
Vadim Petrochenkov
f7f8d6584b resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00
Vadim Petrochenkov
42a19dde82 resolve: Tweak "cannot find" wording for attributes 2019-09-15 13:10:12 +03:00
bors
117cdf35d4 Auto merge of #64469 - matthewjasper:increase-hygiene-use, r=petrochenkov
Cleanup handling of hygiene for built-in macros

This makes most identifiers generated by built-in macros use def-site hygiene, not only the ones that previously used gensyms.

* `ExtCtxt::ident_of` now takes a `Span` and is preferred to `Ident::{from_str, from_str_and_span}`
* Remove `Span::with_legacy_ctxt`
    * `assert` now uses call-site hygiene because it needs to resolve `panic` unhygienically.
    * `concat_idents` now uses call-site hygiene because it wouldn't be very useful with def-site hygiene.
    * everything else is moved to def-site hygiene

r? @petrochenkov
2019-09-15 08:17:57 +00:00
Matthew Jasper
8ab67c8f56 Remove with_legacy_ctxt 2019-09-15 09:15:38 +01:00
Matthew Jasper
5ae3830d58 Give more Idents spans 2019-09-15 09:15:38 +01:00
Matthew Jasper
57a45e9cbd Avoid some unnecessary &str to Ident conversions 2019-09-15 09:15:37 +01:00
Matthew Jasper
e8d2f62924 Prefer Symbol to Ident when there's no sensible Span 2019-09-15 09:15:37 +01:00
bors
8bf776d5c2 Auto merge of #64478 - Centril:rollup-bnt51w1, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #64457 (def_collector: Do not ICE on attributes on unnamed fields)
 - #64463 (resolve: Tweak some expected/found wording)
 - #64471 (Warn on no_start, crate_id attribute use)
 - #64473 (Use try_fold instead of manually carrying an accumulator)
 - #64475 (simplify the initialization)

Failed merges:

r? @ghost
2019-09-15 03:59:08 +00:00
Mazdak Farrokhzad
88bd5646f1
Rollup merge of #64475 - guanqun:use-same-name, r=Centril
simplify the initialization
2019-09-15 02:29:49 +02:00
Mazdak Farrokhzad
82927cf826
Rollup merge of #64473 - spastorino:use-try-fold, r=Centril
Use try_fold instead of manually carrying an accumulator

r? @RalfJung
2019-09-15 02:29:47 +02:00
Mazdak Farrokhzad
3e4c7786e9
Rollup merge of #64471 - Mark-Simulacrum:warn-depr-attr, r=Centril
Warn on no_start, crate_id attribute use

These attributes are now deprecated; they don't have any use anymore.

`no_start` stopped being applicable in 3ee916e50b as part of #18967. Ideally we would've removed it pre-1.0, but since that didn't happen let's at least mark it deprecated.

`crate_id` was renamed to `crate_name` in 50ee1ec1b4 as part of #15319. Ideally we would've followed that up with a removal of crate_id itself as well, but that didn't happen; this PR finally marks it as deprecated at least.

Fixes https://github.com/rust-lang/rust/issues/43142 and resolves https://github.com/rust-lang/rust/issues/43144.
2019-09-15 02:29:46 +02:00
Mazdak Farrokhzad
17798939f2
Rollup merge of #64463 - petrochenkov:expectattr, r=Centril
resolve: Tweak some expected/found wording
2019-09-15 02:29:44 +02:00
Mazdak Farrokhzad
8f55245fdc
Rollup merge of #64457 - petrochenkov:macunfield, r=matthewjasper
def_collector: Do not ICE on attributes on unnamed fields

The primary issue here is that the expansion infra needs to visit a field in isolation, and fields don't know their own indices during expansion, so they have to be kept in some other place (e.g. `struct Definitions`).

Fixes https://github.com/rust-lang/rust/issues/64385
2019-09-15 02:29:43 +02:00
bors
572d3d9634 Auto merge of #60584 - jonas-schievink:ice-panic-hook, r=oli-obk
Use `panic::set_hook` to print the ICE message

This allows custom frontends and backends to override the hook with their own, for example to point people to a different issue tracker.

ICE messages are printed in a slightly different order now. Nightly prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-nightly (08bfe1612 2019-05-02) running on x86_64-unknown-linux-gnu
```

After this PR, rustc prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
```
2019-09-15 00:10:08 +00:00
Mark Rousskov
a0e48b6d25 Warn on no_start, crate_id attribute use
These attributes are now deprecated; they don't have any use anymore.
2019-09-14 19:43:39 -04:00
Guanqun Lu
71d45499a5 simply the initialization 2019-09-15 07:38:18 +08:00
Santiago Pastorino
8ee77a268f
Use try_fold instead of manually carrying an accumulator 2019-09-14 19:51:40 -03:00
Mark Rousskov
1d33f06de8 Don't mark expression with attributes as not needing parentheses
This is not perfectly correct as `#[attr] (5)` will still not lint, but
it does seem good enough, in particular as the parentheses in that case
are not unambiguously incorrect.
2019-09-14 18:43:48 -04:00
Igor Matuszewski
a946b8d6e1 save-analysis: Process bounds in impl trait only in argument position 2019-09-15 00:42:33 +02:00
Igor Matuszewski
30e39e871f save-analysis: Deduplicate lookup_{d,r}ef_id functions 2019-09-15 00:42:33 +02:00
Jonas Schievink
dab68131d3 Try to fix the test output normalization 2019-09-14 23:02:22 +02:00
bors
b35ebac961 Auto merge of #64466 - Centril:rollup-s3nlb9e, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #61797 (Stabilise weak_ptr_eq)
 - #64290 (Provide a span if main function is not present in crate)
 - #64406 (Ban non-extern rust intrinsics)
 - #64462 (feature_gate: Remove dead code from attribute checking)

Failed merges:

r? @ghost
2019-09-14 20:16:54 +00:00
Mazdak Farrokhzad
45e50e2fd2
Rollup merge of #64462 - petrochenkov:remattr, r=Centril
feature_gate: Remove dead code from attribute checking

https://github.com/rust-lang/rust/pull/63468 is merged, so all attributes go through name resolution now, so we can remove code that previously performed some checks for attributes not going through resolution.
2019-09-14 22:16:07 +02:00
Mazdak Farrokhzad
5f9b9b275a
Rollup merge of #64406 - Mark-Simulacrum:error-unknown-intrinsic, r=Centril
Ban non-extern rust intrinsics

Intrinsics can only be defined by the compiler.

Fixes https://github.com/rust-lang/rust/issues/36979
2019-09-14 22:16:06 +02:00
Mazdak Farrokhzad
d29df01b08
Rollup merge of #64290 - Mark-Simulacrum:span-no-main, r=estebank
Provide a span if main function is not present in crate

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves #36561.
2019-09-14 22:16:05 +02:00
Mazdak Farrokhzad
dee08ba55a
Rollup merge of #61797 - Thomasdezeeuw:stablise-weak_ptr_eq, r=RalfJung
Stabilise weak_ptr_eq

Implemented in #55987.

Closes #55981.
2019-09-14 22:16:03 +02:00
Vadim Petrochenkov
f6a5b29d19 resolve: Tweak some expected/found wording 2019-09-14 22:36:58 +03:00
Vadim Petrochenkov
cb771fdd6c feature_gate: Eliminate check::Context
Use `PostExpansionVisitor` directly instead
2019-09-14 21:59:03 +03:00
Vadim Petrochenkov
a01ba39b4b feature_gate: Merge various attribute gating functions 2019-09-14 21:54:26 +03:00
Vadim Petrochenkov
966d96c9d2 feature_gate: Remove dead code from attribute checking
Same checks are performed during name resolution, and all attributes go through name resolution now
2019-09-14 21:54:26 +03:00
Mark Rousskov
7b3adc289e Ban non-extern rust intrinsics
Intrinsics can only be defined by the compiler.
2019-09-14 11:47:02 -04:00
Mark Rousskov
b7f20d06ea Provide a span if main function is not present in crate
Unfortunately, the diagnotic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.
2019-09-14 11:27:45 -04:00
bors
ca3766e2e5 Auto merge of #64456 - Centril:rollup-ytqdwaq, r=Centril
Rollup of 17 pull requests

Successful merges:

 - #63846 (Added table containing the system calls used by Instant and SystemTime.)
 - #64116 (Fix minor typo in docs.)
 - #64203 (A few cosmetic improvements to code & comments in liballoc and libcore)
 - #64302 (Shrink `ObligationCauseCode`)
 - #64372 (use randSecure and randABytes)
 - #64374 (Box `DiagnosticBuilder`.)
 - #64375 (Fast path for vec.clear/truncate )
 - #64378 (Fix inconsistent link formatting.)
 - #64384 (Trim rustc-workspace-hack)
 - #64393 ( declare EnvKey before use to fix build error)
 - #64420 (Inline `mark_neighbours_as_waiting_from`.)
 - #64422 (Remove raw string literal quotes from error index descriptions)
 - #64423 (Add self to .mailmap)
 - #64425 (typo fix)
 - #64431 (fn ptr is structural match)
 - #64435 (codegen: use "_N" (like for other locals) instead of "argN", for argument names.)
 - #64439 (fix #64430, confusing `owned_box` error message in no_std build)

Failed merges:

r? @ghost
2019-09-14 14:43:32 +00:00
Mazdak Farrokhzad
1c7959bb5d
Rollup merge of #64439 - 12101111:fix-owned-box, r=Centril
fix #64430, confusing `owned_box` error message in no_std build

Fixes #64430
2019-09-14 16:42:42 +02:00
Mazdak Farrokhzad
bf1253b347
Rollup merge of #64435 - eddyb:arguments-against-arg, r=rkruppe
codegen: use "_N" (like for other locals) instead of "argN", for argument names.

Based on #64408 (second commit is new), fixing something I mentioned in #64408 (which turned to be an immediate blocker for unifying relevant codepaths).

Closes #64408 (by containing it).

r? @rkruppe
2019-09-14 16:42:40 +02:00
Mazdak Farrokhzad
5160e4bf91
Rollup merge of #64431 - pnkfelix:issue-63479-fnptr-is-structural-match, r=varkor
fn ptr is structural match

Make fn ptr always structural match, regardless of whether the formal parameter types or return type are.

Fix #63479.
2019-09-14 16:42:39 +02:00
Mazdak Farrokhzad
4398eb7b54
Rollup merge of #64425 - guanqun:typo-fix, r=matthewjasper
typo fix
2019-09-14 16:42:38 +02:00
Mazdak Farrokhzad
70787c7d85
Rollup merge of #64423 - ollie27:mailmap, r=Mark-Simulacrum
Add self to .mailmap
2019-09-14 16:42:36 +02:00