-
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.
Make sure to insert Sized bound first into clauses list
- Loading branch information
1 parent
dd5e502
commit f2fd2d8
Showing
3 changed files
with
39 additions
and
3 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
30 changes: 30 additions & 0 deletions
30
tests/ui/methods/probe-overflow-due-to-sized-predicate-ordering.rs
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,30 @@ | ||
//@ check-pass | ||
// Regression test due to #123279 | ||
|
||
pub trait Job: AsJob { | ||
fn run_once(&self); | ||
} | ||
|
||
impl<F: Fn()> Job for F { | ||
fn run_once(&self) { | ||
todo!() | ||
} | ||
} | ||
|
||
pub trait AsJob {} | ||
|
||
// Ensure that `T: Sized + Job` by reordering the explicit `Sized` to where | ||
// the implicit sized pred would go. | ||
impl<T: Job + Sized> AsJob for T {} | ||
|
||
pub struct LoopingJobService { | ||
job: Box<dyn Job>, | ||
} | ||
|
||
impl Job for LoopingJobService { | ||
fn run_once(&self) { | ||
self.job.run_once() | ||
} | ||
} | ||
|
||
fn main() {} |