Commit Graph

101110 Commits

Author SHA1 Message Date
Nicholas Nethercote
e4ec4a6da3 Change MetaItem::tokens() to MetaItem::token_trees_and_joints().
Likewise for `NestedMetaItem::tokens()`. Also, add
`MetaItemKind::token_trees_and_joints()`, which `MetaItemKind::tokens()`
now calls.

This avoids some unnecessary `TokenTree` to `TokenStream` conversions,
and removes the need for the clumsy
`TokenStream::append_to_tree_and_joint_vec()`.
2019-10-18 13:25:17 +11:00
Nicholas Nethercote
212ae58f36 Change Lit::tokens() to Lit::token_tree().
Because most of the call sites have an easier time working with a
`TokenTree` instead of a `TokenStream`.
2019-10-18 13:25:17 +11:00
Nicholas Nethercote
a6eef299d3 Make TokenStream::from_iter less general and more efficient.
The current code has this impl:
```
impl<T: Into<TokenStream>> iter::FromIterator<T> for TokenStream
```
If given an `IntoIterator<Item = TokenTree>`, it will convert each individual
`TokenTree` to a `TokenStream` (at the cost of two allocations: a `Vec`
and an `Lrc`). It will then merge those `TokenStream`s into a single
`TokenStream`. This is inefficient.

This commit changes the impl to this less general one:
```
impl iter::FromIterator<TokenTree> for TokenStream
```
It collects the `TokenTree`s into a single `Vec` first and then converts that
to a `TokenStream` by wrapping it in a single `Lrc`. The previous generality
was unnecessary; no other code needs changing.

This change speeds up several benchmarks by up to 4%.
2019-10-18 13:25:17 +11:00
Nicholas Nethercote
d0eaf60d5e Remove two no-op into() calls. 2019-10-18 13:25:17 +11:00
bors
da59656b3b Auto merge of #65533 - Manishearth:clippyup, r=Manishearth
Update clippy

None
2019-10-18 02:15:07 +00:00
Santiago Pastorino
d53fc9cae5
Add process_* place hooks to improve code reutilization 2019-10-17 22:06:56 -04:00
Santiago Pastorino
7fa3425ef6
Setup a different visit place set of methods for mutable and immutable visitors
In particular, use a blank visit_place for mutable visitor to be sure,
non modified visitors are not trying to mutating place.
2019-10-17 22:06:56 -04:00
Santiago Pastorino
4f2a11036d
Remove unneeded callback and just use the new_local value 2019-10-17 22:06:56 -04:00
Santiago Pastorino
2b2e35bfc3
Prepare def_use MutVisitor to have projections interned 2019-10-17 22:06:56 -04:00
Santiago Pastorino
39c9ed3ac1
Prepare erase_regions MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
0fc063f159
Prepare generator MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
e3e9951673
Prepare inline MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
bb7d6d1c70
Prepare renumber MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
591cc9aede
Prepare simplify MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
e069e9ccac
Prepare promote_consts MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
5de9cb0703
super_ty on MutVisitor is empty so avoid the call 2019-10-17 22:06:55 -04:00
Esteban Küber
11011013f2 Refer to "associated functions" instead of "static methods" 2019-10-17 19:03:36 -07:00
Esteban Küber
0585475efd Avoid ICE when checking Destination of break inside a closure 2019-10-17 18:18:29 -07:00
Eduard-Mihai Burtescu
cd9e4441eb rustc: arena-allocate the slice in ty::GenericsPredicate, not the whole struct. 2019-10-18 03:14:57 +03:00
Manish Goregaokar
ebf731c638 Update clippy 2019-10-17 16:59:10 -07:00
Mark Rousskov
6be0a7081a Update API to be more compatible with plugin needs
Move to using Box<dyn Fn() -> ...> so that we can let plugins register
state.

This also adds a callback that'll get called from plugin registration so
that Clippy and other tools can register lints without using the plugin
API. The plugin API still works, but this new API is more compatible
with drivers other than rustc.
2019-10-17 19:41:21 -04:00
Mark Rousskov
b761367d52 Fix test fallout 2019-10-17 19:41:21 -04:00
Mark Rousskov
dab3bd6cda Create lint store during plugin registration
Remove lint store from Session
2019-10-17 19:41:21 -04:00
Mark Rousskov
da56d1d201 Remove all borrows of lint store from Session from librustc
Access through tcx is fine -- by that point, the lint store is frozen,
but direct access through Session will go away in future commits, as
lint store is still mutable in early stages of Session, and will be
removed completely.
2019-10-17 19:41:21 -04:00
Mark Rousskov
c4475c753b Access future incompatibility information directly
Avoid querying LintStore when not necessary
2019-10-17 19:41:21 -04:00
Mark Rousskov
7abb1fafce Remove side table of future incompatibility info
Moves this information to a direct field of Lint, which is where it
belongs.
2019-10-17 19:41:21 -04:00
Mark Rousskov
c1abc30660 Make declare_lint take any amount of boolean fields 2019-10-17 19:41:21 -04:00
Mark Rousskov
aa4ee2cc0f Move to storing constructor functions inside LintStore
This stops storing the pass objects and instead stores constructor
functions.

