forked from rust-lang/rust
-
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.
Rollup merge of rust-lang#81055 - matthewjasper:non-fatal-overflow, r…
…=nikomatsakis Make hitting the recursion limit in projection non-fatal This change was originally made in rust-lang#80246 to avoid future (effectively) infinite loop bugs in projections, but wundergraph relies on rustc recovering here. cc rust-lang#80953 r? `@nikomatsakis`
- Loading branch information
Showing
4 changed files
with
63 additions
and
13 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
58 changes: 58 additions & 0 deletions
58
src/test/ui/associated-types/project-recursion-limit-non-fatal.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,58 @@ | ||
// Regression test for #80953. Hitting the recursion limit in projection | ||
// is non-fatal. The above code, minimised from wundergraph shows a case | ||
// where this is relied on. | ||
|
||
// check-pass | ||
|
||
struct AlternateTable {} | ||
struct AlternateQuery {} | ||
|
||
pub trait Query {} | ||
pub trait AsQuery { | ||
type Query; | ||
} | ||
impl<T: Query> AsQuery for T { | ||
type Query = Self; | ||
} | ||
impl AsQuery for AlternateTable { | ||
type Query = AlternateQuery; | ||
} | ||
|
||
pub trait Table: AsQuery { | ||
type PrimaryKey; | ||
} | ||
impl Table for AlternateTable { | ||
type PrimaryKey = (); | ||
} | ||
|
||
pub trait FilterDsl<Predicate> { | ||
type Output; | ||
} | ||
pub type Filter<Source, Predicate> = <Source as FilterDsl<Predicate>>::Output; | ||
impl<T, Predicate> FilterDsl<Predicate> for T | ||
where | ||
T: Table, | ||
T::Query: FilterDsl<Predicate>, | ||
{ | ||
type Output = Filter<T::Query, Predicate>; | ||
} | ||
impl<Predicate> FilterDsl<Predicate> for AlternateQuery { | ||
type Output = &'static str; | ||
} | ||
|
||
pub trait HandleDelete { | ||
type Filter; | ||
} | ||
impl<T> HandleDelete for T | ||
where | ||
T: Table, | ||
T::Query: FilterDsl<T::PrimaryKey>, | ||
Filter<T::Query, T::PrimaryKey>: , | ||
{ | ||
type Filter = Filter<T::Query, T::PrimaryKey>; | ||
} | ||
|
||
fn main() { | ||
let x: <AlternateTable as HandleDelete>::Filter = "Hello, world"; | ||
println!("{}", x); | ||
} |
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