Commit Graph

100733 Commits

Author SHA1 Message Date
Mark Rousskov
4e8d1b2292 Add some documentation 2019-10-22 16:53:28 -04: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
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
bors
b04338087e Auto merge of #64595 - Mark-Simulacrum:trivial-query, r=pnkfelix
Optimize dropck

This does two things: caches the `trivial_dropck` check by making it a query, and shifts around the implementation of the primary dropck itself to avoid allocating many small vectors.
2019-10-17 14:42:24 +00:00
Mazdak Farrokhzad
060aedd385
Rollup merge of #65486 - mathstuf:osstr-doc-typo, r=TimNN
doc: fix typo in OsStrExt and OsStringExt
2019-10-17 13:46:15 +02:00
Mazdak Farrokhzad
4f84bd4bc5
Rollup merge of #65478 - RalfJung:write, r=jonas-schievink
fmt::Write is about string slices, not byte slices

No idea why the docs talk about bytes, maybe a copy-paste error?
2019-10-17 13:46:13 +02:00
Mazdak Farrokhzad
5bf5d6dc73
Rollup merge of #65475 - lzutao:eg_type_name, r=Centril
add example for type_name

So users of this function could at least expect what its output for current compiler version.
2019-10-17 13:46:12 +02:00
Mazdak Farrokhzad
accc6e7e4a
Rollup merge of #65465 - Centril:split-syntax-1, r=petrochenkov
Move syntax::ext to a syntax_expand and refactor some attribute logic

Part of https://github.com/rust-lang/rust/pull/65324.

r? @petrochenkov
2019-10-17 13:46:11 +02:00
Mazdak Farrokhzad
55f2ac2483
Rollup merge of #65461 - Kampfkarren:patch-1, r=Centril
Don't recommend ONCE_INIT in std::sync::Once

ONCE_INIT is deprecated, and so suggesting it as not only being on par with, but before `Once::new` is a bad idea.
2019-10-17 13:46:09 +02:00
Mazdak Farrokhzad
60ac3335fd
Rollup merge of #65319 - RalfJung:memory, r=Centril
InterpCx: make memory field public

I made this field private forever ago because I thought sealing things might be nice. But with the `memory_mut` getter it doesn't actually seal anything, and it's not like we need to invalidate caches on writes to memory or so. And moreover, having to use the getters leads to some annoying borrow checking interactions.

So, let's just make it public (again).

r? @oli-obk
2019-10-17 13:46:06 +02:00
Mazdak Farrokhzad
10b580a1d1
Rollup merge of #65316 - oconnor663:noninheritable, r=alexcrichton
make File::try_clone produce non-inheritable handles on Windows

~**NOT READY FOR REVIEW.** This PR is currently mainly to trigger CI so that I can see what happens. (Is there a better way to trigger CI?) I don't know whether this change makes sense yet.~ (Edit: @Mark-Simulacrum clarified that CI doesn't currently run on Windows.)

---

File handles shouldn't be inheritable in general.
`std::process::Command` takes care of making them inheritable when child
processes are spawned, and the `CREATE_PROCESS_LOCK` protects against
races in that section on Windows. But `File::try_clone` has been
creating inheritable file descriptors outside of that lock, which could
be leaking into other child processes unintentionally.

See also https://github.com/rust-lang/rust/pull/31069#discussion_r334117665.
2019-10-17 13:46:04 +02:00
Mazdak Farrokhzad
0059411cae
Rollup merge of #65237 - KodrAus:fix/map-entry-err, r=sfackler
Move debug_map assertions after check for err

Fixes #65231

We have some assertions in `DebugMap` to catch broken implementations of `Debug` that produce malformed entries. These checks don't make sense if formatting fails partway through. This PR moves those assertions to within the `and_then` closures along with the other formatting logic, so they're only checked if the map hasn't failed to format an entry already.
2019-10-17 13:46:03 +02:00
bors
ea45150837 Auto merge of #59953 - eddyb:soa-metadata, r=michaelwoerister
rustc_metadata: replace Entry table with one table for each of its fields (AoS -> SoA).

