-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle more cases in
is_normalizable
By assuming that a recursive type is normalizable within the deeper calls to `is_normalizable_helper()`, more cases can be handled by this function. In order to fix stack overflows, a recursion limit has also been added for recursive generic type instantiations.
- Loading branch information
1 parent
42a0263
commit bd57421
Showing
6 changed files
with
174 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Used to overflow in `is_normalizable` | ||
|
||
use std::marker::PhantomData; | ||
|
||
struct Node<T: 'static> { | ||
m: PhantomData<&'static T>, | ||
} | ||
|
||
struct Digit<T> { | ||
elem: T, | ||
} | ||
|
||
enum FingerTree<T: 'static> { | ||
Single(T), | ||
|
||
Deep(Digit<T>, Box<FingerTree<Node<T>>>), | ||
} | ||
|
||
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,24 @@ | ||
use std::marker::PhantomData; | ||
|
||
struct Digit<T> { | ||
elem: T, | ||
} | ||
|
||
struct Node<T: 'static> { | ||
m: PhantomData<&'static T>, | ||
} | ||
|
||
enum FingerTree<T: 'static> { | ||
Single(T), | ||
|
||
Deep(Digit<T>, Node<FingerTree<Node<T>>>), | ||
} | ||
|
||
enum Wrapper<T: 'static> { | ||
Simple, | ||
Other(FingerTree<T>), | ||
} | ||
|
||
fn main() { | ||
let w = Some(Wrapper::Simple::<u32>); | ||
} |
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,7 @@ | ||
#[derive(Debug)] | ||
struct S<T> { | ||
t: T, | ||
s: Box<S<fn(u: T)>>, | ||
} | ||
|
||
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
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