about summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
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
2023-07-28Rollup merge of #114146 - compiler-errors:dont-report-rpitit-name, r=spastorinoMatthias Krüger-0/+99
Skip reporting item name when checking RPITIT GAT's associated type bounds hold Doesn't really make sense to label an item that has a name that users can't really mention. Fixes #114145. Also fixes #113794. r? `@spastorino`
2023-07-28Auto merge of #113312 - Ddystopia:auto-trait-fun, r=lcnrbors-0/+10
discard default auto trait impls if explicit ones exist (rebase of #85048) Rebase of #85048
2023-07-28Auto merge of #114134 - fee1-dead-contrib:rm-constness-from-param-env, r=oli-obkbors-10/+9
Remove `constness` from `ParamEnv` This should be replaced by keyword generics/effects. cc #110395 r? `@oli-obk`
2023-07-27Add additional testMichael Goulet-0/+44
2023-07-27Insert RPITITs that were shadowed by missing ADTs that resolve to type errorMichael Goulet-0/+27
2023-07-27tighten span slightly for synthetic itemMichael Goulet-2/+2
2023-07-27Skip reporting item name when checking RPITIT GAT's associated type bounds holdMichael Goulet-0/+55
2023-07-27update tests, adding known-bugDeadbeef-10/+9
2023-07-27Consider a goal as NOT changed if its response is identity modulo regionsMichael Goulet-1/+1
2023-07-20Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obkbors-0/+2
add links to query documentation for E0391 This PR adds links to https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for the rustc --explain E0391 and within the compiler error itself. Fixes: #113184
2023-07-19Auto merge of #113690 - aliemjay:opaque-defined-by-trait, r=compiler-errorsbors-0/+12
allow opaques to be defined by trait queries, again This basically reverts #112963. Moreover, all call-sites of `enter_canonical_trait_query` can now define opaque types, see the ui test `defined-by-user-annotation.rs`. Fixes #113689 r? `@compiler-errors` `@oli-obk`
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-10/+2
2023-07-18added links as a notenxya-2/+2
2023-07-18add links to query documentation for E0391nxya-2/+2
2023-07-18added links as a notenxya-2/+12
2023-07-18add links to query documentation for E0391nxya-2/+2
2023-07-15Check entry type as part of item type checking.Camille GILLOT-8/+8
2023-07-14allow opaques to be defined by trait queriesAli MJ Al-Nasrawy-0/+12
2023-07-10Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errorsbors-85/+408
Replace RPITIT current impl with new strategy that lowers as a GAT This PR replaces the current implementation of RPITITs with the new implementation that we had under -Zlower-impl-trait-in-trait-to-assoc-ty flag that lowers the RPIT as a GAT on the trait and on the impls that implement that trait. Opening this PR as a draft because this goes after #112682, ~#112981~ and ~#112983~. As soon as those are merged, I can rebase and we should run perf, crater and test a lot. r? `@compiler-errors`
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-85/+408
2023-07-08Auto merge of #113491 - matthiaskrgr:rollup-mueqz7h, r=matthiaskrgrbors-2/+2
Rollup of 6 pull requests Successful merges: - #113005 (Don't call `query_normalize` when reporting similar impls) - #113064 (std: edit [T]::swap docs) - #113138 (Add release notes for 1.71.0) - #113217 (resolve typerelative ctors to adt) - #113254 (Use consistent formatting in Readme) - #113482 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-08Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjgillotMatthias Krüger-2/+2
Don't call `query_normalize` when reporting similar impls Firstly, It's sketchy to be using `query_normalize` at all during HIR typeck -- it's asking for an ICE 😅. Secondly, we're normalizing an impl trait ref that potentially has parameter types in `ty::ParamEnv::empty()`, which is kinda sketchy as well. The only UI test change from removing this normalization is that we don't evaluate anonymous constants in impls, which end up giving us really ugly suggestions: ``` error[E0277]: the trait bound `[X; 35]: Default` is not satisfied --> /home/gh-compiler-errors/test.rs:4:5 | 4 | <[X; 35] as Default>::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]` | = help: the following other types implement trait `Default`: &[T] &mut [T] [T; 32] [T; core::::array::{impl#30}::{constant#0}] [T; core::::array::{impl#31}::{constant#0}] [T; core::::array::{impl#32}::{constant#0}] [T; core::::array::{impl#33}::{constant#0}] [T; core::::array::{impl#34}::{constant#0}] and 27 others ``` So just fold the impls with a `BottomUpFolder` that calls `ty::Const::eval`. This doesn't work totally correctly with generic-const-exprs, but it's fine for stable code, and this is error reporting after all.
2023-07-08Rollup merge of #113335 - compiler-errors:reveal-opaques-in-new-solver, r=lcnrMatthias Krüger-0/+11
Reveal opaques in new solver We were testing against the wrong reveal mode :fearful: Also a couple of misc commits that I don't want to really put in separate prs r? ``@lcnr``
2023-07-08Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errorsbors-0/+51
Rollup of 8 pull requests Successful merges: - #113413 (Add needs-triage to all new issues) - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions) - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case) - #113441 (miri: check that assignments do not self-overlap) - #113453 (Remove unused from_method from rustc_on_unimplemented) - #113456 (Avoid calling report_forbidden_specialization for RPITITs) - #113466 (Update cargo) - #113467 (Fix comment of `fn_can_unwind`) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-07Add regression test for RPITITsSantiago Pastorino-0/+51
2023-07-07Normalize opaques during codegen in new solverMichael Goulet-0/+11
2023-07-07Require TAITs to be mentioned in the signatures of functions that register ↵Oli Scherer-22/+89
hidden types for them
2023-07-06deal with opaque types without cyclinglcnr-66/+71
2023-07-06update auto trait handlinglcnr-61/+66