about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2023-09-21reviewlcnr-78/+75
2023-09-21HACK: avoid hang in structurally_normalizelcnr-3/+9
2023-09-21proof trees: use for `intercrate_ambiguity_causes`lcnr-92/+239
2023-09-20remove `impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for ↵Ziru Niu-1/+1
PolyProjectionPredicate<'tcx>`
2023-09-19rustc_hir_analysis: add a helper to check function the signature mismatchesEduardo Sánchez Muñoz-0/+1
This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.
2023-09-19Explain HRTB + infer limitations of old solverMichael Goulet-0/+75
2023-09-18Auto merge of #115748 - RalfJung:post-mono, r=oli-obkbors-29/+32
move required_consts check to general post-mono-check function This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants. Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized. I didn't expect this to change diagnostics, but it's just cycle errors that change. r? `@oli-obk`
2023-09-18Remove unused `Lift` derives.Nicholas Nethercote-2/+2
I found these by commenting out all `Lift` derives and then adding back the ones that were necessary to successfully compile.
2023-09-17Auto merge of #114452 - weiznich:feature/diagnostic_on_unimplemented, ↵bors-25/+84
r=compiler-errors `#[diagnostic::on_unimplemented]` without filters This commit adds support for a `#[diagnostic::on_unimplemented]` attribute with the following options: * `message` to customize the primary error message * `note` to add a customized note message to an error message * `label` to customize the label part of the error message The relevant behavior is specified in [RFC-3366](https://rust-lang.github.io/rfcs/3366-diagnostic-attribute-namespace.html)
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-29/+32
2023-09-13make the set of methods between our two Const types more consistentRalf Jung-1/+1
2023-09-13make the eval() functions on our const types return the resulting valueRalf Jung-4/+4
2023-09-12`#[diagnostic::on_unimplemented]` without filtersGeorg Semmler-25/+84
This commit adds support for a `#[diagnostic::on_unimplemented]` attribute with the following options: * `message` to customize the primary error message * `note` to add a customized note message to an error message * `label` to customize the label part of the error message Co-authored-by: León Orell Valerian Liehr <me@fmease.dev> Co-authored-by: Michael Goulet <michael@errs.io>
2023-09-11Auto merge of #114586 - oli-obk:patch_tait_rpit_order_check, ↵bors-4/+42
r=lcnr,compiler-errors Bubble up opaque <eq> opaque operations instead of picking an order In case we are in `Bubble` mode (meaning every opaque type that is defined in the current crate is treated as if it were in its defining scope), we don't try to register an opaque type as the hidden type of another opaque type, but instead bubble up an obligation to equate them at the query caller site. Usually that means we have a `DefiningAnchor::Bind` and thus can reliably figure out whether an opaque type is in its defining scope. Where we can't, we'll error out, so the default is sound. With this change we start using `AliasTyEq` predicates in the old solver, too. fixes https://github.com/rust-lang/rust/issues/108498 But also regresses `tests/ui/impl-trait/anon_scope_creep.rs`. Our use of `Bubble` for `check_opaque_type_well_formed` is going to keep biting us. r? `@lcnr` `@compiler-errors`
2023-09-11Bubble up opaque <eq> opaque operations instead of picking an orderOli Scherer-4/+42
2023-09-11Rollup merge of #115743 - compiler-errors:no-impls, r=davidtwcoMatthias Krüger-5/+19
Point out if a local trait has no implementations Slightly helps with #115741
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-1/+1
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-10Point out if a local trait has no implementationsMichael Goulet-5/+19
2023-09-07Don't suggest dereferencing to unsized typeMichael Goulet-1/+14
2023-09-06Auto merge of #115529 - chenyukang:yukang-fix-115402-overflowsize, ↵bors-0/+10
r=compiler-errors Fix error report for size overflow from transmute Fixes #115402 The span in the error reporting always points to the `dst`, this is an old issue, I may open another PR to fix it.
2023-09-06Fix error report for size overflow from transmuteyukang-0/+10
2023-09-05 unconstrained region vars: do not ICE ICE babylcnr-9/+5
2023-09-02Do not require associated types with Self: Sized to uphold bounds when ↵Michael Goulet-3/+3
confirming object candidate
2023-09-02RPITITs are considered object-safe, they're always on Self:Sized methodsMichael Goulet-0/+3
2023-09-01Auto merge of #113201 - oli-obk:recursive_type_alias, r=estebank,compiler-errorsbors-1/+20
Permit recursive weak type aliases I saw #63097 and thought "we can do ~~better~~ funnier". So here it is. It's not useful, but it's certainly something. This may actually become feasible with lazy norm (so in 5 years (constant, not reducing over time)). r? `@estebank` cc `@GuillaumeGomez`
2023-08-30Don't record spans for predicates in coherenceMichael Goulet-19/+11
2023-08-30Permit recursive weak type aliasesOli Scherer-1/+20
2023-08-28Auto merge of #115326 - matthiaskrgr:rollup-qsoa8ar, r=matthiaskrgrbors-20/+9
Rollup of 8 pull requests Successful merges: - #115164 (MIR validation: reject in-place argument/return for packed fields) - #115240 (codegen_llvm/llvm_type: avoid matching on the Rust type) - #115294 (More precisely detect cycle errors from type_of on opaque) - #115310 (Document panic behavior across editions, and improve xrefs) - #115311 (Revert "Suggest using `Arc` on `!Send`/`!Sync` types") - #115317 (Devacationize oli-obk) - #115319 (don't use SnapshotVec in Graph implementation, as it looks unused; use Vec instead) - #115322 (Tweak output of `to_pretty_impl_header` involving only anon lifetimes) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-28Rollup merge of #115322 - estebank:list-tweak, r=compiler-errorsMatthias Krüger-9/+3
Tweak output of `to_pretty_impl_header` involving only anon lifetimes Do not print `impl<> Foo for &Bar`.
2023-08-28Rollup merge of #115311 - dtolnay:usearcself, r=compiler-errorsMatthias Krüger-6/+0
Revert "Suggest using `Arc` on `!Send`/`!Sync` types" Closes https://github.com/rust-lang/rust/issues/114687. This is a clean revert of https://github.com/rust-lang/rust/pull/88936 + https://github.com/rust-lang/rust/pull/115210. The suggestion to Arc\<{Self}\> when Self does not implement Send is *always* wrong. https://github.com/rust-lang/rust/pull/114842 is considering a way to make a more refined suggestion.
2023-08-28Rollup merge of #115294 - compiler-errors:cycle-err, r=oli-obkMatthias Krüger-5/+6
More precisely detect cycle errors from type_of on opaque Not sure if this still needs work. Just putting it up for initial impressions, since it seems that a few people are frustrated with the increased error verbosity due to #113320. Essentially we introduce a new sub-query for `type_of` specifically for opaques which returns a value that is able to distinguish "has errors" from "due to cycle recovery". Fixes #115188 r? `@oli-obk`
2023-08-28Tweak output of `to_pretty_impl_header` involving only anon lifetimesEsteban Küber-9/+3
Do not print `impl<> Foo for &Bar`.
2023-08-28Revert "Suggest using `Arc` on `!Send`/`!Sync` types"David Tolnay-6/+0
This reverts commit 9de1a472b68ed85f396b2e2cc79c3ef17584d6e1.
2023-08-28Better error message for object type with GATMichael Goulet-1/+1
2023-08-27More precisely detect cycle errors from type_of on opaqueMichael Goulet-5/+6
2023-08-18Add an (perma-)unstable option to disable vtable vptrGary Guo-1/+1
This flag is intended for evaluation of trait upcasting space cost for embedded use cases.
2023-08-18Auto merge of #114611 - nnethercote:type-system-chess, r=compiler-errorsbors-9/+4
Speed up compilation of `type-system-chess` [`type-system-chess`](https://github.com/rust-lang/rustc-perf/pull/1680) is an unusual program that implements a compile-time chess position solver in the trait system(!) This PR is about making it compile faster. r? `@ghost`
2023-08-15Rollup merge of #114819 - estebank:issue-78124, r=compiler-errorsMatthias Krüger-1/+1
Point at return type when it influences non-first `match` arm When encountering code like ```rust fn foo() -> i32 { match 0 { 1 => return 0, 2 => "", _ => 1, } } ``` Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`. Fix #78124.
2023-08-15more nitsMichael Goulet-17/+49
2023-08-15Reuse the selection context, compute failing obligations first in ambig modeMichael Goulet-88/+78
2023-08-15nitsMichael Goulet-3/+3
Co-authored-by: lcnr <rust@lcnr.de>
2023-08-15Implement lint against coinductive impl overlapMichael Goulet-6/+75
2023-08-15more span infoMichael Goulet-7/+9
2023-08-14Point at return type when it influences non-first `match` armEsteban Küber-1/+1
When encountering code like ```rust fn foo() -> i32 { match 0 { 1 => return 0, 2 => "", _ => 1, } } ``` Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`. Fix #78124.
2023-08-14Remove constness from `ImplSource::Param`Deadbeef-4/+3
2023-08-13Auto merge of #114457 - lcnr:trait_ref_is_knowable-normalize, r=compiler-errorsbors-26/+44
normalize in `trait_ref_is_knowable` in new solver fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/51 Alternatively we could avoid normalizing the self type and do this at the end of the `assemble_candidates_via_self_ty` stack by splitting candidates into: - applicable without normalizing self type - applicable for aliases, even if they can be normalized - applicable for stuff which cannot get normalized further I don't think this would have any significant benefits and it also seems non-trivial to avoid normalizing only the self type in `trait_ref_is_knowable`. r? `@compiler-errors`
2023-08-12normalize in `trait_ref_is_knowable` in new solverlcnr-26/+44
2023-08-11remove builtin impl for float and int inferlcnr-5/+2
2023-08-10Comment nitsMichael Goulet-1/+1
2023-08-09Suggest using `Arc` on `!Send`/`!Sync` typesEsteban Kuber-0/+6