summary refs log tree commit diff
path: root/src/test/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2021-05-30Auto merge of #83772 - jhpratt:revamp-step-trait, r=Mark-Simulacrumbors-2/+1
Make `Step` trait safe to implement This PR makes a few modifications to the `Step` trait that I believe better position it for stabilization in the short term. In particular, 1. `unsafe trait TrustedStep` is introduced, indicating that the implementation of `Step` for a given type upholds all stated invariants (which have remained unchanged). This is gated behind a new `trusted_step` feature, as stabilization is realistically blocked on min_specialization. 2. The `Step` trait is internally specialized on the `TrustedStep` trait, which avoids a serious performance regression. 3. `TrustedLen` is implemented for `T: TrustedStep` as the latter's invariants subsume the former's. 4. The `Step` trait is no longer `unsafe`, as the invariants must not be relied upon by unsafe code (unless the type implements `TrustedStep`). 5. `TrustedStep` is implemented for all types that implement `Step` in the standard library and compiler. 6. The `step_trait_ext` feature is merged into the `step_trait` feature. I was unable to find any reasoning for the features being split; the `_unchecked` methods need not necessarily be stabilized at the same time, but I think it is useful to have them under the same feature flag. All existing implementations of `Step` will be broken, as it is not possible to `unsafe impl` a safe trait. Given this trait only exists on nightly, I feel this breakage is acceptable. The blanket `impl<T: Step> TrustedLen for T` will likely cause some minor breakage, but this should be covered by the equivalent impl for `TrustedStep`. Hopefully these changes are sufficient to place `Step` in decent position for stabilization, which would allow user-defined types to be used with `a..b` syntax.
2021-05-26Unify feature flags as `step_trait`Jacob Pratt-1/+0
While stdlib implementations of the unchecked methods require unchecked math, there is no reason to gate it behind this for external users. The reasoning for a separate `step_trait_ext` feature is unclear, and as such has been merged as well.
2021-05-26bless compare-mode=nll outputNiko Matsakis-2/+2
2021-05-26stabilize member constraintsNiko Matsakis-33/+17
2021-05-26Make Range implementation safeJacob Pratt-1/+1
2021-05-16Add tracking issueJonas Schievink-0/+3
2021-05-16Allow `async {}` expressions in const contextsJonas Schievink-6/+15
2021-04-23Tweak suggestion outputEsteban Küber-0/+8
2021-04-08Suggest changing impl parameter types to match traitEsteban Küber-3/+8
This is particularly useful for cases where arbitrary self types are used, like in custom `Future`s.
2021-04-08Use more accurate spans for trait/impl method arg divergenceEsteban Küber-2/+2
2021-04-08Rollup merge of #83689 - estebank:cool-bears-hot-tip, r=davidtwcoDylan DPC-1/+5
Add more info for common trait resolution and async/await errors * Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases * Point at `impl` and type defs introducing requirements on E0277
2021-04-07rebase and update testsEsteban Küber-1/+5
2021-04-07Rollup merge of #83954 - estebank:issue-83613, r=varkorDylan DPC-4/+4
Do not ICE when closure is involved in Trait Alias Impl Trait Fix #83613.
2021-04-06Remove trailing `:` from E0119 messageEsteban Küber-4/+4
2021-04-06forbid `impl Trait` in generic param defaultsSNCPlay42-59/+133
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-25/+21
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-04-02Rollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebankDylan DPC-8/+8
give full path of constraint in suggest_constraining_type_param close https://github.com/rust-lang/rust/issues/83513
2021-04-02Auto merge of #80828 - SNCPlay42:opaque-projections, r=estebankbors-16/+49
Fix expected/found order on impl trait projection mismatch error fixes #68561 This PR adds a new `ObligationCauseCode` used when checking the concrete type of an impl trait satisfies its bounds, and checks for that cause code in the existing test to see if a projection's normalized type should be the "expected" or "found" type. The second commit adds a `peel_derives` to that test, which appears to be necessary in some cases (see projection-mismatch-in-impl-where-clause.rs, which would still give expected/found in the wrong order otherwise). This caused some other changes in diagnostics not involving impl trait, but they look correct to me.
2021-03-31give full path of constraint in suggest_constraining_type_paramhi-rustin-8/+8
revert file bless with nll mode
2021-03-20Move some tests to more reasonable directories - 5Caio-0/+79
2021-03-16peel derives when checking normalized is expectedSNCPlay42-0/+31
2021-03-16fix expected/found order on impl trait projection mismatchSNCPlay42-16/+18
2021-03-15Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no ↵Oli Scherer-39/+396
actual changes in behaviour This makes `type_alias_impl_trait` not actually do anything anymore
2021-03-12Make def_key and HIR parenting consistent.Camille GILLOT-1/+48
2021-02-06path trimming: ignore type aliasesDan Aloni-4/+4
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+501
Address comments Update limits
2021-01-07Use correct span for structured suggestionEsteban Küber-12/+12
On structured suggestion for `let` -> `const` and `const` -> `let`, use a proper `Span` and update tests to check the correct application. Follow up to #80012.
2021-01-07bless testsDaiki Ihara-4/+12
2020-11-16Add two regression testsAlex Macleod-0/+90
For #78721 and #78722
2020-10-27Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwcoYuki Okushi-1/+15
Use its own `TypeckResults` to avoid ICE Fixes #75962
2020-10-25Use its own `TypeckResults` to avoid ICEYuki Okushi-1/+15
2020-10-25Auto merge of #77546 - lcnr:impl-trait-closure, r=eddybbors-0/+21
fix def collector for impl trait fixes #77329 We now consistently make `impl Trait` a hir owner, requiring some special casing for synthetic generic params. r? `@eddyb`
2020-10-20review commentsEsteban Küber-2/+2
2020-10-20Tweak "object unsafe" errorsEsteban Küber-10/+22
Fix #77598.
2020-10-18Add test for issue-70877Yuki Okushi-0/+53
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+3
2020-10-09Add a regression test for issue-65581Yuki Okushi-0/+33
2020-10-07arg positionBastian Kauschke-0/+7
2020-10-07do not lower patterns in impl TraitBastian Kauschke-0/+14
2020-10-06Update to chalk 0.31. Implement some unimplemented. Ignore some tests in ↵Jack Huey-3/+6
compare mode chalk don't finish.
2020-10-06Fix tests from rebaseMatthew Jasper-2/+0
2020-10-06Fix bugs in evaluating WellFormed predicatesMatthew Jasper-0/+39
- List the nestsed obligations in an order that works with the single pass used by evaluation - Propagate recursion depth correctly
2020-10-06Check opaque types satisfy their boundsMatthew Jasper-4/+0
2020-09-30Auto merge of #77069 - sexxi-goose:closure_print_2, r=nikomatsakisbors-5/+5
pretty.rs: Update Closure and Generator print More detailed outline: https://github.com/rust-lang/project-rfc-2229/pull/17 Closes: https://github.com/rust-lang/project-rfc-2229/issues/11 r? `@nikomatsakis` cc `@eddyb` `@davidtwco` `@estebank`
2020-09-28pretty.rs: Update Closure and Generator printAman Arora-5/+5
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-26Call `type_of` for opaque types later in compilationMatthew Jasper-39/+72
This ensures that various wf checks have already been done before we typeck item bodies.
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-3/+3
2020-09-11Make suggestion more completeEsteban Küber-3/+9
2020-09-11Make suggestion have a more targetted underlineEsteban Küber-1/+1
2020-09-11Use structured suggestion for `impl T` to `Box<dyn T>`Esteban Küber-1/+4