| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Same idea for `Unsafety` & use new span for better diagnostics.
|
|
|
|
|
|
traits: preallocate 2 Vecs of known initial size
The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.
In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.
|
|
|
|
Improve performance of coherence checks
The biggest perf improvement in here is expected to come from the removal of the remaining #43355 warning code since that effectively runs the expensive parts of coherence *twice*, which can even be visualized by obtaining a flamegraph:

|
|
Reduce the number of `RefCell`s in `InferCtxt`.
`InferCtxt` contains six structures within `RefCell`s. Every time we
create and dispose of (commit or rollback) a snapshot we have to
`borrow_mut` each one of them.
This commit moves the six structures under a single `RefCell`, which
gives significant speed-ups by reducing the number of `borrow_mut`
calls. To avoid runtime errors I had to reduce the lifetimes of dynamic
borrows in a couple of places.
r? @varkor
|
|
This was previously a future-compat warning that has since been turned into
hard error, but without actually removing all the code.
Avoids a call to `traits::overlapping_impls`, which is expensive.
|
|
`InferCtxt` contains six structures within `RefCell`s. Every time we
create and dispose of (commit or rollback) a snapshot we have to
`borrow_mut` each one of them.
This commit moves the six structures under a single `RefCell`, which
gives significant speed-ups by reducing the number of `borrow_mut`
calls. To avoid runtime errors I had to reduce the lifetimes of dynamic
borrows in a couple of places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Don't discard marker trait impls when inference variables are present
Fixes #61651
Previously, we would unconditionally discard impl candidates for marker
traits during trait selection. However, if the predicate had inference
variables, this could have the effect of constrainting inference
variables (due to a successful trait selection) when we would have
otherwise failed due to mutliple applicable impls,
This commit prevents marker trait impls from being discarded while the
obligation predicate has any inference variables, ensuring that
discarding impls will never cause us to incorrectly constraint inference
variables.
|
|
The condition
if obligation.recursion_depth >= 0
is always true since recursion_depth is usize.
The else branch is dead code and can be removed.
Found by Clippy.
Fixes #68251
|
|
Promote references to constants instead of statics
r? @oli-obk
|
|
|
|
|
|
Fixes #61651
Previously, we would unconditionally discard impl candidates for marker
traits during trait selection. However, if the predicate had inference
variables, this could have the effect of constrainting inference
variables (due to a successful trait selection) when we would have
otherwise failed due to mutliple applicable impls,
This commit prevents marker trait impls from being discarded while the
obligation predicate has any inference variables, ensuring that
discarding impls will never cause us to incorrectly constraint inference
variables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Add simpler entry points to const eval for common usages.
I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways:
- Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc.
- Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants.
- Evaluates a promoted constant.
This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval`
is normally used.
|
|
|
|
2. mir::Mutability -> ast::Mutability.
|
|
|
|
|
|
fix clippy
allow customising ty::TraitRef's printing behavior
fix clippy
stylistic fix
|
|
|
|
|
|
|
|
|
|
|
|
|
|
These are a squashed series of commits.
|
|
It's the same as `InferCtxt::commit_unconditionally()` except that it
is passed a snapshot and has a worse name.
The commit also changes `commit_unconditionally()` to receive a
snapshot, for consistency with `commit_if_ok()` and `probe()`.
|
|
|
|
Replace ClosureSubsts with SubstsRef
Addresses https://github.com/rust-lang/rust/issues/42340 part 3
https://github.com/rust-lang/rust/pull/59312 might benefit from this clean up.
r? @nikomatsakis
|