diff options
| author | bors <bors@rust-lang.org> | 2021-01-17 15:38:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-17 15:38:50 +0000 |
| commit | e0d331fbf414bdbbb03f950609d5538fe60f5dc8 (patch) | |
| tree | 24a20f708579374f2557f5b34db8bc6086a3fe4e /tests | |
| parent | 40ce9f83b6904af97ab13d80642d29e573fa6814 (diff) | |
| parent | feee45c87270a4e6cf1959315e2c4528e7da4ec7 (diff) | |
| download | rust-e0d331fbf414bdbbb03f950609d5538fe60f5dc8.tar.gz rust-e0d331fbf414bdbbb03f950609d5538fe60f5dc8.zip | |
Auto merge of #6582 - rail-rain:ice_6539, r=flip1995
Fix the ICE 6539 Fixes #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`
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/crashes/ice-6539.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/crashes/ice-6539.rs b/tests/ui/crashes/ice-6539.rs new file mode 100644 index 00000000000..ac6c3e4aba0 --- /dev/null +++ b/tests/ui/crashes/ice-6539.rs @@ -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() {} |
