Commit Graph

100 Commits

Author SHA1 Message Date
Yuri Astrakhan cbe4379412 Spellchecking some comments
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30 01:39:38 -04:00
Michael Woerister 3d5df6b2ad incr. comp.: Let compiler retry finalizing session directory a few times.
See https://github.com/rust-lang/rust/issues/86929.
2022-03-25 14:14:26 +01:00
mark 81fb877785 rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
2022-03-16 10:35:24 -05:00
cuishuang 189a5418ca all: fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-03 19:47:23 +08:00
mark 829ef433ce rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
Mark Rousskov 1be1cee840 Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
est31 3ceec03f0f Adopt let else in more places 2022-02-19 17:27:43 +01:00
lcnr 2b315440d3 add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
Nicholas Nethercote 0eaf0ba783 Make Decodable and Decoder infallible.
`Decoder` has two impls:
- opaque: this impl is already partly infallible, i.e. in some places it
  currently panics on failure (e.g. if the input is too short, or on a
  bad `Result` discriminant), and in some places it returns an error
  (e.g. on a bad `Option` discriminant). The number of places where
  either happens is surprisingly small, just because the binary
  representation has very little redundancy and a lot of input reading
  can occur even on malformed data.
- json: this impl is fully fallible, but it's only used (a) for the
  `.rlink` file production, and there's a `FIXME` comment suggesting it
  should change to a binary format, and (b) in a few tests in
  non-fundamental ways. Indeed #85993 is open to remove it entirely.

And the top-level places in the compiler that call into decoding just
abort on error anyway. So the fallibility is providing little value, and
getting rid of it leads to some non-trivial performance improvements.

Much of this commit is pretty boring and mechanical. Some notes about
a few interesting parts:
- The commit removes `Decoder::{Error,error}`.
- `InternIteratorElement::intern_with`: the impl for `T` now has the same
  optimization for small counts that the impl for `Result<T, E>` has,
  because it's now much hotter.
- Decodable impls for SmallVec, LinkedList, VecDeque now all use
  `collect`, which is nice; the one for `Vec` uses unsafe code, because
  that gave better perf on some benchmarks.
2022-01-22 10:38:31 +11:00
bors 2074d1d6d3 Auto merge of #92896 - lqd:update-deps, r=Mark-Simulacrum
Update some rustc dependencies to deduplicate them

This PR updates `rand` and `itertools` in rustc (not the whole workspace) in order to deduplicate them (and hopefully slightly improve compile times).

~~Currently, `object` is still duplicated, but https://github.com/rust-lang/thorin/pull/15 and updating `thorin` in the future will remove the use of version 0.27.~~  Update: Thorin 0.2 has now been released, and this PR updates `rustc_codegen_ssa` to use it and deduplicate the `object` crate.

There's a final tiny rustc dependency, `cfg-if`, which will be left: as both versions 0.1.x and 1.0 looked to be heavily depended on, they will require a few cascading updates to be removed.
2022-01-21 10:38:30 +00:00
Matthias Krüger 1eee2ee85e Rollup merge of #92825 - pierwill:rustc-version-force-rename, r=Mark-Simulacrum
Rename environment variable for overriding rustc version
2022-01-17 20:07:06 +01:00
Cameron Steffen d09a12259a Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00
Camille GILLOT 2264c06b99 Reduce use of local_def_id_to_hir_id. 2022-01-15 21:26:25 +01:00
Rémy Rakic 5ce09bdfca Update rand to deduplicate it 2022-01-14 13:05:27 +01:00
pierwill 724cba571f Rename environment variable for overriding rustc version 2022-01-12 15:31:26 -06:00
Lucas Kent 38df6b3ec5 eplace usages of vec![].into_iter with [].into_iter 2022-01-09 14:09:25 +11:00
Aaron Hill be762fa8f4 Add #[rustc_clean(loaded_from_disk)] to assert loading of query result
Currently, you can use `#[rustc_clean]` to assert to that a particular
query (technically, a `DepNode`) is green or red. However, a green
`DepNode` does not mean that the query result was actually deserialized
from disk - we might have never re-run a query that needed the result.

Some incremental tests are written as regression tests for ICEs that
occured during query result decoding. Using
`#[rustc_clean(loaded_from_disk="typeck")]`, you can now assert
that the result of a particular query (e.g. `typeck`) was actually
loaded from disk, in addition to being green.
2021-12-21 16:34:12 -05:00
bors b5f08995cd Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
2021-12-19 09:31:37 +00:00
Nicholas Nethercote 41c6543547 Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
Peter Jaszkowiak 437afc105d Remove in_band_lifetimes from rustc_incremental 2021-12-13 21:52:01 -07:00
Matthias Krüger 821e22edc0 Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
Remove redundant [..]s
2021-12-10 22:40:36 +01:00
est31 00030d4c76 Remove redundant [..]s 2021-12-09 00:01:29 +01:00
pierwill 94f2acfba9 Document all public items in rustc_incremental
Also:

- Review and edit current docs
- Enforce documentation for crate

