summary refs log tree commit diff
path: root/tests/rustdoc/impossible-default.rs
blob: c9444004d5c75df03f90faaf73e93129aaf1cfca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#![crate_name = "foo"]

// Check that default trait items that are impossible to satisfy

pub trait Foo {
    fn needs_sized(&self)
    where
        Self: Sized,
    {}

    fn no_needs_sized(&self) {}
}

//@ !has foo/struct.Bar.html '//*[@id="method.needs_sized"]//h4[@class="code-header"]' \
// "fn needs_sized"
//@ has foo/struct.Bar.html '//*[@id="method.no_needs_sized"]//h4[@class="code-header"]' \
// "fn no_needs_sized"
pub struct Bar([u8]);

impl Foo for Bar {}

//@ has foo/struct.Generic.html '//*[@id="method.needs_sized"]//h4[@class="code-header"]' \
// "fn needs_sized"
//@ has foo/struct.Generic.html '//*[@id="method.no_needs_sized"]//h4[@class="code-header"]' \
// "fn no_needs_sized"
pub struct Generic<T: ?Sized>(T);

impl<T: ?Sized> Foo for Generic<T> {}