| Age | Commit message (Collapse) | Author | Lines |
|
querying it
|
|
Rename `impl_constness` to `constness`
The current code is a basis for `is_const_fn_raw`, and `impl_constness`
is no longer a valid name, which is previously used for determining the
constness of impls, and not items in general.
r? `@oli-obk`
|
|
Split up `Definitions` and `ResolverAstLowering`.
Split off https://github.com/rust-lang/rust/pull/95573
r? `@michaelwoerister`
|
|
This simplifies things, but requires making `CacheEncoder` non-generic.
(This was previously merged as commit 4 in #94732 and then was reverted
in #97905 because it caused a perf regression.)
|
|
The current code is a basis for `is_const_fn_raw`, and `impl_constness`
is no longer a valid name, which is previously used for determining the
constness of impls, and not items in general.
|
|
Make `ExprKind::Closure` a struct variant.
Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`.
r? ``@Aaron1011``
|
|
|
|
This avoids the name clash with `rustc_serialize::Encoder` (a trait),
and allows lots qualifiers to be removed and imports to be simplified
(e.g. fewer `as` imports).
(This was previously merged as commit 5 in #94732 and then was reverted
in #97905 because of a perf regression caused by commit 4 in #94732.)
|
|
|
|
Handle `def_ident_span` like `def_span`.
`def_ident_span` had an ad-hoc status in the compiler.
This PR refactors it to be a first-class citizen like `def_span`:
- it gets encoded in the main metadata loop, instead of the visitor;
- its implementation is updated to mirror the one of `def_span`.
We do not remove the `Option` in the return type, since some items do not have an ident, AnonConsts for instance.
|
|
Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no`
The test relies on `library/std/src/error.rs` not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this PR adds a new `-Z` flag to disable finding the corresponding local path of a remapped path.
|
|
Revert part of #94372 to improve performance
#94732 was supposed to give small but widespread performance improvements, as judged from three per-merge performance runs. But the performance run that occurred after merging included a roughly equal number of improvements and regressions, for unclear reasons.
This PR is for a test run reverting those changes, to see what happens.
r? `@ghost`
|
|
|
|
|
|
|
|
|
|
|
|
This avoids the name clash with `rustc_serialize::Encoder` (a trait),
and allows lots qualifiers to be removed and imports to be simplified
(e.g. fewer `as` imports).
|
|
This simplifies things, but requires making `CacheEncoder` non-generic.
|
|
There are two impls of the `Encoder` trait: `opaque::Encoder` and
`opaque::FileEncoder`. The former encodes into memory and is infallible, the
latter writes to file and is fallible.
Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a
bit verbose and has non-trivial cost, which is annoying given how rare failures
are (especially in the infallible `opaque::Encoder` case).
This commit changes how `Encoder` fallibility is handled. All the `emit_*`
methods are now infallible. `opaque::Encoder` requires no great changes for
this. `opaque::FileEncoder` now implements a delayed error handling strategy.
If a failure occurs, it records this via the `res` field, and all subsequent
encoding operations are skipped if `res` indicates an error has occurred. Once
encoding is complete, the new `finish` method is called, which returns a
`Result`. In other words, there is now a single `Result`-producing method
instead of many of them.
This has very little effect on how any file errors are reported if
`opaque::FileEncoder` has any failures.
Much of this commit is boring mechanical changes, removing `Result` return
values and `?` or `unwrap` from expressions. The more interesting parts are as
follows.
- serialize.rs: The `Encoder` trait gains an `Ok` associated type. The
`into_inner` method is changed into `finish`, which returns
`Result<Vec<u8>, !>`.
- opaque.rs: The `FileEncoder` adopts the delayed error handling
strategy. Its `Ok` type is a `usize`, returning the number of bytes
written, replacing previous uses of `FileEncoder::position`.
- Various methods that take an encoder now consume it, rather than being
passed a mutable reference, e.g. `serialize_query_result_cache`.
|
|
It's not necessary.
|
|
The test relies on library/std/src/error.rs not corresponding to a local
path, but remapping might still find the related local file of a
remapped path. To fix the test, this adds a new -Z flag to disable
finding the corresponding local path of a remapped path.
|
|
|
|
It doesn't do anything for all encoders
|
|
Replace `#[default_method_body_is_const]` with `#[const_trait]`
pulled out of #96077
related issues: #67792 and #92158
cc `@fee1-dead`
This is groundwork to only allowing `impl const Trait` for traits that are marked with `#[const_trait]`. This is necessary to prevent adding a new default method from becoming a breaking change (as it could be a non-const fn).
|
|
be treated as `const`
|
|
|
|
rustc_type_ir
|
|
|
|
|
|
Proc macro tweaks
Various improvements I spotted while looking through the proc macro code.
r? `@eddyb`
|
|
So it matches the existing `AttrProcMacro` and `BangProcMacro` types.
|
|
libcore: Add `iter::from_generator` which is like `iter::from_fn`, but for coroutines instead of functions
An equally useful little helper.
I didn't follow any of the async-wg work, so I don't know why something like this wasn't added before.
|
|
coroutines instead of functions
|
|
Optimize position adjustments
A small improvement.
r? `@bjorn3`
|
|
`imported_source_files` adjusts lots of file positions, and then calls
`new_imported_source_file`, which then adjust them all again. This
commit combines the two adjustments into one, for a small perf win.
|
|
rustc: Fix ICE in native library error reporting
Fixes https://github.com/rust-lang/rust/issues/97299
|
|
Fix metadata stats.
This commit:
- Counts some things that weren't being counted previously, and adds
an assertion that ensure everything is counted.
- Reorders things so the `eprintln`s order matches the code order.
- Adds percentages, and makes clear that the zero bytes count is orthogonal to
the other measurements.
Example of the new output:
```
55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero
preamble: 30 bytes ( 0.0%)
dep: 0 bytes ( 0.0%)
lib feature: 17458 bytes ( 0.0%)
lang item: 337 bytes ( 0.0%)
diagnostic item: 1788 bytes ( 0.0%)
native lib: 0 bytes ( 0.0%)
foreign modules: 5113 bytes ( 0.0%)
def-path table: 720180 bytes ( 1.3%)
traits: 359 bytes ( 0.0%)
impls: 64624 bytes ( 0.1%)
incoherent_impls: 130 bytes ( 0.0%)
mir: 16137354 bytes (29.1%)
item: 23773099 bytes (42.9%)
interpret_alloc_index: 599 bytes ( 0.0%)
proc-macro-data: 0 bytes ( 0.0%)
tables: 10081135 bytes (18.2%)
debugger visualizers: 0 bytes ( 0.0%)
exported symbols: 5666 bytes ( 0.0%)
hygiene: 1539390 bytes ( 2.8%)
def-path hashes: 2752564 bytes ( 5.0%)
source_map: 363540 bytes ( 0.7%)
final: 413 bytes ( 0.0%)
```
r? `@bjorn3`
|
|
This commit:
- Counts some things that weren't being counted previously, and adds
an assertion that ensure everything is counted.
- Reorders things so the `eprintln`s order matches the code order.
- Adds percentages, and makes clear that the zero bytes count is orthogonal to
the other measurements.
Example of the new output:
```
55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero
preamble: 30 bytes ( 0.0%)
dep: 0 bytes ( 0.0%)
lib feature: 17458 bytes ( 0.0%)
lang item: 337 bytes ( 0.0%)
diagnostic item: 1788 bytes ( 0.0%)
native lib: 0 bytes ( 0.0%)
foreign modules: 5113 bytes ( 0.0%)
def-path table: 720180 bytes ( 1.3%)
traits: 359 bytes ( 0.0%)
impls: 64624 bytes ( 0.1%)
incoherent_impls: 130 bytes ( 0.0%)
mir: 16137354 bytes (29.1%)
item: 23773099 bytes (42.9%)
interpret_alloc_index: 599 bytes ( 0.0%)
proc-macro-data: 0 bytes ( 0.0%)
tables: 10081135 bytes (18.2%)
debugger visualizers: 0 bytes ( 0.0%)
exported symbols: 5666 bytes ( 0.0%)
hygiene: 1539390 bytes ( 2.8%)
def-path hashes: 2752564 bytes ( 5.0%)
source_map: 363540 bytes ( 0.7%)
final: 413 bytes ( 0.0%)
```
|
|
|
|
|
|
|
|
|
|
|
|
Remove `crate` visibility modifier
FCP to remove this syntax is just about complete in #53120. Once it completes, this should be merged ASAP to avoid merge conflicts.
The first two commits remove usage of the feature in this repository, while the last removes the feature itself.
|
|
|
|
Cache more queries on disk
One of the principles of incremental compilation is to allow saving results on disk to avoid recomputing them.
This PR investigates persisting a lot of queries whose result are to be saved into metadata.
Some of the queries are cheap reads from HIR, but we may also want to get rid of these reads for incremental lowering.
|
|
`simplify_type` improvements and cursed docs
the existing `TreatParams` enum pretty much mixes everything up. Not sure why this looked right to me in #94057
This also includes two changes which impact perf:
- `ty::Projection` with inference vars shouldn't be treated as a rigid type, even if fully normalized
- `ty::Placeholder` only unifies with itself, so actually return `Some` for them
r? `@nikomatsakis`
|
|
|
|
|