summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2023-05-26Rollup merge of #111947 - obeis:issue-111943, r=compiler-errorsMatthias Krüger-0/+38
Add test for RPIT defined with different hidden types with different substs Close #111943
2023-05-26Add test for RPIT defined with different hidden types with different substsObei Sideg-0/+38
2023-05-25Don't print newlines in APITsMichael Goulet-0/+44
2023-05-18Remove return type sized check hack from hir typeckMichael Goulet-51/+5
2023-05-18Simplify suggestion when returning bare dyn traitMichael Goulet-90/+84
2023-05-16Use error term if missing associated item in new solverMichael Goulet-1/+15
2023-05-13improve error for `impl<..> impl Trait for Type`y21-0/+64
2023-05-13Rollup merge of #111451 - compiler-errors:note-cast-origin, r=b-naberDylan DPC-4/+2
Note user-facing types of coercion failure When coercing, for example, `Box<A>` into `Box<dyn B>`, make sure that any failure notes mention *those* specific types, rather than mentioning inner types, like "the cast from `A` to `dyn B`". I expect end-users are often confused when we skip layers of types and only mention the "innermost" part of a coercion, especially when other notes point at HIR, e.g. #111406.
2023-05-12Use the opaque_types_defined_by query to cheaply check for whether a hidden ↵Oli Scherer-0/+134
type may be registered for an opaque type
2023-05-12Note base types of coercionMichael Goulet-4/+2
2023-05-05Rollup merge of #111052 - nnethercote:fix-ice-test, r=NilstriebYuki Okushi-19/+5
Fix problems with backtraces in two ui tests. `default-backtrace-ice.rs` started started failing for me recently, because on my Ubuntu 23.04 system there are 100 stack frames, and the current stack filtering pattern doesn't match on a stack frame with a three digit number. `issue-86800.rs` can also be improved, backtrace-wise. r? `@Nilstrieb`
2023-05-05Don't print backtrace on ICEs in `issue-86800.rs`.Nicholas Nethercote-19/+5
Because it then just has to be filtered out. This change makes this test more like these other tests: - tests/ui/treat-err-as-bug/err.rs - tests/ui/treat-err-as-bug/delay_span_bug.rs - tests/ui/mir/validate/storage-live.rs - tests/ui/associated-inherent-types/bugs/ice-substitution.rs - tests/ui/layout/valid_range_oob.rs
2023-05-04Rollup merge of #111039 - compiler-errors:foreign-span-rpitit, r=tmiaskoMatthias Krüger-6/+30
Encode def span for foreign return-position `impl Trait` in trait Fixes #111031, yet another def-span encoding issue :/ Includes a smaller repro than the issue, but I can confirm it ICEs: ``` query stack during panic: #0 [def_span] looking up span for `rpitit::Foo::bar::{opaque#0}` #1 [object_safety_violations] determining object safety of trait `rpitit::Foo` #2 [check_is_object_safe] checking if trait `rpitit::Foo` is object safe #3 [typeck] type-checking `main` #4 [used_trait_imports] finding used_trait_imports `main` #5 [analysis] running analysis passes on this crate ``` Luckily since this only affects nightly, this desn't need to be backported.
2023-05-02Mark RPITIT and AFIT as no longer incompleteMichael Goulet-92/+4
2023-04-30Encode def span for foreign RPITITsMichael Goulet-6/+30
2023-04-25vars are ?Michael Goulet-2/+2
2023-04-21Auto merge of #96840 - cjgillot:query-feed, r=oli-obkbors-2/+2
Allow to feed a value in another query's cache and remove `WithOptConstParam` I used it to remove `WithOptConstParam` queries, as an example. The idea is that a query (here `typeck(function)`) can write into another query's cache (here `type_of(anon const)`). The dependency node for `type_of` would depend on all the current dependencies of `typeck`. There is still an issue with cycles: if `type_of(anon const)` is accessed before `typeck(function)`, we will still have the usual cycle. The way around this issue is to `ensure` that `typeck(function)` is called before accessing `type_of(anon const)`. When replayed, we may the following cases: - `typeck` is green, in that case `type_of` is green too, and all is right; - `type_of` is green, `typeck` may still be marked as red (it depends on strictly more things than `type_of`) -> we verify that the saved value and the re-computed value of `type_of` have the same hash; - `type_of` is red, then `typeck` is red -> it's the caller responsibility to ensure `typeck` is recomputed *before* `type_of`. As `anon consts` have their own `DefPathData`, it's not possible to have the def-id of the anon-const point to something outside the original function, but the general case may have to be resolved before using this device more broadly. There is an open question about loading from the on-disk cache. If `typeck` is loaded from the on-disk cache, the side-effect does not happen. The regular `type_of` implementation can go and fetch the correct value from the decoded `typeck` results, and the dep-graph will check that the hashes match, but I'm not sure we want to rely on this behaviour. I specifically allowed to feed the value to `type_of` from inside a call to `type_of`. In that case, the dep-graph will check that the fingerprints of both values match. This implementation is still very sensitive to cycles, and requires that we call `typeck(function)` before `typeck(anon const)`. The reason is that `typeck(anon const)` calls `type_of(anon const)`, which calls `typeck(function)`, which feeds `type_of(anon const)`, and needs to build the MIR so needs `typeck(anon const)`. The latter call would not cycle, since `type_of(anon const)` has been set, but I'd rather not remove the cycle check.
2023-04-21Auto merge of #110370 - c410-f3r:dqewdas, r=petrochenkovbors-0/+7
Move test files r? `@petrochenkov`
2023-04-20Move test filesCaio-0/+7
2023-04-20Give more descriptive names to queries.Camille GILLOT-2/+2
2023-04-16Account for variance in outlives verification.Camille GILLOT-21/+0
2023-04-16Add tests.Camille GILLOT-0/+72
2023-04-12Special-case item attributes in the suggestion outputEsteban Küber-14/+0
2023-04-12Tweak output for 'add line' suggestionEsteban Küber-14/+28
2023-04-12Split out a separate feature gate for impl trait in associated typesOli Scherer-78/+74
2023-04-06Remove index from BrAnonJack Huey-1/+1
2023-04-03Perform match checking on THIR.Camille GILLOT-0/+10
2023-03-30Rollup merge of #109509 - ehuss:overlapping-tests, r=Mark-SimulacrumYuki Okushi-0/+0
compiletest: Don't allow tests with overlapping prefix names Some tests will delete their output directory before starting. The output directory is based on the test names. If one test is the prefix of another test, then when that test starts, it could try to delete the output directory of the other test with the longer path, or otherwise clash with it while the two tests are trying to create/delete/modify the same directory. In practice, this manifested as a random error on macOS where two tests were trying to create/delete/create `rustdoc/primitive` and `rustdoc/primitive/no_std`, which resulted in an EINVAL (InvalidInput) error. This renames some of the offending tests, adds `compiletest-ignore-dir` to prevent compiletest from processing some files, and adds a check to prevent this from happening in the future. Fixes #109397
2023-03-29Bless some extra working tests under -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-0/+2
2023-03-29Properly skip RPITITs from ModChild and give a name in AssocItemSantiago Pastorino-1/+1
2023-03-29Walk return-position impl trait in trait deeply in associated_item_def_idsMichael Goulet-5/+16
2023-03-25Rollup merge of #109545 - compiler-errors:rpitit-wf, r=eholkMatthias Krüger-11/+36
Deeply check well-formedness of return-position `impl Trait` in trait Walk the bounds of RPITITs to see if we find any more RPITITs 😸
2023-03-23Deeply check WF for RPITITsMichael Goulet-11/+36
2023-03-23Nested impl traits trigger opaque_hidden_inferred_bound too muchMichael Goulet-36/+0
2023-03-22Rename tests to ensure they don't have overlapping names.Eric Huss-0/+0
Some tests will delete their output directory before starting. The output directory is based on the test names. If one test is the prefix of another test, then when that test starts, it could try to delete the output directory of the other test with the longer path.
2023-03-23Rollup merge of #109414 - spastorino:new-rpitit-16, r=compiler-errorsDylan DPC-3/+27
Do not consider synthesized RPITITs on missing items checks Without this patch for `tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs` we get ... ``` warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes --> tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs:4:12 | 4 | #![feature(return_position_impl_trait_in_trait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo`, `` --> tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs:12:1 | 8 | fn foo(&self) -> impl Sized; | ---------------------------- | | | | | `` from trait | `foo` from trait ... 12 | impl MyTrait for i32 { | ^^^^^^^^^^^^^^^^^^^^ missing `foo`, `` in implementation error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0046`. ``` instead of ... ``` warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12 | LL | #![feature(return_position_impl_trait_in_trait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo` --> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1 | LL | fn foo(&self) -> impl Sized; | ---------------------------- `foo` from trait ... LL | impl MyTrait for i32 { | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0046`. ``` r? `@compiler-errors`
2023-03-21Always encode RPITITsSantiago Pastorino-0/+2
2023-03-21Do not consider synthesized RPITITs on missing items checksSantiago Pastorino-3/+27
2023-03-21Rollup merge of #109240 - compiler-errors:dont-binder-twice, r=oli-obknils-0/+6
Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes #109239
2023-03-20Rollup merge of #109277 - spastorino:new-rpitit-14, r=compiler-errorsMatthias Krüger-1/+24
Fix generics_of for impl's RPITIT synthesized associated type The only useful commit is the last one. This makes `generics_of` for the impl side RPITIT copy from the trait's associated type and avoid the fn on the impl side which was previously wrongly used. This solution is better but we still need to fix resolution of the generated generics. r? ``@compiler-errors``
2023-03-20Walk un-shifted nested `impl Trait` in trait when setting up default trait ↵Michael Goulet-0/+6
method assumptions
2023-03-18Rollup merge of #109238 - spastorino:new-rpitit-12, r=compiler-errorsMatthias Krüger-1/+16
Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty This PR stops reporting errors due to different count of generics on the new synthesized associated types for RPITITs. Those were already reported when we compare the function on the triat with the function on the impl. r? ``@compiler-errors``
2023-03-17Fix generics_of for impl's RPITIT synthesized associated typeSantiago Pastorino-0/+8
2023-03-17Fix impl_trait_ty_to_ty substsSantiago Pastorino-1/+16
2023-03-17Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed testsSantiago Pastorino-5/+51
2023-03-17Fix generics mismatch errors for RPITITs on ↵Santiago Pastorino-1/+16
-Zlower-impl-trait-in-trait-to-assoc-ty
2023-03-16Don't install default opaque projection predicates in RPITIT associated ↵Michael Goulet-3/+46
type's param-env
2023-03-16Install projection from RPITIT to default trait method opaque correctlyMichael Goulet-1/+14
2023-03-15Add revisions to fixed tests in -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-7/+90
2023-03-14Rollup merge of #108923 - spastorino:new-rpitit-9, r=compiler-errorsMatthias Krüger-0/+2
Make fns from other crates with RPITIT work for -Zlower-impl-trait-in-trait-to-assoc-ty Only the last two commits are meaningful. r? `@compiler-errors`