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
|
|
|
|
2023-04-24 12:42:39 -05:00
|
|
|
// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(/* private fields */) where A: MyTrait"
|
2023-06-22 10:39:23 -05:00
|
|
|
// @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;
|
2022-08-31 10:05:46 -05:00
|
|
|
// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait"
|
2023-06-22 10:39:23 -05:00
|
|
|
// @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); }
|
2022-08-31 10:05:46 -05:00
|
|
|
// @has foo/fn.charlie.html '//pre' "pub fn charlie<C>()where C: MyTrait"
|
2023-06-22 10:39:23 -05:00
|
|
|
// @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);
|
|
|
|
|
2023-01-28 17:35:02 -06: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"
|
2023-06-22 10:39:23 -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);
|
|
|
|
|
2022-04-08 10:33:40 -05:00
|
|
|
// @has 'foo/struct.Simd.html'
|
2023-01-30 12:05:12 -06:00
|
|
|
// @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;
|
|
|
|
|
|
|
|
// @has 'foo/trait.TraitWhere.html'
|
2023-01-30 12:05:12 -06:00
|
|
|
// @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
|
|
|
}
|
|
|
|
|
2023-01-28 17:35:02 -06: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"
|
2022-09-25 15:52:26 -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) }
|
|
|
|
|
2023-01-28 17:35:02 -06: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"
|
2022-09-25 15:52:26 -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
|
|
|
|
2023-01-30 12:05:12 -06: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)"
|
2023-06-22 10:39:23 -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);
|