]> git.lizzy.rs Git - rust.git/blob - tests/ui/crashes/ice-6840.rs
Merge remote-tracking branch 'upstream/master' into rustup
[rust.git] / tests / ui / crashes / ice-6840.rs
1 //! This is a reproducer for the ICE 6840: https://github.com/rust-lang/rust-clippy/issues/6840.
2 //! The ICE is caused by `TyCtxt::layout_of` and `is_normalizable` not being strict enough
3 #![allow(dead_code)]
4 use std::collections::HashMap;
5
6 pub trait Rule {
7     type DependencyKey;
8 }
9
10 pub struct RuleEdges<R: Rule> {
11     dependencies: R::DependencyKey,
12 }
13
14 type RuleDependencyEdges<R> = HashMap<u32, RuleEdges<R>>;
15
16 // reproducer from the GitHub issue ends here
17 //   but check some additional variants
18 type RuleDependencyEdgesArray<R> = HashMap<u32, [RuleEdges<R>; 8]>;
19 type RuleDependencyEdgesSlice<R> = HashMap<u32, &'static [RuleEdges<R>]>;
20 type RuleDependencyEdgesRef<R> = HashMap<u32, &'static RuleEdges<R>>;
21 type RuleDependencyEdgesRaw<R> = HashMap<u32, *const RuleEdges<R>>;
22 type RuleDependencyEdgesTuple<R> = HashMap<u32, (RuleEdges<R>, RuleEdges<R>)>;
23
24 // and an additional checks to make sure fix doesn't have stack-overflow issue
25 //   on self-containing types
26 pub struct SelfContaining {
27     inner: Box<SelfContaining>,
28 }
29 type SelfContainingEdges = HashMap<u32, SelfContaining>;
30
31 fn main() {}