diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-12-06 20:46:05 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-12-12 12:09:27 +0800 |
| commit | 5166f68754c58a898397e77650ae8817a2cfb9f2 (patch) | |
| tree | b668552f3304814b4d8e9ca0100bb401f038a381 /src | |
| parent | e70e4d499dd9dd1f7ff3717b9d91ca5dd0757143 (diff) | |
| download | rust-5166f68754c58a898397e77650ae8817a2cfb9f2.tar.gz rust-5166f68754c58a898397e77650ae8817a2cfb9f2.zip | |
Fix #91489
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.rs b/src/test/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.rs new file mode 100644 index 00000000000..79e62617ead --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.rs @@ -0,0 +1,18 @@ +// check-pass + +#![feature(const_trait_impl)] +#![feature(const_fn_trait_bound)] + +trait Convert<T> { + fn to(self) -> T; +} + +impl<A, B> const Convert<B> for A where B: ~const From<A> { + fn to(self) -> B { + B::from(self) + } +} + +const FOO: fn() -> String = || "foo".to(); + +fn main() {} \ No newline at end of file |
