2015-04-06 15:49:30 -05:00
|
|
|
#![crate_name = "foo"]
|
|
|
|
|
2022-09-21 12:01:49 -05:00
|
|
|
use std::io::Lines;
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
pub trait MyTrait { fn dummy(&self) { } }
|
2014-09-25 04:01:42 -05:00
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(/* private fields */) where A: MyTrait"
|
|
|
|
//@ snapshot alpha_trait_decl - '//*[@class="rust item-decl"]/code'
|
2015-02-12 09:29:52 -06:00
|
|
|
pub struct Alpha<A>(A) where A: MyTrait;
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait"
|
|
|
|
//@ snapshot bravo_trait_decl - '//*[@class="rust item-decl"]/code'
|
2015-02-12 09:29:52 -06:00
|
|
|
pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); }
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/fn.charlie.html '//pre' "pub fn charlie<C>()where C: MyTrait"
|
|
|
|
//@ snapshot charlie_fn_decl - '//*[@class="rust item-decl"]/code'
|
2014-09-25 04:01:42 -05:00
|
|
|
pub fn charlie<C>() where C: MyTrait {}
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
pub struct Delta<D>(D);
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.Delta.html '//*[@class="impl"]//h3[@class="code-header"]' \
|
2022-08-31 10:05:46 -05:00
|
|
|
// "impl<D> Delta<D>where D: MyTrait"
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ snapshot SWhere_Echo_impl - '//*[@id="impl-Delta%3CD%3E"]/h3[@class="code-header"]'
|
2014-09-25 04:01:42 -05:00
|
|
|
impl<D> Delta<D> where D: MyTrait {
|
|
|
|
pub fn delta() {}
|
|
|
|
}
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
pub struct Echo<E>(E);
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has 'foo/struct.Simd.html'
|
|
|
|
//@ snapshot SWhere_Simd_item-decl - '//pre[@class="rust item-decl"]'
|
2022-04-08 10:33:40 -05:00
|
|
|
pub struct Simd<T>([T; 1])
|
|
|
|
where
|
|
|
|
T: MyTrait;
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has 'foo/trait.TraitWhere.html'
|
|
|
|
//@ snapshot SWhere_TraitWhere_item-decl - '//pre[@class="rust item-decl"]'
|
2022-04-08 10:33:40 -05:00
|
|
|
pub trait TraitWhere {
|
|
|
|
type Item<'a> where Self: 'a;
|
2022-09-21 12:01:49 -05:00
|
|
|
|
|
|
|
fn func(self)
|
|
|
|
where
|
|
|
|
Self: Sized
|
|
|
|
{}
|
|
|
|
|
|
|
|
fn lines(self) -> Lines<Self>
|
|
|
|
where
|
|
|
|
Self: Sized,
|
|
|
|
{ todo!() }
|
2022-11-25 18:51:50 -06:00
|
|
|
|
|
|
|
fn merge<T>(self, a: T)
|
|
|
|
where
|
|
|
|
Self: Sized,
|
|
|
|
T: Sized,
|
|
|
|
{ todo!() }
|
2022-04-08 10:33:40 -05:00
|
|
|
}
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.Echo.html '//*[@class="impl"]//h3[@class="code-header"]' \
|
2022-08-31 10:05:46 -05:00
|
|
|
// "impl<E> MyTrait for Echo<E>where E: MyTrait"
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \
|
2022-08-31 10:05:46 -05:00
|
|
|
// "impl<E> MyTrait for Echo<E>where E: MyTrait"
|
|
|
|
impl<E> MyTrait for Echo<E>where E: MyTrait {}
|
2014-09-25 04:01:42 -05:00
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
pub enum Foxtrot<F> { Foxtrot1(F) }
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/enum.Foxtrot.html '//*[@class="impl"]//h3[@class="code-header"]' \
|
2022-08-31 10:05:46 -05:00
|
|
|
// "impl<F> MyTrait for Foxtrot<F>where F: MyTrait"
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \
|
2022-08-31 10:05:46 -05:00
|
|
|
// "impl<F> MyTrait for Foxtrot<F>where F: MyTrait"
|
|
|
|
impl<F> MyTrait for Foxtrot<F>where F: MyTrait {}
|
2015-05-25 16:05:35 -05:00
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/type.Golf.html '//pre[@class="rust item-decl"]' \
|
2022-08-31 10:05:46 -05:00
|
|
|
// "type Golf<T>where T: Clone, = (T, T)"
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ snapshot golf_type_alias_decl - '//*[@class="rust item-decl"]/code'
|
2015-05-25 16:05:35 -05:00
|
|
|
pub type Golf<T> where T: Clone = (T, T);
|