In https://github.com/rust-lang/rust/pull/59789#issuecomment-481958212 I noticed that for many cross-crate queries (e.g. `predicates_of(def_id)`), we were deserializing the `rustc_metadata::schema::Entry` for `def_id` *only* to read one field (i.e. `predicates`).

But there are several such queries, and `Entry` is not particularly small (in terms of number of fields, the encoding itself is quite compact), so there is a large (and unnecessary) constant factor.

This PR replaces the (random-access) array¹ of `Entry` structures ("AoS"), with many separate arrays¹, one for each field that used to be in `Entry` ("SoA"), resulting in the ability to read individual fields separately, with negligible time overhead (in thoery), and some size overhead (as these arrays are not sparse).

In a way, the new approach is closer to incremental on-disk caches, which store each query's cached results separately, but it would take significantly more work to unify the two.

For stage1 `libcore`'s metadata blob, the size overhead is `8.44%`, and I have another commit (~~not initially included because I want to do perf runs with both~~ **EDIT**: added it now) that brings it down to `5.88%`.

¹(in the source, these arrays are called "tables", but perhaps they could use a better name)
2019-10-17 10:45:09 +00:00
bors
a16dca337d Auto merge of #65251 - tlively:emscripten-upstream-upgrade, r=tlively
Upgrade Emscripten targets to use upstream LLVM backend

 - Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.

r? @alexcrichton
2019-10-17 06:47:18 +00:00
Thomas Lively
c0aa7cb2b5 Remove PR runs, enable wasm32 CI, and move asmjs to disabled 2019-10-16 21:18:34 -07:00
Ben Boeckel
fb6d5e6b1f doc: fix typo in OsStrExt and OsStringExt 2019-10-16 22:22:19 -04:00
bors
7e498005a1 Auto merge of #65234 - GuillaumeGomez:long-err-explanation-E0573, r=kinnison
Add long error explanation for E0573

Part of #61137.
2019-10-17 02:04:49 +00:00
Thomas Lively
4b26d9c142 User should not change between emcc install and use 2019-10-16 17:06:48 -07:00
Thomas Lively
36808c251c Update test expectations 2019-10-16 17:06:48 -07:00
Thomas Lively
b0b6e368c0 Update test and add -O1 to wasm32 Dockerfile 2019-10-16 17:06:48 -07:00
Thomas Lively
a2264f6af5 Temporarily enable asmjs and wasm32 on PR CI 2019-10-16 17:06:48 -07:00
Thomas Lively
2bf59bea48 Upgrade Emscripten targets to use upstream LLVM backend
- Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-16 17:06:48 -07:00
Ralf Jung
e490aaea7e fmt::Write is about string slices, not byte slices 2019-10-16 23:24:38 +02:00
Mazdak Farrokhzad
8ca16ddfd4 panictry!(..) -> .unwrap() 2019-10-16 22:54:28 +02:00
bors
c8fa82c482 Auto merge of #63756 - Zoxc:sharded-dep-graph-1, r=nikomatsakis
Use more fine grained locks for the dep graph

Split out from https://github.com/rust-lang/rust/pull/61845.

r? @michaelwoerister cc @aturon
2019-10-16 20:49:27 +00:00
Lzu Tao
940d48ed60 add example for type_name 2019-10-16 16:54:04 +00:00
bors
0e8a4b441c Auto merge of #65445 - ehuss:update-cargo-books, r=alexcrichton
Update cargo, books

## nomicon

