Commit Graph

99149 Commits

Author SHA1 Message Date
Nicholas Nethercote
163892cf50 Use Symbol in two more functions. 2019-09-16 15:00:28 +10:00
pcpthm
4333b86972 Improve BTreeSet::Intersection::size_hint
The commented invariant that an iterator is smaller than other iterator
was violated after next is called and two iterators are consumed at
different rates.
2019-09-16 04:37:52 +00:00
Nicholas Nethercote
bb229865fa Don't print the "total" -Ztime-passes output if --prints=... is also given.
Fixes #64339.
2019-09-16 13:27:38 +10:00
Nicholas Nethercote
4ecd94e121 Move impl Node just after struct Node. 2019-09-16 12:47:46 +10:00
Nicholas Nethercote
201afa6455 Minor comment tweaks. 2019-09-16 12:47:04 +10:00
Nicholas Nethercote
f22bb2e722 Use retain for waiting_cache in apply_rewrites().
It's more concise, more idiomatic, and measurably faster.
2019-09-16 12:43:48 +10:00
Nicholas Nethercote
6e48053d5d Use iterators in error_at and process_cycle.
This makes the code a little faster, presumably because bounds checks
aren't needed on `nodes` accesses. It requires making `scratch` a
`RefCell`, which is not unreasonable.
2019-09-16 12:43:16 +10:00
Nicholas Nethercote
e2492b7163 Add comments about waiting_cache. 2019-09-16 12:41:36 +10:00
Nicholas Nethercote
6391ef4d6e Fix incorrect comment about contents of a Node. 2019-09-16 12:40:31 +10:00
Nicholas Nethercote
ac061dc5c8 Fix some out-of-date names of things in comments. 2019-09-16 12:39:21 +10:00
Nicholas Nethercote
3fda9578e0 Remove out-of-date comments.
These refer to code that no longer exists.
2019-09-16 12:38:24 +10:00
Nicholas Nethercote
1936e44c13 Factor out repeated self.nodes[i] expressions. 2019-09-16 11:57:10 +10:00
Nicholas Nethercote
43c0d2ce8e Redefine NodeIndex as a newtype_index!.
This commit removes the custom index implementation of `NodeIndex`,
which probably predates `newtype_index!`.

As well as eliminating code, it improves the debugging experience,
because the custom implementation had the property of being incremented
by 1 (so it could use `NonZeroU32`), which was incredibly confusing if
you didn't expect it.

For some reason, I also had to remove an `unsafe` block marker from
`from_u32_unchecked()` that the compiler said was now unnecessary.
2019-09-16 11:53:12 +10:00
Nicholas Nethercote
04b1111ae8 Name index variables consistently.
Those with type `usize` are now called `i`, those with type `NodeIndex`
are called `index`.
2019-09-16 11:52:47 +10: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
Mark Rousskov
a678e31911 Hide diagnostics emitted during --cfg parsing
The early error is more than sufficient for fixing the problem.
2019-09-15 17:39:38 -04: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
Guanqun Lu
5355a16150 use println!() 2019-09-15 23:15:06 +08: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
Ralf Jung
5462ecb4b1 update intern classification comment 2019-09-15 14:25:30 +02:00
Ralf Jung
224e2e5e9e explain ty == None 2019-09-15 14:25:30 +02:00
Ralf Jung
3424811852 assert that nobody asks for mutable constants 2019-09-15 14:25:30 +02:00
Ralf Jung
14e3506738 note a FIXME 2019-09-15 14:25:30 +02:00
Ralf Jung
b1d4d2bfea relocations -> allocations 2019-09-15 14:25:29 +02: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
Ralf Jung
75c82b4dd8 drop redundant ParamEnv, and avoid constructing InternVisitor without visiting 2019-09-15 14:23:14 +02:00
Ralf Jung
7b8693eff8 all memory behind a constant must be immutable 2019-09-15 13:57:59 +02:00
Ralf Jung
6137691933 const interning: move mutability computation into intern_shallow, and always intern constants as immutable 2019-09-15 13:57:58 +02: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
Matthew Jasper
b4ef99f4a6 Print visibility of macro items 2019-09-15 10:22:13 +01: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