summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2023-11-09only erase param env regions where neededlcnr-1/+1
(cherry picked from commit a582e9638b1653c269a4cba0ed00f78eb138b7e7)
2023-11-09dropck_outlives check generator witness needs_droplcnr-13/+22
(cherry picked from commit 57253552de475856a1f3bddedcd76e775892f770)
2023-10-20revert rust-lang/rust#114586Ali MJ Al-Nasrawy-42/+4
(cherry picked from commit a1e274f1721f6be4a36afe10e57a6825eeeaf848)
2023-10-20Fix a performance regression in obligation deduplication.Nicholas Nethercote-4/+4
Commit 8378487 from #114611 changed the location of an obligation deduplication step in `opt_normalize_projection_type`. This meant that deduplication stopped happening on one path where it was still necessary, causing a couple of drastic performance regressions. This commit moves the deduplication back to the old location. The good news is that #114611 had four commits and 8378487 was of minimal importance, so the perf benefits from that PR remain. Fixes #116780, #116797. (cherry picked from commit 91f2fbc867bfc31f2e103b09e605c61f1a450b33)
2023-09-27fix clippy::{redundant_guards, useless_format}Matthias Krüger-1/+1
2023-09-24Remove span from BrAnon.Camille GILLOT-4/+5
2023-09-24Remove dead code.Camille GILLOT-66/+8
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-65/+13
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-147/+44
2023-09-23Fold lifetimes before substitution.Camille GILLOT-14/+14
2023-09-23Check types live across yields in generators tooMichael Goulet-0/+7
2023-09-23Check that closure's by-value captures are sizedMichael Goulet-0/+11
2023-09-22Auto merge of #115920 - Zoxc:depkind-u16, r=cjgillotbors-2/+3
Move `DepKind` to `rustc_query_system` and define it as `u16` This moves the `DepKind` type to `rustc_query_system` where it's defined with an inner `u16` field. This decouples it from `rustc_middle` and is a step towards letting other crates define dep kinds. It also allows some type parameters to be removed. The `DepKind` trait is replaced with a `Deps` trait. That's used when some operations or information about dep kinds which is unavailable in `rustc_query_system` are still needed. r? `@cjgillot`
2023-09-21Auto merge of #115897 - eduardosm:check-fn-sig, r=compiler-errorsbors-0/+1
rustc_hir_analysis: add a helper to check function the signature mismatches 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. This is the first time I do anything with rustc_hir_analysis/rustc_hir_typeck, so comments and suggestions about things I did wrong or that could be improved will be appreciated.
2023-09-21Suggest desugaring to RPITIT when AFIT is required to be an auto traitMichael Goulet-0/+137
2023-09-21Record asyncness span in HIRMichael Goulet-2/+4
2023-09-21Move `DepKind` to `rustc_query_system` and define it as `u16`John Kåre Alsaker-2/+3
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.