2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2015-10-17 07:19:55 -05:00
|
|
|
fn types() {
|
|
|
|
let x: [ Vec < _ > ] = [];
|
|
|
|
let y: * mut [ SomeType ; konst_funk() ] = expr();
|
|
|
|
let z: (/*#digits*/ usize, /*exp*/ i16) = funk();
|
2015-10-17 08:56:53 -05:00
|
|
|
let z: ( usize /*#digits*/ , i16 /*exp*/ ) = funk();
|
2015-10-17 07:19:55 -05:00
|
|
|
}
|
2016-04-11 04:20:03 -05:00
|
|
|
|
|
|
|
struct F {
|
|
|
|
f: extern "C" fn(x: u8, ... /* comment */),
|
|
|
|
g: extern "C" fn(x: u8,/* comment */ ...),
|
|
|
|
h: extern "C" fn(x: u8, ... ),
|
|
|
|
i: extern "C" fn(x: u8, /* comment 4*/ y: String, // comment 3
|
|
|
|
z: Foo, /* comment */ .../* comment 2*/ ),
|
|
|
|
}
|
2016-05-26 17:39:28 -05:00
|
|
|
|
|
|
|
fn issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String) {}
|
2016-10-13 14:15:06 -05:00
|
|
|
|
|
|
|
fn impl_trait_fn_1() -> impl Fn(i32) -> Option<u8> {}
|
|
|
|
|
|
|
|
fn impl_trait_fn_2<E>() -> impl Future<Item=&'a i64,Error=E> {}
|
2017-01-05 21:06:09 -06:00
|
|
|
|
|
|
|
fn issue_1234() {
|
|
|
|
do_parse!(name: take_while1!(is_token) >> (Header))
|
|
|
|
}
|
2018-03-07 00:53:17 -06:00
|
|
|
|
|
|
|
// #2510
|
|
|
|
impl CombineTypes {
|
|
|
|
pub fn pop_callback(
|
|
|
|
&self,
|
|
|
|
query_id: Uuid,
|
|
|
|
) -> Option<
|
|
|
|
(
|
|
|
|
ProjectId,
|
|
|
|
Box<FnMut(&ProjectState, serde_json::Value, bool) -> () + Sync + Send>,
|
|
|
|
),
|
|
|
|
> {
|
|
|
|
self.query_callbacks()(&query_id)
|
|
|
|
}
|
|
|
|
}
|
2018-07-24 18:33:41 -05:00
|
|
|
|
|
|
|
// #2859
|
|
|
|
pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(&fooo: u32) -> impl Future<
|
|
|
|
Item = (
|
|
|
|
impl Future<Item = (
|
|
|
|
), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError > + 'a,
|
|
|
|
),
|
|
|
|
Error = SomeError,
|
|
|
|
>
|
|
|
|
+
|
|
|
|
'a {
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn do_something<'a, T: Trait1 + Trait2 + 'a>( &fooo: u32,
|
|
|
|
) -> impl Future<
|
|
|
|
Item = (
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
),
|
|
|
|
Error = SomeError,
|
|
|
|
>
|
|
|
|
+ Future<
|
|
|
|
Item = (
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
),
|
|
|
|
Error = SomeError,
|
|
|
|
>
|
|
|
|
+ Future<
|
|
|
|
Item = (
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
impl Future<Item = (), Error = SomeError> + 'a,
|
|
|
|
),
|
|
|
|
Error = SomeError,
|
|
|
|
>
|
|
|
|
+
|
|
|
|
'a + 'b +
|
|
|
|
'c {
|
|
|
|
}
|
2018-10-12 10:40:34 -05:00
|
|
|
|
2019-03-24 21:20:14 -05:00
|
|
|
// #3051
|
|
|
|
token![impl];
|
|
|
|
token![ impl ];
|
|
|
|
|
2018-10-12 10:40:34 -05:00
|
|
|
// #3060
|
|
|
|
macro_rules! foo {
|
|
|
|
($foo_api: ty) => {
|
|
|
|
type Target = ( $foo_api ) + 'static;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type Target = ( FooAPI ) + 'static;
|
2018-10-22 08:17:16 -05:00
|
|
|
|
2018-10-26 02:36:01 -05:00
|
|
|
// #3137
|
|
|
|
fn foo<T>(t: T)
|
|
|
|
where
|
|
|
|
T: ( FnOnce() -> () ) + Clone,
|
|
|
|
U: ( FnOnce() -> () ) + 'static,
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-10-22 08:17:16 -05:00
|
|
|
// #3117
|
|
|
|
fn issue3117() {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let opt: &mut Option<MyLongTypeHere> =
|
|
|
|
unsafe { &mut *self.future.get() };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-26 21:22:18 -05:00
|
|
|
|
|
|
|
// #3139
|
|
|
|
fn issue3139() {
|
|
|
|
assert_eq!(
|
|
|
|
to_json_value(&None :: <i32>).unwrap(),
|
|
|
|
json!( { "test": None :: <i32> } )
|
|
|
|
);
|
|
|
|
}
|
2018-11-18 06:31:40 -06:00
|
|
|
|
|
|
|
// #3180
|
|
|
|
fn foo(a: SomeLongComplexType, b: SomeOtherLongComplexType) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>> {
|
|
|
|
}
|
|
|
|
|
|
|
|
type MyFn = fn(a: SomeLongComplexType, b: SomeOtherLongComplexType,) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>>;
|
2020-03-31 01:28:01 -05:00
|
|
|
|
|
|
|
// Const opt-out
|
|
|
|
|
|
|
|
trait T: ? const Super {}
|
|
|
|
|
|
|
|
const fn maybe_const<S: ? const T>() -> i32 { <S as T>::CONST }
|
|
|
|
|
|
|
|
struct S<T:? const ? Sized>(std::marker::PhantomData<T>);
|
|
|
|
|
|
|
|
impl ? const T {}
|
|
|
|
|
|
|
|
fn trait_object() -> &'static dyn ? const T { &S }
|
|
|
|
|
|
|
|
fn i(_: impl IntoIterator<Item = Box<dyn ? const T>>) {}
|
|
|
|
|
|
|
|
fn apit(_: impl ?const T) {}
|
|
|
|
|
|
|
|
fn rpit() -> impl ? const T { S }
|
|
|
|
|
|
|
|
pub struct Foo<T: Trait>(T);
|
|
|
|
impl<T: ? const Trait> Foo<T> {
|
|
|
|
fn new(t: T) -> Self {
|
|
|
|
// not calling methods on `t`, so we opt out of requiring
|
|
|
|
// `<T as Trait>` to have const methods via `?const`
|
|
|
|
Self(t)
|
|
|
|
}
|
|
|
|
}
|
2020-09-08 22:52:52 -05:00
|
|
|
|
|
|
|
// #4357
|
|
|
|
type T = typeof(
|
|
|
|
1);
|
|
|
|
impl T for .. {
|
|
|
|
}
|