2016-12-19 16:52:18 -06:00
|
|
|
// This test case tests the incremental compilation hash (ICH) implementation
|
|
|
|
// for `extern` modules.
|
|
|
|
|
|
|
|
// The general pattern followed here is: Change one thing between rev1 and rev2
|
|
|
|
// and make sure that the hash has changed, then change nothing between rev2 and
|
|
|
|
// rev3 and make sure that the hash has not changed.
|
|
|
|
|
2019-07-02 16:30:28 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2021-04-22 14:33:16 -05:00
|
|
|
// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
|
2022-05-27 20:17:39 -05:00
|
|
|
// compile-flags: -Z query-dep-graph -O
|
2021-04-22 14:33:16 -05:00
|
|
|
// [cfail1]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail2]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail3]compile-flags: -Zincremental-ignore-spans
|
2016-12-19 16:52:18 -06:00
|
|
|
|
|
|
|
#![allow(warnings)]
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![feature(unboxed_closures)]
|
2020-11-23 11:05:36 -06:00
|
|
|
#![crate_type = "rlib"]
|
2016-12-19 16:52:18 -06:00
|
|
|
|
|
|
|
// Change function name --------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_function_name1(c: i64) -> i32;
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-09-26 07:37:23 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-09-26 07:37:23 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_function_name2(c: i64) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change parameter name -------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_parameter_name(c: i64) -> i32;
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_parameter_name(d: i64) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change parameter type -------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_parameter_type(c: i64) -> i32;
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_parameter_type(c: i32) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change return type ----------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_return_type(c: i32) -> i32;
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2021-04-22 14:33:16 -05:00
|
|
|
pub fn change_return_type(c: i32) -> i8 ;
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add parameter ---------------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2021-04-22 14:33:16 -05:00
|
|
|
pub fn add_parameter(c: i32 ) -> i32;
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn add_parameter(c: i32, d: i32) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add return type -------------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2021-04-22 14:33:16 -05:00
|
|
|
pub fn add_return_type(c: i32) ;
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn add_return_type(c: i32) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make function variadic ------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2021-04-22 14:33:16 -05:00
|
|
|
pub fn make_function_variadic(c: i32 );
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn make_function_variadic(c: i32, ...);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change calling convention ---------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-19 16:52:18 -06:00
|
|
|
extern "C" {
|
2022-10-02 14:41:54 -05:00
|
|
|
pub fn change_calling_convention(c: (i32,));
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-09-26 07:37:23 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-09-26 07:37:23 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2016-12-19 16:52:18 -06:00
|
|
|
extern "rust-call" {
|
2022-10-02 14:41:54 -05:00
|
|
|
pub fn change_calling_convention(c: (i32,));
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Make function public --------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2021-08-29 08:33:03 -05:00
|
|
|
fn make_function_public(c: i32);
|
2016-12-19 16:52:18 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-08-29 08:33:03 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-08-29 08:33:03 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn make_function_public(c: i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add function ----------------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn add_function1(c: i32);
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-09-26 07:37:23 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-09-26 07:37:23 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn add_function1(c: i32);
|
|
|
|
pub fn add_function2();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change link-name ------------------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-19 16:52:18 -06:00
|
|
|
#[link(name = "foo")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_link_name(c: i32);
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2016-12-19 16:52:18 -06:00
|
|
|
#[link(name = "bar")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn change_link_name(c: i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
type c_i32 = i32;
|
|
|
|
type c_i64 = i64;
|
|
|
|
|
|
|
|
// Indirectly change parameter type --------------------------------------------
|
|
|
|
mod indirectly_change_parameter_type {
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-19 16:52:18 -06:00
|
|
|
use super::c_i32 as c_int;
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2016-12-19 16:52:18 -06:00
|
|
|
use super::c_i64 as c_int;
|
|
|
|
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn indirectly_change_parameter_type(c: c_int);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Indirectly change return type --------------------------------------------
|
|
|
|
mod indirectly_change_return_type {
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-19 16:52:18 -06:00
|
|
|
use super::c_i32 as c_int;
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2016-12-19 16:52:18 -06:00
|
|
|
use super::c_i64 as c_int;
|
|
|
|
|
2021-05-16 03:14:57 -05:00
|
|
|
#[rustc_clean(cfg = "cfail2")]
|
2020-11-23 11:05:36 -06:00
|
|
|
#[rustc_clean(cfg = "cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg = "cfail5")]
|
|
|
|
#[rustc_clean(cfg = "cfail6")]
|
2020-11-23 11:05:36 -06:00
|
|
|
extern "C" {
|
2016-12-19 16:52:18 -06:00
|
|
|
pub fn indirectly_change_return_type() -> c_int;
|
|
|
|
}
|
|
|
|
}
|