forked from rust-lang/rust-clippy
-
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.
Auto merge of rust-lang#6582 - rail-rain:ice_6539, r=flip1995
Fix the ICE 6539 Fixes rust-lang#6539 It happened because `zero_sized_map_values` used `layout_of` with types from type aliases, which is essentially the same as the ICE 4968. --- changelog: Fix an ICE in `zero_sized_map_values`
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
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,16 @@ | ||
// The test for the ICE 6539: https://github.com/rust-lang/rust-clippy/issues/6539. | ||
// The cause is that `zero_sized_map_values` used `layout_of` with types from type aliases, | ||
// which is essentially the same as the ICE 4968. | ||
// Note that only type aliases with associated types caused the crash this time, | ||
// not others such as trait impls. | ||
|
||
use std::collections::{BTreeMap, HashMap}; | ||
|
||
pub trait Trait { | ||
type Assoc; | ||
} | ||
|
||
type TypeAlias<T> = HashMap<(), <T as Trait>::Assoc>; | ||
type TypeAlias2<T> = BTreeMap<(), <T as Trait>::Assoc>; | ||
|
||
fn main() {} |