-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
(#13833)
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. Fix #9798 Fix #10508 Fix #11915 changelog: [`large_enum_variant`]: more precise detection of variants with large size differences
- Loading branch information
Showing
7 changed files
with
236 additions
and
7 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
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