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