-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
143 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// check-pass | ||
|
||
#![crate_type = "lib"] | ||
fn checkpoints() -> impl Iterator { | ||
Some(()).iter().flat_map(|_| std::iter::once(())) | ||
} | ||
|
||
fn block_checkpoints() -> impl Iterator { | ||
checkpoints() | ||
} | ||
|
||
fn iter_raw() -> impl Iterator { | ||
let mut iter = block_checkpoints(); | ||
|
||
(0..9).map(move |_| { | ||
iter.next(); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// check-pass | ||
|
||
fn ages() -> Option<impl Iterator> { | ||
None::<std::slice::Iter<()>> | ||
} | ||
|
||
fn main(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// check-pass | ||
// compile-flags: -Z mir-opt-level=3 | ||
#![feature(type_alias_impl_trait)] | ||
#![crate_type = "lib"] | ||
pub trait Tr { | ||
fn get(&self) -> u32; | ||
} | ||
|
||
impl Tr for (u32,) { | ||
#[inline] | ||
fn get(&self) -> u32 { self.0 } | ||
} | ||
|
||
pub fn tr1() -> impl Tr { | ||
(32,) | ||
} | ||
|
||
pub fn tr2() -> impl Tr { | ||
struct Inner { | ||
x: X, | ||
} | ||
type X = impl Tr; | ||
impl Tr for Inner { | ||
fn get(&self) -> u32 { | ||
self.x.get() | ||
} | ||
} | ||
|
||
Inner { | ||
x: tr1(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
fn enum_upvar() { | ||
type T = impl Copy; | ||
let foo: T = Some((1u32, 2u32)); | ||
let x = move || match foo { | ||
None => (), | ||
Some((a, b)) => (), | ||
}; | ||
} | ||
|
||
fn main(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// check-pass | ||
// compile-flags: -Zvalidate-mir | ||
trait Duh {} | ||
|
||
impl Duh for i32 {} | ||
|
||
trait Trait { | ||
type Assoc: Duh; | ||
} | ||
|
||
impl<R: Duh, F: FnMut() -> R> Trait for F { | ||
type Assoc = R; | ||
} | ||
|
||
fn foo() -> impl Trait<Assoc = impl Send> { | ||
|| 42 | ||
} | ||
|
||
fn main() {} |