]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-27583.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-27583.rs
1 // Copyright 2012 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 // compile-pass
12 // Regression test for issue #27583. Unclear how useful this will be
13 // going forward, since the issue in question was EXTREMELY sensitive
14 // to compiler internals (like the precise numbering of nodes), but
15 // what the hey.
16
17 #![allow(warnings)]
18
19 use std::cell::Cell;
20 use std::marker::PhantomData;
21
22 pub trait Delegate<'tcx> { }
23
24 pub struct InferCtxt<'a, 'tcx: 'a> {
25     x: PhantomData<&'a Cell<&'tcx ()>>
26 }
27
28 pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> {
29     x: &'t InferCtxt<'a, 'tcx>,
30 }
31
32 pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> {
33     typer: &'t InferCtxt<'a, 'tcx>,
34     mc: MemCategorizationContext<'t, 'a, 'tcx>,
35     delegate: &'d mut (Delegate<'tcx>+'d),
36 }
37
38 impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
39     pub fn new(delegate: &'d mut Delegate<'tcx>,
40                typer: &'t InferCtxt<'a, 'tcx>)
41                -> ExprUseVisitor<'d,'t,'a,'tcx>
42     {
43         ExprUseVisitor {
44             typer: typer,
45             mc: MemCategorizationContext::new(typer),
46             delegate: delegate,
47         }
48     }
49 }
50
51 impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
52     pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> {
53         MemCategorizationContext { x: typer }
54     }
55 }
56
57 fn main() { }