summaryrefslogtreecommitdiff
path: root/src/mir/from_hir.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-07-02 18:34:34 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-07-02 18:34:34 +0800
commitb7bb1f4f9c918e128f7ad83476790830c3f98c4d (patch)
treea48a989aff0bef394dd389089f9274f76dfc4649 /src/mir/from_hir.hpp
parent11d2a7732c5d1c53aee384b2ca4fdc672c2cc1ae (diff)
downloadmrust-b7bb1f4f9c918e128f7ad83476790830c3f98c4d.tar.gz
MIR Gen - Make mutating state (other than the if condition) within a match guard an error
Diffstat (limited to 'src/mir/from_hir.hpp')
-rw-r--r--src/mir/from_hir.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mir/from_hir.hpp b/src/mir/from_hir.hpp
index 11a18a6d..b11a380a 100644
--- a/src/mir/from_hir.hpp
+++ b/src/mir/from_hir.hpp
@@ -103,6 +103,11 @@ TAGGED_UNION(ScopeType, Owning,
::std::map<unsigned int,VarState> changed_args;
bool exit_state_valid;
SplitEnd exit_state;
+ }),
+ // State which should end up with no mutation of variable states
+ (Freeze, struct {
+ //::std::map<unsigned int,VarState> changed_slots;
+ //::std::map<unsigned int,VarState> changed_args;
})
);
@@ -257,6 +262,7 @@ public:
ScopeHandle new_scope_temp(const Span& sp);
ScopeHandle new_scope_split(const Span& sp);
ScopeHandle new_scope_loop(const Span& sp);
+ ScopeHandle new_scope_freeze(const Span& sp);
/// Raises every variable defined in the source scope into the target scope
void raise_all(const Span& sp, ScopeHandle src, const ScopeHandle& target);