diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/run-make-fulldeps/obtain-borrowck/test.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/obtain-borrowck/test.rs b/src/test/run-make-fulldeps/obtain-borrowck/test.rs new file mode 100644 index 000000000..f7b4b41fe --- /dev/null +++ b/src/test/run-make-fulldeps/obtain-borrowck/test.rs @@ -0,0 +1,32 @@ +trait X { + fn provided(&self) -> usize { + 5 + } + fn required(&self) -> u32; +} + +struct Bar; + +impl Bar { + fn new() -> Self { + Self + } +} + +impl X for Bar { + fn provided(&self) -> usize { + 1 + } + fn required(&self) -> u32 { + 7 + } +} + +const fn foo() -> usize { + 1 +} + +fn main() { + let bar: [Bar; foo()] = [Bar::new()]; + assert_eq!(bar[0].provided(), foo()); +} |