forked from rust-lang/glacier
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
906e616
commit 98d7d79
Showing
4 changed files
with
88 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pub trait Trait<'a> { | ||
type Assoc; | ||
} | ||
|
||
struct Struct; | ||
impl<'a> Trait<'a> for Struct { | ||
type Assoc = &'a u32; | ||
} | ||
|
||
fn blah() -> impl for<'a> Trait<'a, Assoc = impl Sized> { | ||
Struct | ||
} |
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,17 @@ | ||
trait Trait<E> { | ||
type Assoc; | ||
} | ||
|
||
struct Foo; | ||
|
||
impl<'a> Trait<&'a ()> for Foo { | ||
type Assoc = (); | ||
} | ||
|
||
fn foo() -> impl for<'a> Trait<&'a ()> { | ||
Foo | ||
} | ||
|
||
fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> { | ||
foo() | ||
} |
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,25 @@ | ||
#!/bin/bash | ||
|
||
rustc --edition=2021 -Zdrop-tracking - <<'EOF' | ||
fn main() { | ||
let _ = foo(); | ||
} | ||
async fn from_config(_: Config) {} | ||
async fn foo() { | ||
from_config(Config { | ||
nickname: None, | ||
..Default::default() | ||
}) | ||
.await; | ||
} | ||
#[derive(Default)] | ||
struct Config { | ||
nickname: Option<Box<u8>>, | ||
} | ||
EOF | ||
|
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,34 @@ | ||
#!/bin/bash | ||
|
||
rustc --edition=2021 -Zdrop-tracking - <<'EOF' | ||
fn main() { | ||
let _ = foo(); | ||
} | ||
async fn from_config(x: Config) { | ||
async {}.await; | ||
drop(x); | ||
} | ||
async fn foo() { | ||
from_config(Config { | ||
nickname: NonCopy, | ||
..Default::default() | ||
}) | ||
.await; | ||
} | ||
#[derive(Default)] | ||
struct NonCopy; | ||
impl Drop for NonCopy { | ||
fn drop(&mut self) {} | ||
} | ||
#[derive(Default)] | ||
struct Config { | ||
nickname: NonCopy, | ||
} | ||
EOF | ||
|