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
c52b15e
commit 93543f3
Showing
3 changed files
with
75 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,21 @@ | ||
#!/bin/sh | ||
|
||
rustc --edition=2021 - << EOF | ||
pub enum Request { | ||
Resolve { | ||
url: String, | ||
}, | ||
} | ||
pub async fn handle_event( | ||
event: Request, | ||
) { | ||
async move { | ||
let Request::Resolve { url } = event; | ||
}.await; | ||
} | ||
pub fn main() {} | ||
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,17 @@ | ||
#!/bin/sh | ||
|
||
rustc --edition=2021 - << EOF | ||
pub enum Request { | ||
Resolve { url: String }, | ||
} | ||
pub fn handle_event(event: Request) { | ||
(move || { | ||
let Request::Resolve { url: _url } = event; | ||
})(); | ||
} | ||
pub fn main() {} | ||
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,37 @@ | ||
use std::ops::Deref; | ||
|
||
trait MyTrait: Deref<Target = u32> {} | ||
|
||
struct MyStruct(u32); | ||
|
||
impl MyTrait for MyStruct {} | ||
|
||
impl Deref for MyStruct { | ||
type Target = u32; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&self.0 | ||
} | ||
} | ||
|
||
fn get_concrete_value(i: u32) -> MyStruct { | ||
MyStruct(i) | ||
} | ||
|
||
fn get_boxed_value(i: u32) -> Box<dyn MyTrait> { | ||
Box::new(get_concrete_value(i)) | ||
} | ||
|
||
fn main() { | ||
let v = [1, 2, 3] | ||
.iter() | ||
.map(|i| get_boxed_value(*i)) | ||
.collect::<Vec<_>>(); | ||
|
||
let el = &v[0]; | ||
|
||
for _ in v { | ||
// this triggers bug | ||
println!("{}", ***el > 0); | ||
} | ||
} |