1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Validation passes for MIR.
//!
//! This module provides a collection of functions that check properties
//! that should be ensured by the structure of the compiler, but which we might
//! mess up by mistake if we're not careful.
use ;
/// Check that [`FunctionDependency`](MirEdge::FunctionDependency) edges are used
/// for conveying functions, and nothing else, and that functions are *only* conveyed
/// using the correct edge kind.
/// This pass ensures that the callee for each of the function calls in a program
/// is able to be known statically.
///
/// The requirements are these:
/// - Functions are created by `FunctionDefinition` and `PartialApply` nodes
/// - `FunctionDependency` edges convey only functions
/// - Only `FunctionDependency` edges convey functions
/// - Functions cannot be returned by `Decision` nodes
/// - Functions can be returned by `Loop` and `RecursiveEnvironment` nodes
/// Check that all node arguments match with the expected types.
pub