about summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2024-07-07Auto merge of #127172 - compiler-errors:full-can_eq-everywhere, r=lcnrbors-4/+4
Make `can_eq` process obligations (almost) everywhere Move `can_eq` to an extension trait on `InferCtxt` in `rustc_trait_selection`, and change it so that it processes obligations. This should strengthen it to be more accurate in some cases, but is most important for the new trait solver which delays relating aliases to `AliasRelate` goals. Without this, we always basically just return true when passing aliases to `can_eq`, which can lead to weird errors, for example #127149. I'm not actually certain if we should *have* `can_eq` be called on the good path. In cases where we need `can_eq`, we probably should just be using a regular probe. Fixes #127149 r? lcnr
2024-07-07Auto merge of #127404 - compiler-errors:rpitit-entailment-false-positive, ↵bors-0/+224
r=oli-obk Don't try to label `ObligationCauseCode::CompareImplItem` for an RPITIT, since it has no name The old (current) trait solver has a limitation that when a where clause in param-env must be normalized using the same where clause, then we get spurious errors in `normalize_param_env_or_error`. I don't think there's an issue tracking it, but it's the root cause for many of the "fixed-by-next-solver" labeled issues. Specifically, these errors may occur when checking predicate entailment of the GAT that comes out of desugaring RPITITs. Since we use `ObligationCauseCode::CompareImplItem` for these predicates, we try calling `item_name` on an RPITIT which fails, since the RPITIT has no name. We simply suppress this logic when we're reporting a predicate entailment error for an RPITIT. RPITITs should never have predicate entailment errors, *by construction*, but they may due to this bug in the old solver. Addresses the ICE in #127331, though doesn't fix the underlying issue (which is fundamental to the old solver). r? types
2024-07-06Don't try to label ObligationCauseCode::CompareImplItem for an RPITIT, since ↵Michael Goulet-0/+224
it has no name
2024-07-06show fnsig's output when there is differenceyukang-1/+1
2024-07-06show unit output when there is only output diff in diagnosticsyukang-1/+1
2024-07-05Rollup merge of #127392 - estebank:arg-type, r=jieyouxuJubilee-44/+57
Use verbose suggestion for changing arg type
2024-07-05Rollup merge of #127383 - estebank:arg-removal, r=compiler-errorsJubilee-8/+12
Use verbose style for argument removal suggestion
2024-07-05Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelixMichael Goulet-4/+8
Improve dead code analysis Fixes #120770 1. check impl items later if self ty is private although the trait method is public, cause we must use the ty firstly if it's private 2. mark the adt live if it appears in pattern, like generic argument, this implies the use of the adt 3. based on the above, we can handle the case that private adts impl Default, so that we don't need adding rustc_trivial_field_reads on Default, and the logic in should_ignore_item r? ``@pnkfelix``
2024-07-05Use verbose suggestion for changing arg typeEsteban Küber-44/+57
2024-07-05Use verbose style for argument removal suggestionEsteban Küber-8/+12
2024-07-05Actually just make can_eq process obligations (almost) everywhereMichael Goulet-4/+4
2024-07-04Improve dead code analysismu001999-4/+8
2024-07-01Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercotebors-4/+26
Automatically taint InferCtxt when errors are emitted r? `@nnethercote` Basically `InferCtxt::dcx` now returns a `DiagCtxt` that refers back to the `Cell<Option<ErrorGuaranteed>>` of the `InferCtxt` and thus when invoking `Diag::emit`, and the diagnostic is an error, we taint the `InferCtxt` directly. That change on its own has no effect at all, because `InferCtxt` already tracks whether errors have been emitted by recording the global error count when it gets opened, and checking at the end whether the count changed. So I removed that error count check, which had a bit of fallout that I immediately fixed by invoking `InferCtxt::dcx` instead of `TyCtxt::dcx` in a bunch of places. The remaining new errors are because an error was reported in another query, and never bubbled up. I think they are minor enough for this to be ok, and sometimes it actually improves diagnostics, by not silencing useful diagnostics anymore. fixes #126485 (cc `@olafes)` There are more improvements we can do (like tainting in hir ty lowering), but I would rather do that in follow up PRs, because it requires some refactorings.
2024-06-29Rollup merge of #127103 - compiler-errors:tighten-trait-bound-parsing, r=fmeaseMatthias Krüger-0/+112
Move binder and polarity parsing into `parse_generic_ty_bound` Let's pull out the parts of #127054 which just: 1. Make the parsing code less confusing 2. Fix `?use<>` (to correctly be denied) 3. Improve `T: for<'a> 'a` diagnostics This should have no user-facing effects on stable parsing. r? fmease
2024-06-28Move binder and polarity parsing into parse_generic_ty_boundMichael Goulet-0/+112
2024-06-27Tighten spans for async blocksMichael Goulet-6/+6
2024-06-26Auto merge of #120924 - xFrednet:rfc-2383-stabilization-party, r=Urgau,blyxyasbors-24/+7
Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](https://github.com/rust-lang/rust/pull/99063) was stalled by some unresolved questions. These have been discussed in a [lang team](https://github.com/rust-lang/lang-team/issues/191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in https://github.com/rust-lang/rust/issues/115980 I've just updated the [stabilization report](https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: https://github.com/rust-lang/rust/issues/54503 Stabilization Report: https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964 Documentation Update: https://github.com/rust-lang/reference/pull/1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
2024-06-26Automatically taint InferCtxt when errors are emittedOli Scherer-4/+26
2024-06-26Rollup merge of #126968 - lqd:issue-126670, r=compiler-errorsMatthias Krüger-0/+39
Don't ICE during RPITIT refinement checking for resolution errors after normalization #126670 shows a case where resolution errors after normalization can happen during RPITIT refinement checking. Our tests didn't reach this path before, and we explicitly ICEd until we had a test. We can now delay a bug since we're sure it is reachable and have the test from the isue. The comment I added likely still needs more expert wordsmithing. r? ``@compiler-errors`` who's making me work during vacation (j/k). Fixes #126670
2024-06-25delay bug in RPITIT refinement checking with resolution errorsRémy Rakic-0/+39
2024-06-25Rollup merge of #126746 - compiler-errors:no-rpitit, r=oli-obkMatthias Krüger-44/+138
Deny `use<>` for RPITITs Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly. We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT. Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024. r? oli-obk cc ``@traviscross`` Tracking: - https://github.com/rust-lang/rust/issues/123432
2024-06-25RFC 2383: Stabilize `lint_reasons` :tada:xFrednet-24/+7
2024-06-25Auto merge of #125610 - oli-obk:define_opaque_types14, r=compiler-errorsbors-57/+326
Allow constraining opaque types during various unsizing casts allows unsizing of tuples, arrays and Adts to constraint opaque types in their generic parameters to concrete types on either side of the unsizing cast. Also allows constraining opaque types during trait object casts that only differ in auto traits or lifetimes. cc #116652
2024-06-24Deny use<> for RPITITsMichael Goulet-45/+76
2024-06-21bless testsDeadbeef-1/+7
2024-06-20Add a test demonstrating that RPITITs cant use precise capturingMichael Goulet-0/+63
2024-06-20Rollup merge of #126620 - oli-obk:taint_errors, r=fee1-deadMatthias Krüger-0/+30
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-19More testsOli Scherer-0/+184
2024-06-19Allow constraining opaque types during subtyping in the trait systemOli Scherer-72/+16
2024-06-19Add more testsOli Scherer-0/+80
2024-06-19Allow constraining opaque types during auto trait castingOli Scherer-31/+29
2024-06-19Add testsOli Scherer-0/+55
2024-06-19Allow constraining opaque types during unsizingOli Scherer-57/+9
2024-06-19Taint infcx when reporting errorsOli Scherer-0/+30
2024-06-17Delay a bug and mark precise_capturing as not incompleteMichael Goulet-228/+47
2024-06-17Detect duplicatesMichael Goulet-0/+39
2024-06-17Add tests for illegal use bound syntaxMichael Goulet-2/+119
2024-06-17Rework precise capturing syntaxMichael Goulet-124/+124
2024-06-17Make parse_seq_to_before_tokens take expected/nonexpected tokens, use in ↵Michael Goulet-10/+1
parse_precise_capturing_syntax
2024-06-16Rollup merge of #126127 - Alexendoo:other-trait-diag, r=pnkfelixJacob Pratt-4/+4
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-13Method resolution constrains hidden types instead of rejecting method candidatesOli Scherer-78/+20
2024-06-13Add some testsOli Scherer-0/+624
2024-06-12Rollup merge of #126337 - oli-obk:nested_gat_opaque, r=lcnrJubilee-0/+48
Add test for walking order dependent opaque type behaviour r? ```@lcnr``` adding the test for your comment here: https://github.com/rust-lang/rust/pull/122366/files#r1521124754
2024-06-12Rebase falloutMichael Goulet-2/+2
2024-06-12Add test for walking order dependent opaque type behaviourOli Scherer-0/+48
2024-06-12Spell out other trait diagnosticAlex Macleod-4/+4
2024-06-12Require any function with a tait in its signature to actually constrain a ↵Oli Scherer-78/+193
hidden type
2024-06-11Also test under next solverOli Scherer-1/+14
2024-06-11Revert "When checking whether an impl applies, constrain hidden types of ↵Oli Scherer-71/+37
opaque types." This reverts commit 29a630eb72ffb94c3708947afae1e948ad3cb189.
2024-06-11Add regression testOli Scherer-0/+60