bors
6c02dd4eae
Auto merge of #144446 - nnethercote:opt-region-constraints, r=lcnr
...
Optimize region constraints
r? `@lcnr`
2025-08-01 04:06:21 +00:00
Nicholas Nethercote
066a973312
Overhaul Constraint.
...
This commit changes it to store a `Region` instead of a `RegionVid` for the `Var` cases:
- We avoid having to call `Region::new_var` to re-create `Region`s from
`RegionVid`s in a few places, avoiding the interning process, giving a
small perf win. (At the cost of the type allowing some invalid
combinations of values.)
- All the cases now store two `Region`s, so the commit also separates
the `ConstraintKind` (a new type) from the `sub` and `sup` arguments
in `Constraint`.
2025-07-31 20:04:51 +10:00
Nicholas Nethercote
75a1f47750
Avoid vacuous Constraint::{VarSubVar,RegSubReg} constraints.
...
If the two regions are the same, we can skip it. This is a small perf win.
2025-07-31 20:04:51 +10:00
Stuart Cook
017586c93a
Rollup merge of #144713 - nnethercote:rustc_middle-ty-cleanups, r=lcnr
...
`rustc_middle::ty` cleanups
r? `@davidtwco`
2025-07-31 18:52:11 +10:00
Nicholas Nethercote
a949c47f0d
Remove ParamEnvAnd::into_parts.
...
The fields are public, so this doesn't need a method, normal
deconstruction and/or field access is good enough.
2025-07-31 15:17:20 +10:00
Nicholas Nethercote
c4e3cc0228
Move TermVid out of rustc_middle.
...
It's only used in `rustc_infer`.
2025-07-31 15:17:08 +10:00
lcnr
b6cbe33aeb
handle region dependent goals due to infer vars
2025-07-30 14:01:37 +02:00
lcnr
0b323eacd4
uniquify root goals during HIR typeck
2025-07-25 12:40:01 +00:00
Michael Goulet
3634f46fdb
Add alias for ArgOutlivesPredicate
2025-07-15 16:02:26 +00:00
Michael Goulet
512cf3ae88
Gate things properly
2025-07-15 16:02:26 +00:00
Michael Goulet
e3f643c706
Consider outlives assumptions when proving auto traits for coroutine interiors
2025-07-15 16:02:26 +00:00
Michael Goulet
f6f2f83043
Simplify make_query_region_constraints
2025-07-13 19:22:17 +00:00
Michael Goulet
c2c9aad3f6
Make sure that users don't take region obligations in a snapshot
2025-07-13 19:22:17 +00:00
Yotam Ofek
3b48407f93
Remove unused allow attrs
2025-07-07 12:58:16 +00:00
Michael Goulet
d79b669b09
Fix pretty printing of placeholder types
2025-07-04 18:26:09 +00:00
Josh Stone
e851e3e16e
Update cfg(bootstrap)
2025-07-01 10:55:49 -07:00
Michael Goulet
ed16ae851b
Do not freshen ReError
2025-06-28 20:48:58 +00:00
bors
df32e15c56
Auto merge of #142223 - compiler-errors:perf-wf, r=lcnr
...
Fast path for WF goals in new solver
Hopefully self-explanatory.
2025-06-27 03:57:45 +00:00
bors
e61dd437f3
Auto merge of #143074 - compiler-errors:rollup-cv64hdh, r=compiler-errors
...
Rollup of 18 pull requests
Successful merges:
- rust-lang/rust#137843 (make RefCell unstably const)
- rust-lang/rust#140942 (const-eval: allow constants to refer to mutable/external memory, but reject such constants as patterns)
- rust-lang/rust#142549 (small iter.intersperse.fold() optimization)
- rust-lang/rust#142637 (Remove some glob imports from the type system)
- rust-lang/rust#142647 ([perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation)
- rust-lang/rust#142700 (Remove incorrect comments in `Weak`)
- rust-lang/rust#142927 (Add note to `find_const_ty_from_env`)
- rust-lang/rust#142967 (Fix RwLock::try_write documentation for WouldBlock condition)
- rust-lang/rust#142986 (Port `#[export_name]` to the new attribute parsing infrastructure)
- rust-lang/rust#143001 (Rename run always )
- rust-lang/rust#143010 (Update `browser-ui-test` version to `0.20.7`)
- rust-lang/rust#143015 (Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`)
- rust-lang/rust#143033 (Expand const-stabilized API links in relnotes)
- rust-lang/rust#143041 (Remove cache for citool)
- rust-lang/rust#143056 (Move an ACE test out of the GCI directory)
- rust-lang/rust#143059 (Fix 1.88 relnotes)
- rust-lang/rust#143067 (Tracking issue number for `iter_macro`)
- rust-lang/rust#143073 (Fix some fixmes that were waiting for let chains)
Failed merges:
- rust-lang/rust#143020 (codegen_fn_attrs: make comment more precise)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-27 00:44:20 +00:00
Michael Goulet
25e239c193
Rollup merge of #142647 - compiler-errors:less-work-in-coherence, r=lcnr
...
[perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation
First compute hard errors without diagnostics, then ambiguities with diagnostics since we need to know if any of them overflowed.
2025-06-26 20:15:20 -04:00
Michael Goulet
59e1a3cbf5
Simplify IfCause
2025-06-26 03:43:01 +00:00
Michael Goulet
c995070b6a
rename RegionVariableOrigin::MiscVariable to RegionVariableOrigin::Misc
2025-06-25 15:35:18 +00:00
Michael Goulet
44254c8cd7
Remove some glob imports from the type system
2025-06-25 15:35:16 +00:00
Michael Goulet
8304435793
Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation
2025-06-25 15:32:08 +00:00
Michael Goulet
b8ef88517d
Introduce trivial WF functions, use it in fast path
2025-06-24 01:42:28 +00:00
Michael Goulet
04a2eec304
Cache instantiation of canonical binder
2025-06-19 04:23:25 +00:00
Romain Perier
a1a3bef6f0
Implement lint against direct uses of rustc_type_ir in compiler crates
...
This commit adds a lint to prevent the use of rustc_type_ir in random
compiler crates, except for type system internals traits, which are
explicitly allowed. Moreover, this fixes diagnostic_items() to include
the CRATE_OWNER_ID, otherwise rustc_diagnostic_item attribute is ignored
on the crate root.
2025-06-18 16:01:41 +02:00
bors
bdb04d6c4f
Auto merge of #141763 - lcnr:fixme-gamer, r=BoxyUwU
...
`FIXME(-Znext-solver)` triage
r? `@BoxyUwU`
2025-06-11 11:47:05 +00:00
bors
2b0274c71d
Auto merge of #142090 - compiler-errors:perf-stable-root-var, r=lcnr
...
Make root vars more stable
Never resolve a ty/ct vid to a higher vid as its root. This should make the optimization in rust-lang/rust#141500 more "stable" when there are a lot of vars flying around.
r? `@ghost`
2025-06-11 03:34:30 +00:00
bjorn3
9223704f4b
Remove all unused feature gates from the compiler
2025-06-08 14:50:42 +00:00
Guillaume Gomez
7c3cb5688d
Rollup merge of #142126 - compiler-errors:normalize-uv-via-relate, r=BoxyUwU
...
Treat normalizing consts like normalizing types in deeply normalize
...so that we don't end up putting a top-level normalizes-to goal in the fulfillment context, which ICEs. This basically just models the normalize-const code off of the normalize-ty code above it, which uses an alias-relate goal instead.
Fixes rust-lang/rust#140571
r? lcnr
2025-06-07 22:22:58 +02:00
Michael Goulet
aa1b296dd6
Unify normalization of terms in deeply normalize
2025-06-07 02:35:28 +00:00
Michael Goulet
e1567dff24
Make root vars more stable
2025-06-05 17:02:51 +00:00
lcnr
7dac755be8
FIXME(-Znext-solver) triage
...
Co-authored-by: Michael Goulet <michael@errs.io >
2025-06-03 14:23:56 +02:00
Michael Goulet
3418d5db3a
Fast path for stalled obligations on self ty
2025-06-02 19:23:20 +00:00
bors
5f025f363d
Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errors
...
add additional `TypeFlags` fast paths
Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial.
This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s.
Split out from rust-lang/rust#141451 , depends on rust-lang/rust#141442 .
r? `@compiler-errors`
2025-05-29 02:29:01 +00:00
Michael Goulet
5f3ae06db0
Fix some var names
2025-05-27 11:14:47 +00:00
Michael Goulet
29c3babd7c
Rename unpack to kind
2025-05-27 11:14:45 +00:00
bors
2805e1dc4c
Auto merge of #141605 - jieyouxu:rollup-3gjqh5l, r=jieyouxu
...
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#140898 (minor improvements on running miri)
- rust-lang/rust#141392 (Avoid obligation construction dance with query region constraints)
- rust-lang/rust#141431 (Emit dummy open drop for unsafe binder)
- rust-lang/rust#141433 (Properly analyze captures from unsafe binders)
- rust-lang/rust#141439 (Deduplicate dyn compatibility violations due to coercion)
- rust-lang/rust#141449 (further deduplicate ast visitor code)
- rust-lang/rust#141513 (interpret: add allocation parameters to `AllocBytes`)
- rust-lang/rust#141516 (speed up charsearcher for ascii chars)
- rust-lang/rust#141526 (add a dedicated section for compiler environment variables in the unstable book)
- rust-lang/rust#141550 (Fix `unused_braces` lint suggestion when encountering attributes)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-26 20:30:06 +00:00
lcnr
c56efaedfa
add additional TypeFlags fast paths
2025-05-26 19:57:48 +00:00
许杰友 Jieyou Xu (Joe)
aa9978229e
Rollup merge of #141392 - compiler-errors:query-outlives, r=lcnr
...
Avoid obligation construction dance with query region constraints
And some renaming...
2025-05-27 01:29:17 +08:00
bors
40d2563ea2
Auto merge of #141500 - compiler-errors:rerun-cache-2, r=lcnr
...
Don't rerun goals if none of their vars have changed
r? `@ghost`
Alternative to rust-lang/rust#141488 . I'm pretty sure that we don't need to re-run the goal at all if the inputs don't change... 🤔
2025-05-26 17:02:43 +00:00
bors
9c0bcb514f
Auto merge of #141442 - compiler-errors:fast-path-pred, r=lcnr
...
Fold predicate fast path in canonicalizer and eager resolver
See individual commits.
r? lcnr
2025-05-26 13:42:30 +00:00
Michael Goulet
e2215a8ad9
Don't rerun goals if none of its vars have changed
2025-05-26 10:10:03 +00:00
Michael Goulet
9d742eea25
Rename
2025-05-26 08:48:19 +00:00
Michael Goulet
3efd885927
Avoid obligation construction dance with query region constraints
2025-05-26 08:28:45 +00:00
Michael Goulet
84a3255cc3
Fast path fold_predicate in old canonicalizer
2025-05-25 14:12:17 +00:00
Michael Goulet
7820d2caba
Don't use relation just to equate regions in response
2025-05-25 10:37:43 +00:00
lcnr
326b7e9a6b
yeet CanonicalVarInfo
2025-05-23 12:10:53 +00:00
Michael Goulet
98cdb829a8
Fast path for register_region_obligation
2025-05-17 19:35:05 +00:00