The primary effect is that LintStore no longer has any interior
mutability.
2019-10-17 19:16:41 -04:00
Mark Rousskov
24545128eb Take lint passes as constructor functions 2019-10-17 19:16:41 -04:00
Mark Rousskov
7fef39791a Make get_lints be a static function
This moves from calling get_lints on instantiated pass objects to the
raw object
2019-10-17 19:16:41 -04:00
Mark Rousskov
68c07db80a No longer implicitly register lints when registering passes
This is in preparation for on-demand constructing passes
2019-10-17 19:16:41 -04:00
Mark Rousskov
e1079c82be Split out just registration to separate function 2019-10-17 19:16:41 -04:00
Mark Rousskov
b060f3b84d Split module and crate late pass registration 2019-10-17 19:16:41 -04:00
Mark Rousskov
748eccd488 Lints being from a plugin is dependent on the lint, not the registration 2019-10-17 19:16:41 -04:00
Mark Rousskov
2121b04751 Handle lints, not passes in push_lints
This extracts the call to get_lints() to callers.
2019-10-17 19:16:41 -04:00
Mark Rousskov
577d442fe8 De-propagate optional session from lint registration
This is straight up removing dead code, but is a separate commit from
the previous to avoid conflating clean up and important changes.
2019-10-17 19:16:40 -04:00
Mark Rousskov
47a443c50d Duplicate lint specifications are always bug!
Replace early_error and sess.err with bug!, in all cases. If the
compiler we're running with, including plugins, is registering something
twice, that's a (compiler/plugin) programmer error -- we should not try
to be nice at the cost of developer ergononomics (hiding the stacktrace
of the second registration is bad).

This also is basically a static bug in ~all cases so it should not be a
detriment to users, including with plugins.
2019-10-17 19:16:40 -04:00
Dan Gohman
b25e3238c7 Don't add argc and argv arguments to main on WASI.
Add a target setting to allow targets to specify whether the generated
`main` function should be passed `argc` and `argv` arguments. Set it
to false on wasm32-wasi, since WASI's `args::args()` calls into the
WASI APIs itself. This will allow the WASI toolchain to avoid linking
and running command-line argument initialization code when the arguments
aren't actually needed.
2019-10-17 16:16:35 -07:00
Tshepang Lekhonkhobe
c9b27d1236 doc: make BitSet intro more short
Also, add a link to the growable type
2019-10-18 01:16:30 +02:00
Stein Somers
56974329d1 BTreeSet symmetric_difference & union optimized, cleaned 2019-10-18 00:11:32 +02:00
Ralf Jung
c0b7e769a0 example for padding any format 2019-10-17 23:02:09 +02:00
Niko Matsakis
54879949f1
Update triagebot.toml
Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
2019-10-17 16:53:47 -04:00
Ralf Jung
4e6efe4811 reorder fmt docs for more clarity 2019-10-17 21:22:46 +02:00
bors
fa0f7d0080 Auto merge of #65495 - Centril:rollup-tguwjt5, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #65237 (Move debug_map assertions after check for err)
 - #65316 (make File::try_clone produce non-inheritable handles on Windows)
 - #65319 (InterpCx: make memory field public)
 - #65461 (Don't recommend ONCE_INIT in std::sync::Once)
 - #65465 (Move syntax::ext to a syntax_expand and refactor some attribute logic)
 - #65475 (add example for type_name)
 - #65478 (fmt::Write is about string slices, not byte slices)
 - #65486 (doc: fix typo in OsStrExt and OsStringExt)

Failed merges:

r? @ghost
2019-10-17 18:53:10 +00:00
Igor Matuszewski
ad6ce46986 save-analysis: Add a relevant test case 2019-10-17 20:49:06 +02:00
Igor Matuszewski
5fe88abed0 save-analysis: Nest tables when processing impl items 2019-10-17 20:48:00 +02:00
Niko Matsakis
a4d94925c7
add option to ping llvm ice-breakers to triagebot 2019-10-17 14:15:59 -04:00
Lucas Henry
a1387e352f Replaced pretty-json error-format with only json 2019-10-17 19:52:29 +02:00
Lucas Henry
46a44668b2 Replaced pretty-json error-format with only json 2019-10-17 19:52:29 +02:00
Lucas Henry
43b5dcaabb Replaced warn attribute by deny 2019-10-17 19:52:06 +02:00