@@ -7,12 +7,12 @@ use crate::{ty::Ty, Span};
7
7
pub struct Body {
8
8
pub blocks : Vec < BasicBlock > ,
9
9
10
- /// Declarations of locals.
10
+ // Declarations of locals within the function .
11
11
//
12
12
// The first local is the return value pointer, followed by `arg_count`
13
13
// locals for the function arguments, followed by any user-declared
14
14
// variables and temporaries.
15
- pub locals : LocalDecls ,
15
+ locals : LocalDecls ,
16
16
17
17
// The number of arguments this function takes.
18
18
arg_count : usize ,
@@ -22,12 +22,12 @@ impl Body {
22
22
/// Constructs a `Body`.
23
23
///
24
24
/// A constructor is required to build a `Body` from outside the crate
25
- /// because the `arg_count` field is private.
25
+ /// because the `arg_count` and `locals` fields are private.
26
26
pub fn new ( blocks : Vec < BasicBlock > , locals : LocalDecls , arg_count : usize ) -> Self {
27
27
// If locals doesn't contain enough entries, it can lead to panics in
28
- // `ret_local` and `arg_locals `.
28
+ // `ret_local`, `arg_locals`, and `internal_locals `.
29
29
assert ! (
30
- locals. len( ) >= arg_count + 1 ,
30
+ locals. len( ) > arg_count,
31
31
"A Body must contain at least a local for the return value and each of the function's arguments"
32
32
) ;
33
33
Self { blocks, locals, arg_count }
0 commit comments