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.
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.
11 // Regression test for issue #27583. Unclear how useful this will be
12 // going forward, since the issue in question was EXTREMELY sensitive
13 // to compiler internals (like the precise numbering of nodes), but
19 use std::marker::PhantomData;
21 pub trait Delegate<'tcx> { }
23 pub struct InferCtxt<'a, 'tcx: 'a> {
24 x: PhantomData<&'a Cell<&'tcx ()>>
27 pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> {
28 x: &'t InferCtxt<'a, 'tcx>,
31 pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> {
32 typer: &'t InferCtxt<'a, 'tcx>,
33 mc: MemCategorizationContext<'t, 'a, 'tcx>,
34 delegate: &'d mut (Delegate<'tcx>+'d),
37 impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
38 pub fn new(delegate: &'d mut Delegate<'tcx>,
39 typer: &'t InferCtxt<'a, 'tcx>)
40 -> ExprUseVisitor<'d,'t,'a,'tcx>
44 mc: MemCategorizationContext::new(typer),
50 impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
51 pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> {
52 MemCategorizationContext { x: typer }