Commit Graph

101066 Commits

Author SHA1 Message Date
Tobias Rapp
769e75b40c Fix left/right shift typo in wrapping rotate docs
This makes the note similar to the one found on rotate functions for
primitive types like i32/u32.
2019-10-18 08:46:30 +02:00
Nicholas Nethercote
d343ee839b Remove Hash impls for DefPath, DisambiguatedDefPathData, and DefKey.
They aren't used.
2019-10-18 16:36:17 +11:00
Igor Aleksanov
a06b205177 Add public re-exports for benches 2019-10-18 08:32:44 +03:00
Nicholas Nethercote
0879f63074 Remove Copy and Clone impls for LocalInternedString.
They aren't used.
2019-10-18 16:05:14 +11:00
Esteban Küber
f65a492afc Point at enclosing function without self receiver 2019-10-17 20:26:21 -07:00
oxalica
2ee45c9da2
Fix cast of stx_btime.tv_nsec 2019-10-18 10:32:27 +08:00
oxalica
15cb3e08e3
Fix cfgs for current libc 2019-10-18 10:32:27 +08:00
oxalica
43f398be6d
Prefer statx on linux if available 2019-10-18 10:32:27 +08:00
Nicholas Nethercote
3532863a96 Change how Symbol::Debug works.
Currently, `Symbol::Debug` and `Symbol::Display` produce the same
output; neither wraps the symbol in double quotes.

This commit changes `Symbol::Debug` so it wraps the symbol in quotes.
This change brings `Symbol`'s behaviour in line with `String` and
`InternedString`. The change requires a couple of trivial test output
adjustments.
2019-10-18 13:26:03 +11:00
Nicholas Nethercote
d8fca9ee4e Use with in Symbol trait methods.
Instead of `as_str()`, which unnecessarily involves `LocalInternedString`.
2019-10-18 13:26:03 +11:00
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
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