Commit Graph

4181 Commits

Author SHA1 Message Date
Michael Goulet
db638ab968 Rename a bunch of things 2024-06-21 12:32:05 -04:00
Matthias Krüger
ef2e8bfcbf
Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxu
Clean up some comments near `use` declarations

#125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge.

r? ``@lqd``
2024-06-20 14:07:04 +02:00
Matthias Krüger
e7be3562b7
Rollup merge of #126620 - oli-obk:taint_errors, r=fee1-dead
Actually taint InferCtxt when a fulfillment error is emitted

And avoid checking the global error counter

fixes #122044
fixes #123255
fixes #123276
fixes #125799
2024-06-20 07:52:43 +02:00
Nicholas Nethercote
665821cb60 Add blank lines after module-level //! comments.
Most modules have such a blank line, but some don't. Inserting the blank
line makes it clearer that the `//!` comments are describing the entire
module, rather than the `use` declaration(s) that immediately follows.
2024-06-20 09:23:20 +10:00
Oli Scherer
e4c9a8cf9b Const generic parameters aren't bounds, even if we end up erroring because of the bound that binds the parameter's type 2024-06-19 14:58:29 +00:00
Oli Scherer
3594a19f2a Taint infcx when reporting errors 2024-06-19 04:41:56 +00:00
bors
8fcd4dd08e Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnr
Uplift next trait solver to `rustc_next_trait_solver`

🎉

There's so many FIXMEs! Sorry! Ideally this merges with the FIXMEs and we track and squash them over the near future.

Also, this still doesn't build on anything other than rustc. I still need to fix `feature = "nightly"` in `rustc_type_ir`, and remove and fix all the nightly feature usage in the new trait solver (notably: let-chains).

Also, sorry `@lcnr` I know you asked for me to separate the commit where we `mv rustc_trait_selection/solve/... rustc_next_trait_solver/solve/...`, but I had already done all the work by that point. Luckily, `git` understands the file moves so it should still be relatively reviewable.

If this is still very difficult to review, then I can do some rebasing magic to try to separate this out. Please let me know!

r? lcnr
2024-06-18 19:41:33 +00:00
Oli Scherer
3f34196839 Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
Oli Scherer
7ba82d61eb Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
Michael Goulet
6609501ca7 Fix transmute goal 2024-06-18 11:04:01 -04:00
Michael Goulet
7d2be888b6 Fix impl for SolverDelegate 2024-06-18 11:04:01 -04:00
Michael Goulet
532149eb88 Uplift the new trait solver 2024-06-18 10:55:34 -04:00
Michael Goulet
baf94bddf0 SolverDelegate 2024-06-18 10:40:30 -04:00
Michael Goulet
dba4147633 Make SearchGraph fully generic 2024-06-18 10:40:30 -04:00
Michael Goulet
ff154c7122 Uplift OpaqueTypeKey too, use it in response 2024-06-16 11:28:47 -04:00
Michael Goulet
9d207cfbc8 Uplift ExternalConstraintData 2024-06-16 11:28:47 -04:00
Michael Goulet
f93ee19fd7 Make ExternalConstraints just carry outlives 2024-06-16 11:28:47 -04:00
Michael Goulet
a333943890 Stop using AssocKind in new solver 2024-06-16 11:28:47 -04:00
Michael Goulet
b65d735f1c Move InferCtxtSelectExt out of eval_ctxt module 2024-06-16 11:28:47 -04:00
bors
12b33d36f3 Auto merge of #126540 - jhpratt:rollup-fzzz8j3, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - #125112 (Document behavior of `create_dir_all` wrt. empty path)
 - #126127 (Spell out other trait diagnostic)
 - #126309 (unify git command preperation)
 - #126539 (Update `Arc::try_unwrap()` docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-16 07:44:33 +00:00
Jacob Pratt
936d76009b
Rollup merge of #126127 - Alexendoo:other-trait-diag, r=pnkfelix
Spell out other trait diagnostic

I recently saw somebody confused about the diagnostic thinking it was suggesting to add an `as` cast. This change is longer but I think it's clearer
2024-06-16 03:41:57 -04:00
bors
5639c21fb3 Auto merge of #126505 - compiler-errors:no-vtable, r=lcnr
Only compute vtable information during codegen

This PR removes vtable information from the `Object` and `TraitUpcasting` candidate sources in the trait solvers, and defers the computation of relevant information to `Instance::resolve`. This is because vtables really aren't a thing in the trait world -- they're an implementation detail in codegen.

Previously it was just easiest to tangle this information together since we were already doing the work of looking at all the supertraits in the trait solver, and specifically because we use traits to represent when it's possible to call a method via a vtable (`Object` candidate) and do upcasting (`Unsize` candidate). but I am somewhat suspicious we're doing a *lot* of extra work, especially in polymorphic contexts, so let's see what perf says.
2024-06-16 05:33:49 +00:00
Guillaume Gomez
b6311b3a33
Rollup merge of #126525 - jieyouxu:traitsel-docs, r=compiler-errors
trait_selection: remove extra words

Tiny doc cleanup.

