1
+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ use rustc:: ty:: TyCtxt ;
12
+ use rustc:: mir:: Mir ;
13
+ use rustc:: mir:: visit:: MutVisitor ;
14
+ use rustc:: mir:: transform:: { MirPass , MirSource } ;
15
+
16
+ #[ allow( dead_code) ]
17
+ struct NLLVisitor < ' a , ' tcx : ' a > {
18
+ tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
19
+ }
20
+
21
+ impl < ' a , ' tcx > NLLVisitor < ' a , ' tcx > {
22
+ pub fn new ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> Self {
23
+ NLLVisitor {
24
+ tcx : tcx
25
+ }
26
+ }
27
+ }
28
+
29
+ impl < ' a , ' tcx > MutVisitor < ' tcx > for NLLVisitor < ' a , ' tcx > {
30
+ // FIXME: Nashenas88: implement me!
31
+ }
32
+
33
+ // MIR Pass for non-lexical lifetimes
34
+ pub struct NLL ;
35
+
36
+ impl MirPass for NLL {
37
+ fn run_pass < ' a , ' tcx > ( & self ,
38
+ tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
39
+ _: MirSource ,
40
+ mir : & mut Mir < ' tcx > ) {
41
+ if tcx. sess . opts . debugging_opts . nll {
42
+ // Clone mir so we can mutate it without disturbing the rest
43
+ // of the compiler
44
+ NLLVisitor :: new ( tcx) . visit_mir ( & mut mir. clone ( ) ) ;
45
+ }
46
+ }
47
+ }
0 commit comments