Co-authored-by: r00ster <r00ster91@protonmail.com>
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2021-12-07 10:10:52 -06:00
pierwill 62b155ccaf Add -Zassert-incr-state to assert state of incremental cache 2021-11-12 13:41:46 -06:00
pierwill 1994a4f7b3 Remove rustc_incremental::persist::fs::dep_graph_path_from 2021-11-09 10:58:11 -06:00
Mark Rousskov ed9ff1b8fc Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
Matthias Krüger 290dc3fea6 Rollup merge of #89558 - lcnr:query-stable-lint, r=estebank
Add rustc lint, warning when iterating over hashmaps

r? rust-lang/wg-incr-comp
2021-10-24 15:48:42 +02:00
Camille GILLOT 0d1cc9b0ff Merge two query callbacks arrays. 2021-10-20 18:29:27 +02:00
Yuki Okushi f76accb49c Rollup merge of #87404 - rylev:artifact-size-profiling, r=wesleywiser
Add support for artifact size profiling

This adds support for profiling artifact file sizes (incremental compilation artifacts and query cache to begin with).

Eventually we want to track this in perf.rlo so we can ensure that file sizes do not change dramatically on each pull request.

This relies on support in measureme: https://github.com/rust-lang/measureme/pull/169. Once that lands we can update this PR to not point to a git dependency.

This was worked on together with `@michaelwoerister.`

r? `@wesleywiser`
2021-10-20 04:35:11 +09:00
est31 20353504e9 Adopt let_else across the compiler
This performs a substitution of code following the pattern:

let <id> = if let <pat> = ... { identity } else { ... : ! };

To simplify it to:

let <pat> = ... { identity } else { ... : ! };

By adopting the let_else feature.
2021-10-16 07:18:05 +02:00
lcnr a55adf3606 allow potential_query_instability everywhere 2021-10-15 10:58:18 +02:00
Ryan Levick 4e39df29eb Add support for artifact size profiling 2021-10-07 14:22:29 +02:00
Camille GILLOT c0b0a839bd Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
Mark Rousskov f5a19f35c1 Migrate to 2021 2021-09-20 22:21:42 -04:00
bors d1e3687e82 Auto merge of #83214 - cjgillot:dep-map, r=michaelwoerister
Mmap the incremental data instead of reading it.

Instead of reading the full incremental state using `fs::read_file`, we memmap it using a private read-only file-backed map.
This allows the system to reclaim any memory we are not using, while ensuring we are not polluted by
outside modifications to the file.

Suggested in https://github.com/rust-lang/rust/pull/83036#issuecomment-800458082 by `@bjorn3`
2021-09-06 23:58:16 +00:00
Camille GILLOT 81c07a9d16 Stop using walk_crate. 2021-09-02 19:08:58 +02:00
Camille GILLOT 74d074dbf8 Drop the query result memmap before serializing it back. 2021-08-28 21:45:02 +02:00
Camille GILLOT c8f0814189 Move save_in to file_format. 2021-08-28 21:45:02 +02:00
Camille GILLOT a2021ae554 Mmap the incremental data instead of reading it. 2021-08-28 21:45:02 +02:00
Aaron Hill dce938053a Remove Session.used_attrs and move logic to CheckAttrVisitor
Instead of updating global state to mark attributes as used,
we now explicitly emit a warning when an attribute is used in
an unsupported position. As a side effect, we are to emit more
detailed warning messages (instead of just a generic "unused" message).

`Session.check_name` is removed, since its only purpose was to mark
the attribute as used. All of the callers are modified to use
`Attribute.has_name`

Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed
used' attribute is implemented by simply not performing any checks
in `CheckAttrVisitor` for a particular attribute.

We no longer emit unused attribute warnings for the `#[rustc_dummy]`
attribute - it's an internal attribute used for tests, so it doesn't
mark sense to treat it as 'unused'.

With this commit, a large source of global untracked state is removed.
2021-08-21 13:27:27 -05:00
Jade c72215df19 rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
Camille GILLOT a83bccd1d8 Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
bjorn3 c60f8ae39b Revert "Revert "Merge CrateDisambiguator into StableCrateId""
This reverts commit cb1684fc9c.
2021-07-06 11:28:04 +02:00
Camille GILLOT 7a8bd59724 Simplify DepGraph creation. 2021-06-30 20:31:52 +02:00
Camille GILLOT ca9f92cefb Do not require the DefPathTable to construct the on-disk cache. 2021-06-08 22:23:03 +02:00
bjorn3 cb1684fc9c Revert "Merge CrateDisambiguator into StableCrateId"
This reverts commit 07d4b7f1e9.
2021-06-07 10:37:45 +02:00
bors fe5429ca30 Auto merge of #85337 - cjgillot:less-anon, r=michaelwoerister
Avoid creating anonymous nodes with zero or one dependency.

Anonymous nodes are only useful to encode dependencies, and cannot be replayed from one compilation session to another.
As such, anonymous nodes without dependency are always green.
Anonymous nodes with only one dependency are equivalent to this dependency.

cc #45408
cc `@michaelwoerister`
2021-06-02 13:11:41 +00:00
bors 630724f374 Auto merge of #85331 - cjgillot:dirty-dancing, r=Aaron1011
Make rustc_dirty/clean annotations exhaustive by default

Fixes #45009
2021-06-01 23:02:52 +00:00
Camille GILLOT 900924e40c Avoid creating anonymous nodes with zero or one dependency. 2021-06-01 21:43:30 +02:00
bjorn3 07d4b7f1e9 Merge CrateDisambiguator into StableCrateId 2021-05-30 12:51:34 +02:00