-
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.
Auto merge of #6866 - anall:ice6840, r=flip1995
Fix ICE 6840 - make is_normalizable more strict fixes #6840 make `is_normalizable` more strict, which should catch this ICE and related cases changelog: Fix ICE in [`zero_sized_map_values`]
- Loading branch information
Showing
2 changed files
with
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! This is a reproducer for the ICE 6840: https://github.com/rust-lang/rust-clippy/issues/6840. | ||
//! The ICE is caused by `TyCtxt::layout_of` and `is_normalizable` not being strict enough | ||
#![allow(dead_code)] | ||
use std::collections::HashMap; | ||
|
||
pub trait Rule { | ||
type DependencyKey; | ||
} | ||
|
||
pub struct RuleEdges<R: Rule> { | ||
dependencies: R::DependencyKey, | ||
} | ||
|
||
type RuleDependencyEdges<R> = HashMap<u32, RuleEdges<R>>; | ||
|
||
// reproducer from the GitHub issue ends here | ||
// but check some additional variants | ||
type RuleDependencyEdgesArray<R> = HashMap<u32, [RuleEdges<R>; 8]>; | ||
type RuleDependencyEdgesSlice<R> = HashMap<u32, &'static [RuleEdges<R>]>; | ||
type RuleDependencyEdgesRef<R> = HashMap<u32, &'static RuleEdges<R>>; | ||
type RuleDependencyEdgesRaw<R> = HashMap<u32, *const RuleEdges<R>>; | ||
type RuleDependencyEdgesTuple<R> = HashMap<u32, (RuleEdges<R>, RuleEdges<R>)>; | ||
|
||
// and an additional checks to make sure fix doesn't have stack-overflow issue | ||
// on self-containing types | ||
pub struct SelfContaining { | ||
inner: Box<SelfContaining>, | ||
} | ||
type SelfContainingEdges = HashMap<u32, SelfContaining>; | ||
|
||
fn main() {} |