3 commits in 4374786f0b4bf0606b35d5c30a9681f342e5707b..5004ad30d69f93553ceef74439fea2159d1f769e
2019-09-17 18:33:21 +0200 to 2019-10-12 19:52:40 +0200
- further clarify C11 and C/C++11 terminology (rust-lang-nursery/nomicon#169)
- atomics: C11 -&gt; C++20 (rust-lang-nursery/nomicon#168)
- use sound/unsound terminology

## cargo

12 commits in a429e8cc4614a46a86322a0777a477e2baa83f1c..3a9abe3f065554a7fbc59f440df2baba4a6e47ee
2019-10-04 17:36:12 +0000 to 2019-10-15 15:55:35 +0000
- Fix typo in git index initialization error path (rust-lang/cargo#7512)
- Reject feature flags in a virtual workspace. (rust-lang/cargo#7507)
- Rename `overrides` to `package` in profiles. (rust-lang/cargo#7504)
- Allow publishing with dev-dependencies without a version. (rust-lang/cargo#7333)
- Stabilize cache-messages (rust-lang/cargo#7450)
- don't lock the package cache when cleaning target dir. (rust-lang/cargo#7502)
- Document rustc wrapper (rust-lang/cargo#7499)
- Migrate towards exclusively using serde for `Config` (rust-lang/cargo#7456)
- Re-enable some MSVC tests. (rust-lang/cargo#7492)
- when -Z unstable-options not specified, don't validate --profile (rust-lang/cargo#7489)
- Improve error message for cyclic dependencies (rust-lang/cargo#7470)
- Some minor clippy fixes. (rust-lang/cargo#7484)

## book

7 commits in 04806c80be0f54b1290287e3f85e84bdfc0b6ec7..9bb8b161963fcebc9d9ccd732ba26f42108016d5
2019-10-01 20:20:22 -0400 to 2019-10-14 18:42:55 -0500
- Make a portion of text less ambiguous (rust-lang/book#2092)
- fix heading level (rust-lang/book#2117)
- Add missing "of" before `"duck typing"`. (rust-lang/book#1951)
- ch18-03: no need to debug print destructured int (rust-lang/book#1991)
- Subtle fix to introduce ? on Option in Chapter 9.2 (rust-lang/book#2047)
- make wording clearer (rust-lang/book#1976)
- Update the version of rand we use

## rust-by-example

5 commits in a6288e7407a6c4c19ea29de6d43f40c803883f21..0b111eaae36cc4b4997684be853882a59e2c7ca7
2019-10-01 10:09:14 -0300 to 2019-10-14 18:34:25 -0300
- Some fix to three files (rust-lang/rust-by-example#1280)
- Add reference to Generics (rust-lang/rust-by-example#1281)
- Confusing and long sentence (rust-lang/rust-by-example#1282)
- Explicit mention of slice range meaning (rust-lang/rust-by-example#1277)
- Updated aliasing for nll (rust-lang/rust-by-example#1276)
2019-10-16 16:48:44 +00:00
Mazdak Farrokhzad
1a26fdf9b2 ui-fulldeps: make them pass again? 2019-10-16 17:21:32 +02:00
Eric Huss
5bb05a2c5e Update cargo, books 2019-10-16 06:43:44 -07:00
bors
53aca553ec Auto merge of #65172 - tanriol:explain_borrow-use-context-dominators, r=nagisa
use precalculated dominators in explain_borrow

This looks like the only place calculating dominators from the MIR body every time instead of using the ones stored on the `MirBorrowckCtxt`. For example, in rust-lang/rust#65131 a big generated function with a number of borrowck errors takes a few hours(!) recalculating the dominators while explaining the errors.

I don't know enough about this part of rustc codebase to know for sure that this change is correct, but no tests seem to fail as a result of this change in local testing.
2019-10-16 12:49:49 +00:00
Guillaume Gomez
7d357fbffd update ui tests 2019-10-16 13:56:14 +02:00
Guillaume Gomez
e5d566c080 Add long error explanation for E0573 2019-10-16 13:56:14 +02:00
Mazdak Farrokhzad
be40bbd2fb make tidy happy 2019-10-16 11:19:39 +02:00
Mazdak Farrokhzad
904168fe14 mbe: leave a FIXME 2019-10-16 10:59:54 +02:00