diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-09-29 12:15:17 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-11-24 15:57:40 +0800 |
| commit | e0c2ff7ccc0b0ffe095bbf7e1ae358d96bb9152f (patch) | |
| tree | 6110471eec615f2248bfac88cb852ee5f6e0178c /src | |
| parent | 3b25e92a8fbb5856499a84e02bf393a9c18eb962 (diff) | |
| download | rust-e0c2ff7ccc0b0ffe095bbf7e1ae358d96bb9152f.tar.gz rust-e0c2ff7ccc0b0ffe095bbf7e1ae358d96bb9152f.zip | |
Allow more cases to match ~const Drop.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs b/src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs new file mode 100644 index 00000000000..83fa32bf092 --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs @@ -0,0 +1,20 @@ +// check-pass + +#![feature(const_trait_impl)] +#![feature(const_fn_trait_bound)] +#![feature(const_precise_live_drops)] + +const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Drop { + match res { + Ok(t) => Some(t), + Err(_e) => None, + } +} + +pub struct Foo<T>(T); + +const fn baz<T: ~const Drop, E: ~const Drop>(res: Result<Foo<T>, Foo<E>>) -> Option<Foo<T>> { + foo(res) +} + +fn main() {} |
