diff options
| author | Michael Goulet <michael@errs.io> | 2023-02-21 02:01:26 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-02-21 02:01:26 +0000 |
| commit | dfc4a580f2e03eea67d8739d1ac369a5ceef71b5 (patch) | |
| tree | 85bc0e94ca4fdd10bd533085e78607ffafd2e2f2 | |
| parent | 8f55d6025fec5fb648948fbe4fb6dcb4184c67bc (diff) | |
| download | rust-dfc4a580f2e03eea67d8739d1ac369a5ceef71b5.tar.gz rust-dfc4a580f2e03eea67d8739d1ac369a5ceef71b5.zip | |
Add a test for default trait method with RPITITs
| -rw-r--r-- | tests/ui/impl-trait/in-trait/default-method-constraint.rs | 17 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/default-method-constraint.stderr | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs new file mode 100644 index 00000000000..8c50cc29586 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs @@ -0,0 +1,17 @@ +// check-pass + +// This didn't work in the previous default RPITIT method hack attempt + +#![feature(return_position_impl_trait_in_trait)] +//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete + +trait Foo { + fn bar(x: bool) -> impl Sized { + if x { + let _: u32 = Self::bar(!x); + } + Default::default() + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.stderr b/tests/ui/impl-trait/in-trait/default-method-constraint.stderr new file mode 100644 index 00000000000..5e18605aa4c --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-method-constraint.rs:5: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 + +warning: 1 warning emitted + |
