Skip to content

Commit

Permalink
basic tests for cross-crate hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed May 18, 2016
1 parent 3a2edd7 commit bed7ea8
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/incremental/callee_caller_cross_crate/auxiliary/a.rs
@@ -0,0 +1,24 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![crate_type="rlib"]

#[cfg(rpass1)]
pub fn function0(x: u32) -> u32 {
x
}

#[cfg(rpass2)]
pub fn function0(x: i32) -> i32 {
x
}

pub fn function1(x: u32) {
}
28 changes: 28 additions & 0 deletions src/test/incremental/callee_caller_cross_crate/b.rs
@@ -0,0 +1,28 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// aux-build:a.rs
// revisions:rpass1 rpass2

#![feature(rustc_attrs)]

extern crate a;

#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
pub fn call_function0() {
a::function0(77);
}

#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
pub fn call_function1() {
a::function1(77);
}

pub fn main() { }
21 changes: 21 additions & 0 deletions src/test/incremental/type_alias_cross_crate/auxiliary/a.rs
@@ -0,0 +1,21 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![crate_type="rlib"]

#[cfg(rpass1)]
pub type X = u32;

#[cfg(rpass2)]
pub type X = i32;

pub type Y = char;

pub fn foo() { }
29 changes: 29 additions & 0 deletions src/test/incremental/type_alias_cross_crate/b.rs
@@ -0,0 +1,29 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// aux-build:a.rs
// revisions:rpass1 rpass2

#![feature(rustc_attrs)]

extern crate a;

#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
pub fn use_X() -> u32 {
let x: a::X = 22;
x as u32
}

#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
pub fn use_Y() {
let x: a::Y = 'c';
}

pub fn main() { }

0 comments on commit bed7ea8

Please sign in to comment.