| Age | Commit message (Collapse) | Author | Lines |
|
|
|
This will allow us to send it across threads and measure things like
LLVM time.
|
|
|
|
|
|
|
|
|
|
Fix rustc_driver swallowing errors when compilation is stopped
r? @oli-obk
|
|
|
|
|
|
Move privacy checking later in the pipeline and make some passes run in parallel
r? @michaelwoerister
|
|
This commit changes `syntax::fold::Folder` from a functional style
(where most methods take a `T` and produce a new `T`) to a more
imperative style (where most methods take and modify a `&mut T`), and
renames it `syntax::mut_visit::MutVisitor`.
The first benefit is speed. The functional style does not require any
reallocations, due to the use of `P::map` and
`MoveMap::move_{,flat_}map`. However, every field in the AST must be
overwritten; even those fields that are unchanged are overwritten with
the same value. This causes a lot of unnecessary memory writes. The
imperative style reduces instruction counts by 1--3% across a wide range
of workloads, particularly incremental workloads.
The second benefit is conciseness; the imperative style is usually more
concise. E.g. compare the old functional style:
```
fn fold_abc(&mut self, abc: ABC) {
ABC {
a: fold_a(abc.a),
b: fold_b(abc.b),
c: abc.c,
}
}
```
with the imperative style:
```
fn visit_abc(&mut self, ABC { a, b, c: _ }: &mut ABC) {
visit_a(a);
visit_b(b);
}
```
(The reductions get larger in more complex examples.)
Overall, the patch removes over 200 lines of code -- even though the new
code has more comments -- and a lot of the remaining lines have fewer
characters.
Some notes:
- The old style used methods called `fold_*`. The new style mostly uses
methods called `visit_*`, but there are a few methods that map a `T`
to something other than a `T`, which are called `flat_map_*` (`T` maps
to multiple `T`s) or `filter_map_*` (`T` maps to 0 or 1 `T`s).
- `move_map.rs`/`MoveMap`/`move_map`/`move_flat_map` are renamed
`map_in_place.rs`/`MapInPlace`/`map_in_place`/`flat_map_in_place` to
reflect their slightly changed signatures.
- Although this commit renames the `fold` module as `mut_visit`, it
keeps it in the `fold.rs` file, so as not to confuse git. The next
commit will rename the file.
|
|
|
|
|
|
|
|
|
|
Combine all builtin early lints
This also adds a -Z no-interleave-lints option to allow benchmarking lints.
r? @estebank
|
|
Also, add a testing infrastructure and tests that lets us dump layout.
|
|
|
|
Rollup of 10 pull requests
Successful merges:
- #57268 (Add a target option "merge-functions", and a corresponding -Z flag (works around #57356))
- #57476 (Move glob map use to query and get rid of CrateAnalysis)
- #57501 (High priority resolutions for associated variants)
- #57573 (Querify `entry_fn`)
- #57610 (Fix nested `?` matchers)
- #57634 (Remove an unused function argument)
- #57653 (Make the contribution doc reference the guide more)
- #57666 (Generalize `huge-enum.rs` test and expected stderr for more cross platform cases)
- #57698 (Fix typo bug in DepGraph::try_mark_green().)
- #57746 (Update README.md)
Failed merges:
r? @ghost
|
|
Querify `entry_fn`
Analogous to https://github.com/rust-lang/rust/pull/57570 but this will also require few fixups in Miri so I decided to separate that (and it seems [CI doesn't let us break tools anymore](https://github.com/rust-lang/rust/pull/57392#issuecomment-453801540)? Or was that because it was a rollup PR?)
r? @nikomatsakis
|
|
Make privacy checking, intrinsic checking and liveness checking incremental
Blocked on https://github.com/rust-lang/rust/pull/51487
r? @michaelwoerister
|
|
Add a -Z no-interleave-lints option to allow benchmarking lints
|
|
|
|
Always calculate glob map but only for glob uses
Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance.
Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand).
r? @nikomatsakis
Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
|
|
Implement basic input validation for built-in attributes
Correct top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is enforced for built-in attributes, built-in attributes must also fit into the "meta-item" syntax (aka the "classic attribute syntax").
For some subset of attributes (found by crater run), errors are lowered to deprecation warnings.
NOTE: This PR previously included https://github.com/rust-lang/rust/pull/57367 as well.
|
|
|
|
|
|
It shouldn't matter, but hey - better safe than sorry!
|
|
|
|
|
|
|
|
Previously calculating glob map was *opt-in*, however it did record
node id -> ident use for every use directive. This aims to see if we
can unconditionally calculate the glob map and not regress performance.
|
|
|
|
Make CompileController thread-safe
|
|
|
|
|
|
|
|
|
|
Add a command line flag to print some query stats
r? @michaelwoerister
|
|
Fix a number of uncovered deficiencies in diagnostics
|
|
|
|
|
|
Make the 'a lifetime on TyCtxt useless
cc @rust-lang/compiler
r? @nikomatsakis
|
|
Remove lifetime from Resolver
|
|
|
|
Returning an iterator leads to nicer code all around.
|
|
|
|
|
|
Use a function to access the Hir map to be able to turn it into a query later
r? @eddyb
|
|
attributes
|