Skip to content

Commit bed7ea8

Browse files
committed
basic tests for cross-crate hashing
1 parent 3a2edd7 commit bed7ea8

File tree

4 files changed

+102
-0
lines changed
  • src/test/incremental
    • callee_caller_cross_crate
    • type_alias_cross_crate

4 files changed

+102
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2014 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+
#![crate_type="rlib"]
12+
13+
#[cfg(rpass1)]
14+
pub fn function0(x: u32) -> u32 {
15+
x
16+
}
17+
18+
#[cfg(rpass2)]
19+
pub fn function0(x: i32) -> i32 {
20+
x
21+
}
22+
23+
pub fn function1(x: u32) {
24+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2014 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+
// aux-build:a.rs
12+
// revisions:rpass1 rpass2
13+
14+
#![feature(rustc_attrs)]
15+
16+
extern crate a;
17+
18+
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
19+
pub fn call_function0() {
20+
a::function0(77);
21+
}
22+
23+
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
24+
pub fn call_function1() {
25+
a::function1(77);
26+
}
27+
28+
pub fn main() { }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 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+
#![crate_type="rlib"]
12+
13+
#[cfg(rpass1)]
14+
pub type X = u32;
15+
16+
#[cfg(rpass2)]
17+
pub type X = i32;
18+
19+
pub type Y = char;
20+
21+
pub fn foo() { }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2014 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+
// aux-build:a.rs
12+
// revisions:rpass1 rpass2
13+
14+
#![feature(rustc_attrs)]
15+
16+
extern crate a;
17+
18+
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
19+
pub fn use_X() -> u32 {
20+
let x: a::X = 22;
21+
x as u32
22+
}
23+
24+
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
25+
pub fn use_Y() {
26+
let x: a::Y = 'c';
27+
}
28+
29+
pub fn main() { }

0 commit comments

Comments
 (0)