Skip to content

Commit f320004

Browse files
incr.comp.: Add test case for dependency graph of type aliases.
1 parent 75df685 commit f320004

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2016 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+
12+
// Test that changing what a `type` points to does not go unnoticed.
13+
14+
// compile-flags: -Z query-dep-graph
15+
16+
#![feature(rustc_attrs)]
17+
#![allow(dead_code)]
18+
#![allow(unused_variables)]
19+
20+
fn main() { }
21+
22+
23+
#[rustc_if_this_changed]
24+
type TypeAlias = u32;
25+
26+
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
27+
struct Struct {
28+
x: TypeAlias,
29+
y: u32
30+
}
31+
32+
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
33+
enum Enum {
34+
Variant1(TypeAlias),
35+
Variant2(i32)
36+
}
37+
38+
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
39+
trait Trait {
40+
fn method(&self, _: TypeAlias);
41+
}
42+
43+
struct SomeType;
44+
45+
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
46+
impl SomeType {
47+
fn method(&self, _: TypeAlias) {}
48+
}
49+
50+
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
51+
type TypeAlias2 = TypeAlias;
52+
53+
#[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
54+
fn function(_: TypeAlias) {
55+
56+
}

0 commit comments

Comments
 (0)