Commit Graph

400 Commits

Author SHA1 Message Date
Michael Goulet 207b4b8e88 Record impl args in the InsepctCandiate rather than rematching during select 2024-05-06 14:17:22 -04:00
Michael Goulet 34e91ece90 Higher ranked goal source, do overflow handling less badly 2024-05-02 21:56:14 -04:00
Matthias Krüger 784316eadc Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-dead
Remove many `#[macro_use] extern crate foo` items

This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined.

r? `@fee1-dead`
2024-04-30 15:04:08 +02:00
Michael Goulet 13825dcc15 Take proof trees by value in inspect goal 2024-04-29 17:06:34 -04:00
Michael Goulet 2eb7c8196b Only register candidate if it is associated w a shallow certainty 2024-04-29 10:25:51 -04:00
Michael Goulet 7cf1c547c2 Actually use probes when needed and stop relying on existing outer probes 2024-04-29 10:25:51 -04:00
Nicholas Nethercote 52e9a23bdc Remove extern crate smallvec from a couple of crates. 2024-04-29 18:47:54 +10:00
Nicholas Nethercote 7418aa1a07 Remove extern crate rustc_data_structures from numerous crates. 2024-04-29 18:45:14 +10:00
Nicholas Nethercote 6ce258f657 Remove extern crate rustc_macros from rustc_middle. 2024-04-29 11:19:16 +10:00
Michael Goulet 17728a9bb2 Record certainty of evaluate_added_goals_and_make_canonical_response call in candidate 2024-04-27 17:46:29 -04:00
bors 1b3a32958b Auto merge of #122385 - lcnr:analyze-obligations-for-infer, r=compiler-errors
`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals

As always, dealing with proof trees continues to be a hacked together mess. After this PR and #124380 the only remaining blocker for core is https://github.com/rust-lang/trait-system-refactor-initiative/issues/90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally.

The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one.

For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states.

r? `@compiler-errors`
2024-04-26 15:37:05 +00:00
Michael Goulet 88eae31261 Rollup merge of #124381 - compiler-errors:derived-for-wf, r=lcnr
Renamed `DerivedObligation` to `WellFormedDeriveObligation`

It's used when computing `WellFormed` obligations, so let's give it a less ambiguous name.
2024-04-25 20:07:41 -04:00
Michael Goulet 132f8ce3dc Renamed DerivedObligation to WellFormedDeriveObligation 2024-04-25 16:55:15 -04:00
lcnr 03878c682a hir typeck: look into nested goals
uses a `ProofTreeVisitor` to look into nested
goals when looking at the pending obligations
during hir typeck. Used by closure signature
inference, coercion, and for async functions.
2024-04-25 19:44:00 +00:00
Michael Goulet b2fea557f3 Check closure args and returns are WF 2024-04-25 10:03:17 -04:00
bors c25473ff62 Auto merge of #124008 - nnethercote:simpler-static_assert_size, r=Nilstrieb
Simplify `static_assert_size`s.

We want to run them on all 64-bit platforms.

r? `@ghost`
2024-04-18 09:47:45 +00:00
Nicholas Nethercote 0d97669a17 Simplify static_assert_sizes.
We want to run them on all 64-bit platforms.
2024-04-18 15:36:25 +10:00
Nicholas Nethercote 4b27cc8b7a Avoid lots of hir::HirId{,Map,Set} qualifiers.
Because they're a bit redundant.
2024-04-16 16:29:15 +10:00
Michael Goulet d2ec957680 Stop using PolyTraitRef for closure/coroutine predicates already instantiated w placeholders 2024-04-15 10:32:21 -04:00
Oli Scherer 2f2350e577 Eliminate DefiningAnchor now that is just a single-variant enum 2024-04-08 15:00:27 +00:00
Oli Scherer 19bd91d128 Pass list of defineable opaque types into canonical queries 2024-04-08 15:00:26 +00:00
Waffle Maybe 8b9b024d25 Fix typo 2024-04-05 21:32:32 +02:00
lcnr 92b280ce81 normalizes-to change from '1' to '0 to inf' steps 2024-04-04 12:39:58 +02:00
Zalathar 2d47cd77ac Check x86_64 size assertions on aarch64, too
This makes it easier for contributors on aarch64 workstations (e.g. Macs) to
notice when these assertions have been violated.
2024-04-03 16:53:03 +11:00
Michael Goulet 88296bddf8 Remove EvaluatedToErrStackDependent 2024-03-31 20:44:30 -04:00
Michael Goulet 2fe936f17d Stop doing expensive work in opt_suggest_box_span eagerly 2024-03-27 10:08:14 -04:00
lcnr 0b29b71a2f cleanup + review 2024-03-18 18:13:25 +01:00
lcnr f26e1e8b63 NormalizesTo return nested goals 2024-03-18 15:53:16 +01:00
lcnr 24a1729566 eagerly instantiate binders to avoid relying on sub 2024-03-14 17:19:40 +01:00
Oli Scherer 7348dd1950 Eliminate DefiningAnchor::Error, it is indistinguishable from DefiningAnchor::Bind with an empty list 2024-03-11 17:19:37 +00:00
Oli Scherer 40d5609548 Make DefiningAnchor::Bind only store the opaque types that may be constrained, instead of the current infcx root item.
This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
2024-03-11 17:19:37 +00:00
lcnr 309d85b06f inspect formatter: add braces 2024-03-08 17:03:04 +01:00
Jason Newcomb be9b125d41 Convert TypeVisitor and DefIdVisitor to use VisitorResult 2024-03-05 13:28:15 -05:00
lcnr 5ec9b8d778 distinguish recursion limit based overflow for diagnostics
also change the number of allowed fixpoint steps to be fixed instead
of using the `log` of the total recursion depth.
2024-02-29 10:14:02 +01:00
Nicholas Nethercote 899cb40809 Rename DiagnosticBuilder as Diag.
Much better!

Note that this involves renaming (and updating the value of)
`DIAGNOSTIC_BUILDER` in clippy.
2024-02-28 08:55:35 +11:00
lcnr 1b3164f5c9 always emit AliasRelate goals when relating aliases
Add `StructurallyRelateAliases` to allow instantiating infer vars with rigid aliases.
Change `instantiate_query_response` to be infallible in the new solver. This requires canonicalization to not hide any information used by the query, so weaken
universe compression. It also modifies `term_is_fully_unconstrained` to allow
region inference variables in a higher universe.
2024-02-26 10:17:43 +01:00
cui fliter 824d75c22e remove repetitive words
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-02-23 18:26:01 +08:00
Matthias Krüger 532b3eacb7 Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obk
Expand weak alias types before collecting constrained/referenced late bound regions + refactorings

Fixes #114220.
Follow-up to #120780.

r? `@oli-obk`
2024-02-20 19:35:41 +01:00
León Orell Valerian Liehr 05ce209d20 Rename some normalization-related items 2024-02-20 17:30:49 +01:00
Nicholas Nethercote b18f3e11fa Prefer DiagnosticBuilder over Diagnostic in diagnostic modifiers.
There are lots of functions that modify a diagnostic. This can be via a
`&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type
wraps the former and impls `DerefMut`.

