| Age | Commit message (Collapse) | Author | Lines |
|
Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`
Requested by `@fmease` in https://github.com/rust-lang/rust/pull/118226#pullrequestreview-1747432292.
There is also a much larger number of `option.map_or(false, cond)` that can be changed separately if someone wants.
r? fmease
|
|
Validate there are no critical call edges in optimized MIR
|
|
Minor `rustc_mir_dataflow` cleanups
r? `@cjgillot`
|
|
Make PlaceholderReplacer shallow_resolver and recur when infer vars
This makes resolve type and const infer vars resolve.
Given:
```rust
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
struct Foo<T>(T);
impl<'a> Foo<fn(&'a ())> {
type Assoc = &'a ();
}
fn bar(_: for<'a> fn(Foo<fn(Foo<fn(&'static ())>::Assoc)>::Assoc)) {}
fn main() {}
```
We should normalize `for<'a> fn(Foo<fn(Foo<fn(&'static ())>::Assoc)>::Assoc)` to `for<'0> fn(&'1 ())` with `'1 == '0` and `'0 == 'static` constraints. We have to resolve `'1` to `'static` in the infcx associated to `PlaceholderReplacer`.
This is part of https://github.com/rust-lang/rust/pull/118118 but unrelated to that PR.
r? `@compiler-errors` `@lcnr`
|
|
|
|
Optimize QueryArena allocation
This shifts the WorkerLocal wrapper to be outside the QueryArena, meaning that instead of having each query allocate distinct arenas per-worker we allocate the full set of arenas per-worker. This is primarily a code size optimization (locally, ~85 kilobytes, [perf is reporting >100 kilobytes](https://perf.rust-lang.org/compare.html?start=1fd418f92ed13db88a21865ba5d909abcf16b6cc&end=884c95a3f1fe8d28630ec3cdb0c8f95b2e539fde&stat=instructions%3Au&tab=artifact-size)), saving a bunch of code in the initialization of the arenas which was previously duplicated lots of times (per arena type).
Additionally this tells LLVM that the thread count can't be zero in this code (I believe this is true?) which shaves some small amount of bytes off as well since we eliminate checks for zero in the vec allocations.
|
|
This explains why we don't have to worry about bcb0 having multiple in-edges.
|
|
`BcbBranch` represented an out-edge of a coverage graph node, but would
silently refer to a node instead in cases where that node only had one in-edge.
Instead we now refer to a graph edge as a `(from_bcb, to_bcb)` pair, or
sometimes as just one of those nodes when the other node is implied by the
surrounding context. The case of sole in-edges is handled by special code added
directly to `get_or_make_edge_counter_operand`.
|
|
This was previously a helper method in `MakeBcbCounters`, but putting it in the
graph lets us call it from `BcbBranch`, and gives us a more fine-grained
borrow.
|
|
In some cases we need to prepare a coverage expression that is the sum of an
arbitrary number of other terms. This patch simplifies the code paths that
build those sums.
This causes some churn in the mappings, because the previous code was building
its sums in a somewhat idiosyncratic order.
|
|
This means that we no longer have to manage the distinction between
`BcbCounter` and `CovTerm` when preparing expressions.
|
|
Now that this code path unconditionally calls `make_branch_counters`, we might
as well make that method responsible for creating the node's counter as well,
since it needs the resulting term anyway.
|
|
This lets us avoid creating two copies of the node's branch list.
|
|
|
|
|
|
And move declarative macro compilation to an earlier point in def collector, which is required for #118188.
|
|
|
|
|
|
|
|
Separate items that are exposed in the `stable_mir` crate to be used
by the compiler from items that we expect to be used by tool developers.
|
|
Fixes error count display is different when there's only one error left
Supersedes #114759
### What did I do?
I did the small change in `rustc_errors` by hand. Then I did the other changes in `/compiler` by hand, those were just find replace on `*.rs` in the workspace. The changes in run-make are find replace for `run-make` in the workspace.
All other changes are blessed using `x test TEST --bless`. I blessed the tests that were blessed in #114759.
### how to review this nightmare
ping bors with an `r+`. You should check that my logic is sound and maybe quickly scroll through the diff, but fully verifying it seems fairly hard to impossible. I did my best to do this correctly.
Thank you `@adrianEffe` for bringing this up and your initial implementation.
cc `@flip1995,` you said you want to do a subtree sync asap
cc `@RalfJung` maybe you want to do a quick subtree sync afterwards as well for Miri
r? `@WaffleLapkin`
|
|
This file was getting too big and causing a lot of merge conflicts. All
these changes shouldn't be visible to users since this module is private.
|
|
Binder<TraitRef>
|
|
recur if contain infer vars
|
|
|
|
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
|
|
Rollup of 7 pull requests
Successful merges:
- #118187 (Recompile LLVM when it changes in the git sources)
- #118210 (intercrate ambiguity causes: ignore candidates which don't apply)
- #118215 (Add common trait for crate definitions)
- #118238 (memcpy assumptions: update GCC link)
- #118243 (EvalCtxt::commit_if_ok don't inherit nested goals)
- #118245 (Add `Span` to `TraitBoundModifier`)
- #118246 (Remove a hack for effects)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Remove a hack for effects
Fallback was implemented in #115727, which addresses the inference errors mentioned in the comments.
|
|
Add `Span` to `TraitBoundModifier`
This improves diagnostics for the message "`~const` is not allowed here", and also fixes the span that we use when desugaring `~const Tr` into `Tr<host>` in effects desugaring.
|
|
EvalCtxt::commit_if_ok don't inherit nested goals
we use it to check whether an alias is rigid, so we want to avoid considering an alias rigid simply because the inference constraints from normalizing it caused another nested goal fail
r? `@compiler-errors`
|
|
Add common trait for crate definitions
In stable mir, we specialize DefId, however some functionality is the same for every definition, such as def paths, and getting their crate. Use a trait to implement those.
|
|
r=compiler-errors
intercrate ambiguity causes: ignore candidates which don't apply
r? `@compiler-errors`
|
|
feat: make `let_binding_suggestion` more reasonable
This is my first PR for rustc, which trying to fix https://github.com/rust-lang/rust/issues/117894, I am not familiar with some internal api so maybe some modification here isn't the way to go, appreciated for any review suggestion.
|
|
|
|
|
|
|
|
Cache flags for `ty::Const`
Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in `rustc_type_ir`, since we can assume that consts have a `flags` method that is no-cost.
r? `@ghost`
|
|
We can just call `ResultsCursor::state` and `ResultsCursor::analysis`
separately.
|
|
`mut_results` immediately below is the `&mut self` version, this one
should be `&self`.
|
|
This cuts librustc_driver.so code size by ~85 kilobytes.
|
|
This allows avoiding some if != 0 checks when allocating worker-local
datasets.
|
|
|
|
|
|
|
|
There were three issues previously:
* The self argument was pinned, despite Iterator::next taking an
unpinned mutable reference.
* A resume argument was passed, despite Iterator::next not having one.
* The return value was CoroutineState<Item, ()> rather than Option<Item>
While these things just so happened to work with the LLVM backend,
cg_clif does much stricter checks when trying to assign a value to a
place. In addition it can't handle the mismatch between the amount of
arguments specified by the FnAbi and the FnSig.
|
|
`on_all_children_bits` has two arguments that are unused: `tcx` and
`body`. This was not detected by the compiler because it's a recursive
function.
This commit removes them, and removes lots of other arguments and fields
that are no longer necessary.
|
|
|
|
|
|
In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md).
Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530.
|