summary refs log tree commit diff
path: root/src/test/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2022-11-20Add testMichael Goulet-0/+47
2022-10-28Rollup merge of #103608 - compiler-errors:rpitit-early-lt, r=cjgillotMatthias Krüger-0/+23
Remap early bound lifetimes in return-position `impl Trait` in traits too Fixes part of #103457 r? ``@cjgillot,`` though feel free to reassign, just thought you'd have sufficient context to review.
2022-10-27Remap early bound lifetimes tooMichael Goulet-0/+23
2022-10-26No need to probe when relating opaques in nll_relateMichael Goulet-0/+24
2022-10-25Name impl trait in region bound suggestionMichael Goulet-16/+16
2022-10-24Delay span bug when we can't map lifetimes back in collect_trait_impl_trait_tysMichael Goulet-0/+37
2022-10-23Rollup merge of #103414 - compiler-errors:rpit-print-lt, r=cjgillotMichael Howell-2/+2
Pretty print lifetimes captured by RPIT This specifically makes the output in #103409 change from: ```diff error: `impl` item signature doesn't match `trait` item signature --> $DIR/signature-mismatch.rs:15:5 | LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` ... LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` | = note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` - found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` + found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output error: aborting due to previous error ``` Along with the UI tests in this PR, which I think are all improvements! r? `@oli-obk` though feel free to re-roll
2022-10-23Rollup merge of #103368 - compiler-errors:normalization-ambiguity-bug, r=oli-obkMatthias Krüger-0/+135
Delay ambiguity span bug in normalize query iff not rustdoc Oli and I decided that the compiler debt of adding another usage of `tcx.sess.opts.actually_rustdoc` is fine, because we don't really want to add more complexity to the normalize query, and moving rustdoc to use fulfill normalization (`fully_normalize`, i.e. not use the normalize query) is unnecessary overhead given that it's skipping binders and stuff. r? oli-obk Fixes #102827 Fixes #103181
2022-10-22Pretty print lifetimes captured by RPITMichael Goulet-2/+2
2022-10-21testsMichael Goulet-0/+135
2022-10-21Handle RPITITs properly in register_hidden_typeMichael Goulet-13/+50
2022-10-20Auto merge of #103205 - spastorino:fix-rpits-lifetime-remapping, r=cjgillotbors-0/+23
Do anonymous lifetimes remapping correctly for nested rpits Closes #103141 r? `@cjgillot` `@nikomatsakis` This fixes a stable to stable regression that in my opinion is `P-critical` so, we probably want to backport it all the way up to stable.
2022-10-20Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726bors-2/+6
Require lifetime bounds for opaque types in order to allow hidden types to capture said lifetimes fixes #96996 cc `@aliemjay`
2022-10-19Do anonymous lifetimes remapping correctly for nested rpitsSantiago Pastorino-0/+23
2022-10-18Clean up query descriptionsnils-4/+4
Use the same tense everywhere and prefer display over debug, as these descriptions are user facing.
2022-10-15Fix subst issues with RPITITMichael Goulet-0/+18
2022-10-14Require lifetime bounds for opaque types in order to allow hidden types to ↵Oli Scherer-2/+6
capture said lifetimes
2022-10-13Auto merge of #102700 - oli-obk:0xDEAD_TAIT, r=compiler-errorsbors-4/+11
Check hidden types in dead code fixes #99490 r? `@compiler-errors` best reviewed commit by commit
2022-10-12Add broken test for AFIT with RPITITMichael Goulet-0/+33
2022-10-07Unconditionally encode hidden types in typeck resultsOli Scherer-4/+11
2022-10-05Fix test for default body with implMichael Goulet-4/+10
2022-10-05Support default-body trait functions with RPITITMichael Goulet-0/+15
2022-10-04Rollup merge of #102648 - Rageking8:add-test-for-#102605, r=compiler-errorsMatthias Krüger-0/+56
Add test for #102605 Fixes #102605
2022-10-04Rollup merge of #102568 - compiler-errors:lint-unsatisfied-opaques, r=oli-obkDylan DPC-0/+108
Lint against nested opaque types that don't satisfy associated type bounds See the test failures for examples of places where this lint would fire. r? `@oli-obk`
2022-10-04add test for #102605Rageking8-0/+56
2022-10-02Avoid ICE in printing RPITIT typeMichael Goulet-0/+38
2022-10-02Make it a lint for all opaque typesMichael Goulet-0/+108
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-6/+6
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01bless ui testsMaybe Waffle-6/+6
2022-09-30Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Kibors-0/+20
Serialize return-position `impl Trait` in trait hidden values in foreign libraries Fixes #101630
2022-09-26address reviewb-naber-5/+5
2022-09-25Auto merge of #95474 - oli-obk:tait_ub, r=jackh726bors-0/+64
Neither require nor imply lifetime bounds on opaque type for well formedness The actual hidden type can live arbitrarily longer than any individual lifetime and arbitrarily shorter than all but one of the lifetimes. fixes #86218 fixes #84305 This is a **breaking change** but it is a necessary soundness fix
2022-09-25Rollup merge of #102194 - fee1-dead-contrib:improve-const-drop, r=oli-obkfee1-dead-3/+3
Note the type when unable to drop values in compile time
2022-09-24Note the type when unable to drop values in compile timeDeadbeef-3/+3
2022-09-23Report diagnostics at the actually actionable siteOli Scherer-11/+38
2022-09-23Showcase a broken diagnosticOli Scherer-4/+4
2022-09-23Serialize RPITIT values in libsMichael Goulet-0/+20
2022-09-22Calculate ProjectionTy::trait_def_id correctlyMichael Goulet-0/+59
2022-09-21Improve diagnostic for adding more bounds to opaque typesOli Scherer-4/+6
2022-09-21Reproduce sad diagnosticOli Scherer-0/+35
2022-09-13Auto merge of #101086 - cjgillot:thir-param, r=oli-obkbors-0/+10
Compute information about function parameters on THIR This avoids some manipulation of typeck results while building MIR.
2022-09-13Simplify MIR building entry.Camille GILLOT-0/+10
2022-09-13Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obkbors-10/+5
Make `compare_predicate_entailment` no longer a query Make `compare_predicate_entailment` so it's no longer a query (again), and splits out the new logic (that equates the return types to infer RPITITs) into its own query. This means that this new query (now called `collect_trait_impl_trait_tys`) is no longer executed for non-RPITIT cases. This should improve perf (https://github.com/rust-lang/rust/pull/101224#issuecomment-1241682203), though in practice we see that these some crates remain from the primary regressions list on the original report... They are all <= 0.43% regression and seemingly only on the incr-full scenario for all of them. I am at a loss for what might be causing this regression other than what I fixed here, since we don't introduce much new non-RPITIT logic except for some `def_kind` query calls in some places, for example, like projection. Maybe that's it? ---- Originally this PR was opened to test enabling `cache_on_disk` (62164aaaa11) but that didn't turn out to be very useful (https://github.com/rust-lang/rust/pull/101615#issuecomment-1242403205), so that led me to just split the query (and rename the PR).
2022-09-12A SubstitutionPart is not a deletion if it replaces nothing with nothingMichael Goulet-3/+2
2022-09-12Rollup merge of #101681 - compiler-errors:rpitit-obj-safety, r=lcnrDylan DPC-0/+72
Deny return-position `impl Trait` in traits for object safety Fixes #101667
2022-09-12Rollup merge of #101676 - compiler-errors:rpitit-wf, r=lcnrDylan DPC-0/+49
Check that the types in return position `impl Trait` in traits are well-formed This effectively duplicates `check_associated_type_bounds`, but that shouldn't be for long, since we're going to remove it once we refactor RPITITs into regular associated items. Fixes #101663 --- We don't check ```rust trait Foo { fn bar() -> impl ?Sized; } ``` currently, but that's for a different reason, which is that we don't currently check that a trait function's return type is sized (i.e. `fn bar() -> [u8]` also works in a trait).
2022-09-11Only encode RPITIT when trait method has default bodyMichael Goulet-0/+9
2022-09-11Deny RPITIT for object safetyMichael Goulet-0/+72
2022-09-11Check that the types in RPITITs are WFMichael Goulet-0/+49
2022-09-10split compare_predicate_entailment and collect_trait_impl_trait_tys outMichael Goulet-10/+5