lol no futures

This commit is contained in:
nora 2022-11-20 21:58:02 +01:00
parent 78ad7b4e50
commit fff0122f88
No known key found for this signature in database
2 changed files with 22 additions and 5 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "futures-rs"]
path = futures-rs
url = git@github.com:rust-lang/futures-rs.git

View file

@ -15,7 +15,7 @@ impl<T> Future for JoinHandle<T> {
} }
} }
pub fn spawn<T: Future>(future: T) -> JoinHandle<T::Output> { pub fn spawn<T>(future: T) -> JoinHandle<T> {
loop {} loop {}
} }
@ -140,7 +140,7 @@ mod fut {
fn main() { fn main() {
let bodies = fut::iter([]) let bodies = fut::iter([])
.map(|url: String| spawn(async { Result::Ok(url) })) .map(|url: String| spawn(Result::Ok(url)))
.buffer_unordered(0); .buffer_unordered(0);
bodies.for_each(|b| async { bodies.for_each(|b| async {
@ -151,3 +151,23 @@ fn main() {
} }
}); });
} }
/*
capture1 = CapturedPlace {
place: Place {
base_ty: std::result::Result<std::result::Result<std::string::String, _>, ()>,
base: Upvar(UpvarId(HirId { owner: OwnerId { def_id: DefId(0:100 ~ ice_104649[7838]::main) }, local_id: 40 };`b`;DefId(0:104 ~ ice_104649[7838]::main::{closure#1}::{closure#0}))),
projections: [Projection { ty: (), kind: Field(0, 1) }]
},
info: CaptureInfo { capture_kind_expr_id: Some(HirId { owner: OwnerId { def_id: DefId(0:100 ~ ice_104649[7838]::main) }, local_id: 45 }), path_expr_id: Some(HirId { owner: OwnerId { def_id: DefId(0:100 ~ ice_104649[7838]::main) }, local_id: 45 }), capture_kind: ByRef(ImmBorrow) },
mutability: Not, region: Some('_#8r)
}
capture2 = CapturedPlace {
place: Place {
base_ty: std::result::Result<std::result::Result<std::string::String, _>, ()>,
base: Upvar(UpvarId(HirId { owner: OwnerId { def_id: DefId(0:100 ~ ice_104649[7838]::main) },local_id: 40 };`b`;DefId(0:104 ~ ice_104649[7838]::main::{closure#1}::{closure#0}))),
projections: [Projection { ty: std::result::Result<std::string::String, _>, kind: Field(0, 0) }, Projection { ty: std::string::String, kind: Field(0, 0) }]
},
info: CaptureInfo { capture_kind_expr_id: Some(HirId { owner: OwnerId { def_id: DefId(0:100 ~ ice_104649[7838]::main) }, local_id: 45 }), path_expr_id: Some(HirId { owner: OwnerId { def_id: DefId(0:100 ~ ice_104649[7838]::main) }, local_id: 45 }), capture_kind: ByValue },
mutability: Not, region: None
}
*/