Skip to content

Commit d5b679b

Browse files
committed
add a regression test for #27583. Fixes #27583.
1 parent dcf6f08 commit d5b679b

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

src/test/run-pass/issue-27583.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
// 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
14+
// what the hey.
15+
16+
#![allow(warnings)]
17+
18+
use std::cell::Cell;
19+
use std::marker::PhantomData;
20+
21+
pub trait Delegate<'tcx> { }
22+
23+
pub struct InferCtxt<'a, 'tcx: 'a> {
24+
x: PhantomData<&'a Cell<&'tcx ()>>
25+
}
26+
27+
pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> {
28+
x: &'t InferCtxt<'a, 'tcx>,
29+
}
30+
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),
35+
}
36+
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>
41+
{
42+
ExprUseVisitor {
43+
typer: typer,
44+
mc: MemCategorizationContext::new(typer),
45+
delegate: delegate,
46+
}
47+
}
48+
}
49+
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 }
53+
}
54+
}
55+
56+
fn main() { }

0 commit comments

Comments
 (0)