mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
35 lines
436 B
Rust
35 lines
436 B
Rust
#![allow(dead_code)]
|
|
|
|
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());
|
|
}
|