summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2025-03-28Rollup merge of #139063 - fmease:fix-tait-atpit-gating, r=oli-obkMatthias Krüger-1/+39
Fix TAIT & ATPIT feature gating in the presence of anon consts Fixes #139055 (https://github.com/rust-lang/rust/issues/119924#issuecomment-1928659690). r? oli-obk or anybody else
2025-03-28Fix TAIT & ATPIT feature gating in the presence of anon constsLeón Orell Valerian Liehr-1/+39
2025-03-25Rollup merge of #138911 - compiler-errors:define-opaque, r=oli-obkJacob Pratt-0/+42
Allow defining opaques in statics and consts r? oli-obk Fixes https://github.com/rust-lang/rust/issues/138902
2025-03-25Test define opaques in extern itemsMichael Goulet-0/+30
2025-03-25Allow defining opaques in statics and constsMichael Goulet-0/+12
2025-03-23Stabilize precise_capturing_in_traitsMichael Goulet-37/+20
2025-03-19merge opaque types of nested bodieslcnr-39/+6
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-254/+360
2025-03-05Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk许杰友 Jieyou Xu (Joe)-15/+0
Remove unsizing coercions for tuples See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification. Tracking issue: #42877 Fixes: #135217
2025-03-03Do not recover missing lifetime with random in-scope lifetimeMichael Goulet-48/+11
2025-02-27Delete tuple unsizingAlice Ryhl-15/+0
2025-02-27Rollup merge of #137304 - pitaj:rangebounds-is_empty-intersect, r=ibraheemdevMatthias Krüger-1/+2
add `IntoBounds::intersect` and `RangeBounds::is_empty` - ACP: https://github.com/rust-lang/libs-team/issues/539 - Tracking issue for `is_empty`: #137300 - Tracking issue for `IntoBounds`: #136903
2025-02-22Auto merge of #137406 - matthiaskrgr:rollup-9nknrsb, r=matthiaskrgrbors-51/+19
Rollup of 8 pull requests Successful merges: - #136458 (Do not deduplicate list of associated types provided by dyn principal) - #136474 ([`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing) - #136592 (Make sure we don't overrun the stack in canonicalizer) - #136787 (Remove `lifetime_capture_rules_2024` feature) - #137207 (Add #[track_caller] to Duration Div impl) - #137245 (Tweak E0277 when predicate comes indirectly from ?) - #137257 (Ignore fake borrows for packed field check) - #137399 (fix ICE in layout computation with unnormalizable const) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-22Rollup merge of #136787 - compiler-errors:lt2024feat, r=oli-obkMatthias Krüger-51/+19
Remove `lifetime_capture_rules_2024` feature Just use edition 2024 instead
2025-02-21More sophisticated span trimmingMichael Goulet-18/+12
2025-02-19add `IntoBounds::intersect` and `RangeBounds::is_empty`Peter Jaszkowiak-1/+2
2025-02-17Deeply normalize associated type bounds before proving themMichael Goulet-0/+6
2025-02-14Rollup merge of #136971 - HypheX:patch1, r=WaffleLapkinJubilee-0/+37
Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait` This PR closes #107883 by adding a ui test.
2025-02-14Add new ui test for returning an Fn trait that returns impl TraitXelph-0/+37
Change description from compiletest to regression test Co-authored-by: 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> Improve test name, location, and description Update tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs Co-authored-by: waffle <waffle.lapkin@gmail.com>
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-6/+6
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-18/+12
2025-02-13Rollup merge of #136928 - lcnr:method-lookup-check-wf, r=compiler-errorsJubilee-21/+21
eagerly prove WF when resolving fully qualified paths fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/161. This hopefully shouldn't impact perf. I do think we need to deal with at least part of the fallout here, opening for vibes. r? ``@compiler-errors``
2025-02-14fallout :skull_emoji:lcnr-21/+21
2025-02-13adjust derive_errorlcnr-4/+18
2025-02-11Reject `impl Trait` bounds in various places where we unconditionally warned ↵Oli Scherer-0/+27
since 1.0
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-139/+211
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-09Remove lifetime_capture_rules_2024 featureMichael Goulet-51/+19
2025-02-08Auto merge of #136713 - matthiaskrgr:rollup-sy6py39, r=matthiaskrgrbors-0/+37
Rollup of 7 pull requests Successful merges: - #135179 (Make sure to use `Receiver` trait when extracting object method candidate) - #136554 (Add `opt_alias_variances` and use it in outlives code) - #136556 ([AIX] Update tests/ui/wait-forked-but-failed-child.rs to accomodate exiting and idle processes.) - #136589 (Enable "jump to def" feature on rustc docs) - #136615 (sys: net: Add UEFI stubs) - #136635 (Remove outdated `base_port` calculation in std net test) - #136682 (Move two windows process tests to tests/ui) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-07Rollup merge of #136554 - compiler-errors:opt-alias-variances, r=lcnrMatthias Krüger-0/+37
Add `opt_alias_variances` and use it in outlives code ...so to fix some subtle outlives bugs with precise capturing in traits, and eventually make it easier to compute variances for "forced unconstrained" trait lifetimes. r? lcnr
2025-02-06remove `feature(trait_upcasting)` from tests and bless themWaffle Lapkin-3/+1
2025-02-06Add opt_alias_variances and use it in outlives codeMichael Goulet-0/+37
2025-02-06Rollup merge of #136073 - compiler-errors:recursive-coro-always, r=oli-obkMatthias Krüger-5/+2
Always compute coroutine layout for eagerly emitting recursive layout errors Detect recursive coroutine layouts even if we don't detect opaque type recursion in the new solver. This is for two reasons: 1. It helps us detect (bad) recursive async function calls in the new solver, which due to its approach to normalization causes us to not detect this via a recursive RPIT (since the opaques are more eagerly revealed in the opaque body). * Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/137. 2. It helps us detect (bad) recursive async functions behind AFITs. See the AFIT test that changed for the old solver too. 3. It also greatly simplifies the recursive impl trait check, since I can remove some jankness around how it handles coroutines.
2025-02-05Rollup merge of #136550 - compiler-errors:rpitit-empty-body, r=oli-obkJubilee-0/+23
Fix `rustc_hidden_type_of_opaques` for RPITITs with no default body Needed this when debugging something
2025-02-05Eagerly detect coroutine recursion pre-mono when possibleMichael Goulet-5/+2
2025-02-04Fix rustc_hidden_type_of_opaques for RPITITs with no default bodyMichael Goulet-0/+23
2025-02-03Make error message less awkwardMichael Goulet-15/+15
2025-02-03Check Sizedness of return type in WFMichael Goulet-156/+186
2025-02-02Rollup merge of #136415 - estebank:highlight-clarification, r=compiler-errorsMatthias Krüger-4/+4
Highlight clarifying information in "expected/found" error When the expected and found types have the same textual representation, we add clarifying in parentheses. We now visually highlight it in the output. Detect a corner case where the clarifying information would be the same for both types and skip it, as it doesn't add anything useful. ![Screenshot of the rustc highlighted output on the terminal](https://github.com/user-attachments/assets/aa4b9433-5332-4941-b2c2-1a43e5cadff7)
2025-02-02Highlight clarifying information in "expected/found" errorEsteban Küber-4/+4
When the expected and found types have the same textual representation, we add clarifying in parentheses. We now visually highlight it in the output. Detect a corner case where the clarifying information would be the same for both types and skip it, as it doesn't add anything useful.
2025-02-01Rollup merge of #135900 - compiler-errors:derive-wf, r=lcnrMatthias Krüger-0/+5
Manually walk into WF obligations in `BestObligation` proof tree visitor When we encounter a `WellFormed` obligation in the `BestObligation` proof tree visitor, ignore the proof tree and call `wf::unnormalized_obligations` to derive well-formed obligations with the correct cause codes. This is to avoid having to replicate the somewhat delicate logic that `wf.rs` does to set up its obligation causes... Don't see a better way to do this. vibes?? r? lcnr
2025-01-31Auto merge of #136350 - matthiaskrgr:rollup-6eqfyvh, r=matthiaskrgrbors-12/+12
Rollup of 9 pull requests Successful merges: - #134531 ([rustdoc] Add `--extract-doctests` command-line flag) - #135860 (Compiler: Finalize dyn compatibility renaming) - #135992 (Improve documentation when adding a new target) - #136194 (Support clobber_abi in BPF inline assembly) - #136325 (Delay a bug when indexing unsized slices) - #136326 (Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`) - #136330 (Remove unnecessary hooks) - #136336 (Overhaul `rustc_middle::util`) - #136341 (Remove myself from vacation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31Manually walk into WF obligations in BestObligation proof tree visitorMichael Goulet-0/+5
2025-01-31Rollup merge of #135860 - fmease:compiler-mv-obj-save-dyn-compat-ii, r=jieyouxuMatthias Krüger-12/+12
Compiler: Finalize dyn compatibility renaming Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME. Follow-up to #130826. Part of #130852. ~~Blocking it on #133372.~~ (merged) r? ghost
2025-01-30Filter out RPITITs when suggesting unconstrained assoc type on too many genericsMichael Goulet-0/+31
2025-01-27Remove all dead files inside tests/ui/León Orell Valerian Liehr-52/+0
2025-01-26Compiler: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-12/+12
2025-01-25Auto merge of #133154 - estebank:issue-133137, r=wesleywiserbors-7/+13
Reword resolve errors caused by likely missing crate in dep tree Reword label and add `help`: ``` error[E0432]: unresolved import `some_novel_crate` --> f704.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` | = help: if you wanted to use a crate named `some_novel_crate`, use `cargo add some_novel_crate` to add it to your `Cargo.toml` ``` Fix #133137.
2025-01-24Reword "crate not found" resolve messageEsteban Küber-7/+13
``` error[E0432]: unresolved import `some_novel_crate` --> file.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` ``` On resolve errors where there might be a missing crate, mention `cargo add foo`: ``` error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` --> $DIR/conflicting-impl-with-err.rs:4:11 | LL | impl From<nope::Thing> for Error { | ^^^^ use of unresolved module or unlinked crate `nope` | = help: if you wanted to use a crate named `nope`, use `cargo add nope` to add it to your `Cargo.toml` ```
2025-01-23Rollup merge of #135492 - metamuffin:bug-invalid-await-suggest, ↵Matthias Krüger-9/+0
r=compiler-errors Add missing check for async body when suggesting await on futures. Currently the compiler suggests adding `.await` to resolve some type conflicts without checking if the conflict happens in an async context. This can lead to the compiler suggesting `.await` in function signatures where it is invalid. Example: ```rs trait A { fn a() -> impl Future<Output = ()>; } struct B; impl A for B { fn a() -> impl Future<Output = impl Future<Output = ()>> { async { async { () } } } } ``` ``` error[E0271]: expected `impl Future<Output = impl Future<Output = ()>>` to be a future that resolves to `()`, but it resolves to `impl Future<Output = ()>` --> bug.rs:6:15 | 6 | fn a() -> impl Future<Output = impl Future<Output = ()>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found future | note: calling an async function returns a future --> bug.rs:6:15 | 6 | fn a() -> impl Future<Output = impl Future<Output = ()>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `A::{synthetic#0}` --> bug.rs:2:27 | 2 | fn a() -> impl Future<Output = ()>; | ^^^^^^^^^^^ required by this bound in `A::{synthetic#0}` help: consider `await`ing on the `Future` | 6 | fn a() -> impl Future<Output = impl Future<Output = ()>>.await { | ++++++ ``` The documentation of suggest_await_on_expect_found (`compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:156`) even mentions such a check but does not actually implement it. This PR adds that check to ensure `.await` is only suggested within async blocks. There were 3 unit tests whose expected output needed to be changed because they had the suggestion outside of async. One of them (`tests/ui/async-await/dont-suggest-missing-await.rs`) actually tests that exact problem but expects it to be present. Thanks to `@llenck` for initially noticing the bug and helping with fixing it
2025-01-22Rollup merge of #135816 - BoxyUwU:root_normalizes_to_goal_ice, r=lcnrMatthias Krüger-5/+38
Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors r? `@lcnr` I added `structurally_normalize_term` so that code that is generic over ty or const can use the structurally normalize helpers. See `tests/ui/traits/next-solver/diagnostics/alias_relate_error_uses_structurally_normalize.rs` for a description of the reason for the (now fixed) ICEs