This commit converts all the `&mut Diagnostic` occurrences to `&mut
DiagnosticBuilder`. This is a step towards greatly simplifying
`Diagnostic`. Some of the relevant function are made generic, because
they deal with both errors and warnings. No function bodies are changed,
because all the modifier methods are available on both `Diagnostic` and
`DiagnosticBuilder`.
2024-02-19 20:23:20 +11:00
Michael Goulet 6018e21d8a Remove a suggestion that is redundant 2024-02-15 17:20:44 +00:00
Michael Goulet c763f833d1 Only point out non-diverging arms for match suggestions 2024-02-15 15:44:46 +00:00
Shoyu Vanilla 3856df059e Dejargnonize subst 2024-02-12 15:46:35 +09:00
Lukas Markeffsky 18e5bbfad6 improve pretty printing for trait objects 2024-02-07 16:09:46 +01:00
Michael Goulet 881b6b5149 Bless tests, add comments 2024-02-06 02:22:58 +00:00
Michael Goulet a82bae2172 Teach typeck/borrowck/solvers how to deal with async closures 2024-02-06 02:22:58 +00:00
Esteban Küber a9841936fe Deduplicate more sized errors on call exprs
Change the implicit `Sized` `Obligation` `Span` for call expressions to
include the whole expression. This aids the existing deduplication
machinery to reduce the number of errors caused by a single unsized
expression.
2024-01-24 02:53:15 +00:00
Ali MJ Al-Nasrawy d96003dd2a Correctly handle normalization in implied bounds
Special-case Bevy dependents to not error
2024-01-17 21:27:34 -05:00
Matthias Krüger 1e46be6a53 Rollup merge of #119897 - compiler-errors:fulfillment-errors, r=lcnr
`OutputTypeParameterMismatch` -> `SignatureMismatch`

I'm probably missing something that made this rename more complicated. What did you end up getting stuck on when renaming this selection error, `@lcnr?`

**also** I renamed the `FulfillmentErrorCode` variants. This is just churn but I wanted to do it forever. I can move it out of this PR if desired.

r? lcnr
2024-01-15 08:44:48 +01:00
Michael Goulet 322694ed56 Remove unused ErrorReporting variant from overflow handling 2024-01-12 17:00:32 +00:00