forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#102254 - matthiaskrgr:rollup-gitu6li, r=matth…
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#102016 (implied_bounds: deal with inference vars) - rust-lang#102161 (Resolve async fn signature even without body (e.g., in trait)) - rust-lang#102216 (rustdoc: Stabilize --diagnostic-width) - rust-lang#102240 (rustdoc: remove unused CSS `#main-content > .line-numbers`) - rust-lang#102242 (rustdoc: remove unused CSS `.summary`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
11 changed files
with
187 additions
and
80 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
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,46 @@ | ||
// check-pass | ||
// edition:2021 | ||
|
||
#![feature(async_fn_in_trait)] | ||
#![allow(incomplete_features)] | ||
|
||
use std::future::Future; | ||
|
||
async fn yield_now() {} | ||
|
||
trait AsyncIterator { | ||
type Item; | ||
async fn next(&mut self) -> Option<Self::Item>; | ||
} | ||
|
||
struct YieldingRange { | ||
counter: u32, | ||
stop: u32, | ||
} | ||
|
||
impl AsyncIterator for YieldingRange { | ||
type Item = u32; | ||
|
||
async fn next(&mut self) -> Option<Self::Item> { | ||
if self.counter == self.stop { | ||
None | ||
} else { | ||
let c = self.counter; | ||
self.counter += 1; | ||
yield_now().await; | ||
Some(c) | ||
} | ||
} | ||
} | ||
|
||
async fn async_main() { | ||
let mut x = YieldingRange { counter: 0, stop: 10 }; | ||
|
||
while let Some(v) = x.next().await { | ||
println!("Hi: {v}"); | ||
} | ||
} | ||
|
||
fn main() { | ||
let _ = async_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,50 @@ | ||
// Taken directly from that issue. | ||
// | ||
// This test detected that we didn't correctly resolve | ||
// inference variables when computing implied bounds. | ||
// | ||
// check-pass | ||
pub trait BuilderFn<'a> { | ||
type Output; | ||
} | ||
|
||
impl<'a, F, Out> BuilderFn<'a> for F | ||
where | ||
F: FnOnce(&'a mut ()) -> Out, | ||
{ | ||
type Output = Out; | ||
} | ||
|
||
pub trait ConstructionFirm { | ||
type Builder: for<'a> BuilderFn<'a>; | ||
} | ||
|
||
pub trait Campus<T> | ||
where | ||
T: ConstructionFirm, | ||
{ | ||
fn add_building( | ||
&mut self, | ||
building: &mut <<T as ConstructionFirm>::Builder as BuilderFn<'_>>::Output, | ||
); | ||
} | ||
|
||
struct ArchitectsInc {} | ||
|
||
impl ConstructionFirm for ArchitectsInc { | ||
type Builder = fn(&mut ()) -> PrettyCondo<'_>; | ||
} | ||
|
||
struct PrettyCondo<'a> { | ||
_marker: &'a mut (), | ||
} | ||
|
||
struct CondoEstate {} | ||
|
||
impl Campus<ArchitectsInc> for CondoEstate { | ||
fn add_building(&mut self, _building: &mut PrettyCondo<'_>) { | ||
todo!() | ||
} | ||
} | ||
|
||
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,11 @@ | ||
// check-pass | ||
// This is currently stable behavior, which was almost accidentally made an | ||
// error in #102161 since there is no test exercising it. I am not sure if | ||
// this _should_ be the desired behavior, but at least we should know if it | ||
// changes. | ||
|
||
fn main() {} | ||
|
||
trait Foo { | ||
fn fn_with_type_named_same_as_local_in_param(b: i32, b: i32); | ||
} |