Fixes https://github.com/rust-lang/rust/issues/88231.
2024-06-15 19:51:38 +02:00
Guillaume Gomez
aa6fb1cfcb
Rollup merge of #126496 - compiler-errors:more-generics, r=lcnr
Make proof tree probing and `Candidate`/`CandidateSource` generic over interner

`<TyCtxt<'tcx>>` is ugly, but will become `<I>` when things actually become generic.

r? lcnr
2024-06-15 19:51:36 +02:00
Guillaume Gomez
709d862308
Rollup merge of #126404 - compiler-errors:alias-relate-terms, r=lcnr
Check that alias-relate terms are WF if reporting an error in alias-relate

Check that each of the left/right term is WF when deriving a best error obligation for an alias-relate goal. This will make sure that given `<i32 as NotImplemented>::Assoc = ()` will drill down into `i32: NotImplemented` since we currently treat the projection as rigid.

r? lcnr
2024-06-15 19:51:35 +02:00
许杰友 Jieyou Xu (Joe)
ea2ac347f0 trait_selection: remove extra words 2024-06-15 15:50:00 +00:00
Matthias Krüger
6f21da3bb4
Rollup merge of #126471 - oli-obk:filter_loop, r=compiler-errors
Use a consistent way to filter out bounds instead of splitting it into three places

just a small cleanup, no logic change.

Initially the code had me looking for why anything was special here, only to realize there's nothing interesting going on
2024-06-15 10:56:42 +02:00
Matthias Krüger
335e320baa
Rollup merge of #126354 - compiler-errors:variance, r=lcnr
Use `Variance` glob imported variants everywhere

Fully commit to using the globbed variance. Could be convinced the other way, and change this PR to not use the globbed variants anywhere, but I'd rather we do one or the other.

r? lcnr
2024-06-15 10:56:40 +02:00
Michael Goulet
3b9adbec32 Only compute vtable information during codegen 2024-06-14 20:35:45 -04:00
Michael Goulet
0562064959 Correctly consider depth when visiting WF goals 2024-06-14 17:19:58 -04:00
Michael Goulet
93ff86ed7c Use is_lang_item more aggressively 2024-06-14 16:54:29 -04:00
Michael Goulet
d5c48ebc71 Add TyCtxt::is_lang_item 2024-06-14 16:50:07 -04:00
Michael Goulet
c2e416c471 Make proof tree probing generic 2024-06-14 16:04:45 -04:00
Michael Goulet
8a8bbc0c17 Make Candidate generic over interner 2024-06-14 15:59:47 -04:00
Oli Scherer
5c8bb678d0 Use a consistent way to filter out bounds instead of splitting it into three places 2024-06-14 09:40:44 +00:00
Michael Goulet
c8e42065f0 Address nits
- Remove the ValuePairs glob import
- Make DummyPairs -> ValuePairs::Dummy and make it bug more
- Fix WC
- Make interner return `impl IntoIterator`s
2024-06-13 09:47:45 -04:00
Michael Goulet
a2fb2ebc17 Fix some TODOs 2024-06-13 09:34:29 -04:00
Michael Goulet
e82db89b4d Finish uplifting all of structural_traits 2024-06-13 09:34:29 -04:00
Michael Goulet
b79360ad16 Rework most of structural_traits to be Interner-agnostic 2024-06-13 09:34:28 -04:00
Michael Goulet
d3812ac95f LangItem-ify Coroutine trait in solvers 2024-06-13 09:34:28 -04:00
Michael Goulet
93ee07c756 Check that alias-relate terms are WF if reporting an error in alias-relate 2024-06-13 08:52:35 -04:00
Jubilee
f6cc226f09
Rollup merge of #126353 - compiler-errors:move-match, r=lcnr
Move `MatchAgainstFreshVars` to old solver

Small change I noticed when trying to uplift the relations to the new trait solver.
2024-06-12 20:03:21 -07:00
Jubilee
25c55c51cb
Rollup merge of #126142 - compiler-errors:trait-ref-split, r=jackh726
Harmonize using root or leaf obligation in trait error reporting

When #121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation.

Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation.

This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓

r? ``@estebank``

Fixes #126129
2024-06-12 20:03:19 -07:00
Michael Goulet
ae24ebe710 Rebase fallout 2024-06-12 21:17:33 -04:00
Michael Goulet
2c0348a0d8 Stop passing traitref/traitpredicate by ref 2024-06-12 20:57:24 -04:00
Michael Goulet
f8d12d9189 Stop passing both trait pred and trait ref 2024-06-12 20:57:23 -04:00
Michael Goulet
c453c82de4 Harmonize use of leaf and root obligation in trait error reporting 2024-06-12 20:57:23 -04:00
Michael Goulet
44040a0670 Also passthrough for projection clauses 2024-06-12 19:10:02 -04:00
Michael Goulet
b0c1474381 better error message for normalizes-to ambiguities 2024-06-12 19:03:37 -04:00
Michael Goulet
52b2c88bdf Walk into alias-eq nested goals even if normalization fails 2024-06-12 19:03:37 -04:00