rust/tests/ui/dep-graph/dep-graph-caller-callee.rs
2023-01-11 09:32:08 +00:00

37 lines
669 B
Rust

// Test that immediate callers have to change when callee changes, but
// not callers' callers.
// incremental
// compile-flags: -Z query-dep-graph
#![feature(rustc_attrs)]
#![allow(dead_code)]
fn main() { }
mod x {
#[rustc_if_this_changed]
pub fn x() { }
}
mod y {
use x;
// These dependencies SHOULD exist:
#[rustc_then_this_would_need(typeck)] //~ ERROR OK
pub fn y() {
x::x();
}
}
mod z {
use y;
// These are expected to yield errors, because changes to `x`
// affect the BODY of `y`, but not its signature.
#[rustc_then_this_would_need(typeck)] //~ ERROR no path
pub fn z() {
y::y();
}
}