about summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-30/+30
2023-09-21update testslcnr-4/+1
2023-09-20bless the known-bug testsDeadbeef-7/+1
2023-09-20Enable effects for libcoreDeadbeef-18/+7
2023-09-14Paper over an accidental regressionOli Scherer-0/+13
2023-09-11Auto merge of #114586 - oli-obk:patch_tait_rpit_order_check, ↵bors-3/+21
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-3/+21
2023-09-08Stabilize impl_trait_projectionsMichael Goulet-19/+42
2023-09-07Add noteMichael Goulet-0/+5
2023-09-07Don't emit refining_impl_trait for private itemsMichael Goulet-43/+66
2023-09-07Use self instead of the actual self tyMichael Goulet-2/+2
2023-09-07Implement refinement lint for RPITITMichael Goulet-13/+133
2023-09-02Do not require associated types with Self: Sized to uphold bounds when ↵Michael Goulet-1/+17
confirming object candidate
2023-09-02RPITITs are considered object-safe, they're always on Self:Sized methodsMichael Goulet-18/+29
2023-08-31Auto merge of #115366 - ↵bors-0/+19
compiler-errors:associated-type-bound-implicit-lifetimes, r=jackh726 Capture lifetimes for associated type bounds destined to be lowered to opaques Some associated type bounds get lowered to opaques, but they're not represented in the AST as opaques. That means that we never collect lifetimes for them (`record_lifetime_params_for_impl_trait`) which are used currently for RPITITs, which capture all of their in-scope lifetimes[^1]. This means that the nested RPITITs that arise from some type like `impl Foo<Type: Bar>` (~> `impl Foo<Type = impl Bar>`) don't capture any lifetimes, leading to ICEs. This PR makes sure we collect the lifetimes for associated type bounds as well, and make sure that they are set up correctly for opaque type lowering later. Fixes #115360 [^1]: #114489
2023-08-30Revert "Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726"Oli Scherer-8/+6
This reverts commit cb9467515b5a9b15aaa905683c6b4dd9e851056c, reversing changes made to 57781b24c54f9548722927ba88c343ff28da94ce.
2023-08-30Capture lifetimes for associated type bounds destined to be lowered to opaquesMichael Goulet-0/+19
2023-08-28Auto merge of #115326 - matthiaskrgr:rollup-qsoa8ar, r=matthiaskrgrbors-128/+29
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 #115311 - dtolnay:usearcself, r=compiler-errorsMatthias Krüger-8/+3
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-28Revert "Suggest using `Arc` on `!Send`/`!Sync` types"David Tolnay-8/+3
This reverts commit 9de1a472b68ed85f396b2e2cc79c3ef17584d6e1.
2023-08-28Better error message for object type with GATMichael Goulet-6/+12
2023-08-28Test variances of opaque capturesMichael Goulet-0/+88
2023-08-28Bless testsMichael Goulet-9/+32
2023-08-28RPITITs capture all their lifetimesMichael Goulet-58/+20
2023-08-27More precisely detect cycle errors from type_of on opaqueMichael Goulet-120/+26
2023-08-14check for non-defining uses of RPITlcnr-10/+95
2023-08-11Record binder for bare trait object in LifetimeCollectVisitorMichael Goulet-0/+64
2023-08-09Suggest using `Arc` on `!Send`/`!Sync` typesEsteban Kuber-3/+8
2023-08-08Remove dangling testsMichael Goulet-800/+0
2023-08-08add'l testMichael Goulet-0/+15
2023-08-08Install bidirectional outlives predicates for RPITITs (and RPITs) correctlyMichael Goulet-0/+11
2023-08-04don't ICE on higher ranked hidden typesAli MJ Al-Nasrawy-0/+21
2023-08-02Remove constness from `TraitPredicate`Deadbeef-2/+15
2023-08-02Rollup merge of #114301 - ↵Matthias Krüger-0/+35
compiler-errors:dont-error-on-missing-region-outlives, r=spastorino Don't check unnecessarily that impl trait is RPIT We have this random `return_type_impl_trait` function to detect if a function returns an RPIT which is used in outlives suggestions, but removing it doesn't actually change any diagnostics. Let's just remove it. Also, suppress a spurious outlives error from a ReError. Fixes #114274
2023-08-01Suppress unnecessary outlivesMichael Goulet-18/+2
2023-08-01Auto merge of #112849 - m-ou-se:panic-message-format, r=thomccbors-1/+1
Change default panic handler message format. This changes the default panic hook's message format from: ``` thread '{thread}' panicked at '{message}', {location} ``` to ``` thread '{thread}' panicked at {location}: {message} ``` This puts the message on its own line without surrounding quotes, making it easiser to read. For example: Before: ``` thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`', src/main.rs:4:6 ``` After: ``` thread 'main' panicked at src/main.rs:4:6: env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh` ``` --- See this PR by `@nyurik,` which does that for only multi-line messages (specifically because of `assert_eq`): https://github.com/rust-lang/rust/pull/111071 This is the change that does that for *all* panic messages.
2023-07-31Rollup merge of #114182 - Ddystopia:cleanup-after-113312, r=lcnrMatthias Krüger-0/+0
clean up after 113312 Minor edits for #113312 cc ``@RalfJung`` r? ``@lcnr``
2023-07-31Don't check unnecessarily that impl trait is RPITMichael Goulet-0/+51
2023-07-31Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorinoMatthias Krüger-25/+1
Map RPITIT's opaque type bounds back from projections to opaques An RPITIT in a program's AST is eventually translated into both a projection GAT and an opaque. The opaque is used for default trait methods, like: ``` trait Foo { fn bar() -> impl Sized { 0i32 } } ``` The item bounds for both the projection and opaque are identical, and both have a *projection* self ty. This is mostly okay, since we can normalize this projection within the default trait method body to the opaque, but it does two things: 1. it leads to bugs in places where we don't normalize item bounds, like `deduce_future_output_from_obligations` 2. it leads to extra match arms that are both suspicious looking and also easy to miss This PR maps the opaque type bounds of the RPITIT's *opaque* back to the opaque's self type to avoid this quirk. Then we can fix the UI test for #108304 (1.) and also remove a bunch of match arms (2.). Fixes #108304 r? `@spastorino`
2023-07-30Rollup merge of #113741 - compiler-errors:rpitit-projects-to-missing-opaque, ↵Jubilee-0/+26
r=spastorino Don't install default projection bound for return-position `impl Trait` in trait methods with no body This ensures that we never try to project to an opaque type in a trait method that has no body to infer its hidden type, which means we never later call `type_of` on that opaque. This is because opaque types try to reveal their hidden type when proving auto traits. I thought about this a lot, and I think this is a fix that's less likely to introduce other strange downstream ICEs than #113461. Fixes #113434 r? `@spastorino`
2023-07-30Don't install default projection bound for RPITITsMichael Goulet-0/+26
2023-07-30Remap explicit item bounds of RPITIT's opaque back to ty::OpaqueMichael Goulet-25/+1
2023-07-30Rollup merge of #114256 - Urgau:fix-issue-114180, r=WaffleLapkinMatthias Krüger-6/+24
Fix invalid suggestion for mismatched types in closure arguments This PR fixes the invalid suggestion for mismatched types in closure arguments. The invalid suggestion came from a wrongly created span in the parser for closure arguments that don't have a type specified. Specifically, the span in this case was the last token span, but in the case of tuples, the span represented the last parenthesis instead of the whole tuple, which is fixed by taking the more accurate span of the pattern. There is one unfortunate downside of this fix, it worsens even more the diagnostic for mismatched types in closure args without an explicit type. This happens because there is no correct span for implied inferred type. I tried also fixing this but it's a rabbit hole. Fixes https://github.com/rust-lang/rust/issues/114180
2023-07-30Fix invalid suggestion for mismatched types in closure argumentsUrgau-6/+24
The invalid suggestion came from a wrongly created span in `rustc_parse' for closure arguments that didn't have a type specified. Specifically, the span in this case was the last token span, but in the case of tuples, the span represented the last parenthesis instead of the whole tuple, which is fixed by taking the more accurate span of the pattern.
2023-07-29some nits, bless testMichael Goulet-16/+2
2023-07-29Implement assumed_wf_types for RPITITs' implementationsMichael Goulet-0/+29
2023-07-29Take RPITITs inherit the assumed_wf_types of their parent fnMichael Goulet-4/+0
2023-07-29Change default panic handler message format.Mara Bos-1/+1
2023-07-28clean up after 113312Oleksandr Babak-0/+0
2023-07-28Rollup merge of #114147 - compiler-errors:missing-rpitits, r=spastorinoMatthias Krüger-0/+27
Insert RPITITs that were shadowed by missing ADTs that resolve to [type error] Comment inline explains how this can happen. Fixes #113903