Fix incremental tests after change to instantiation strategy.

This commit is contained in:
Michael Woerister 2017-10-27 18:57:15 +02:00
parent 6a3659427e
commit cedae73c8c
18 changed files with 283 additions and 273 deletions

View file

@ -12,27 +12,29 @@
// crate. This should not cause anything we use to be invalidated.
// Regression test for #36168.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// aux-build:point.rs
// must-compile-successfully
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![crate_type = "rlib"]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
extern crate point;
/// A fn item that calls (public) methods on `Point` from the same impl
mod fn_calls_methods_in_same_impl {
pub mod fn_calls_methods_in_same_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let x = Point { x: 2.0, y: 2.0 };
x.distance_from_origin();
@ -40,10 +42,10 @@ mod fn_calls_methods_in_same_impl {
}
/// A fn item that calls (public) methods on `Point` from another impl
mod fn_calls_free_fn {
pub mod fn_calls_free_fn {
use point::{self, Point};
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let x = Point { x: 2.0, y: 2.0 };
point::distance_squared(&x);
@ -51,34 +53,31 @@ mod fn_calls_free_fn {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -13,32 +13,34 @@
// Fns with that type used only in their body are also recompiled, but
// their callers are not.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![crate_type = "rlib"]
// These are expected to require translation.
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="cfail2")]
mod point {
#[cfg(rpass1)]
pub mod point {
#[cfg(cfail1)]
pub struct Point {
pub x: f32,
pub y: f32,
}
#[cfg(rpass2)]
#[cfg(cfail2)]
pub struct Point {
pub x: f32,
pub y: f32,
@ -47,18 +49,18 @@ mod point {
impl Point {
pub fn origin() -> Point {
#[cfg(rpass1)]
#[cfg(cfail1)]
return Point { x: 0.0, y: 0.0 };
#[cfg(rpass2)]
#[cfg(cfail2)]
return Point { x: 0.0, y: 0.0, z: 0.0 };
}
pub fn total(&self) -> f32 {
#[cfg(rpass1)]
#[cfg(cfail1)]
return self.x + self.y;
#[cfg(rpass2)]
#[cfg(cfail2)]
return self.x + self.y + self.z;
}
@ -75,10 +77,10 @@ mod point {
/// sufficiently "private", we might not need to type-check again.
/// Rebuilding is probably always necessary since the layout may be
/// affected.
mod fn_with_type_in_sig {
pub mod fn_with_type_in_sig {
use point::Point;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn boop(p: Option<&Point>) -> f32 {
p.map(|p| p.total()).unwrap_or(0.0)
}
@ -91,10 +93,10 @@ mod fn_with_type_in_sig {
/// sufficiently "private", we might not need to type-check again.
/// Rebuilding is probably always necessary since the layout may be
/// affected.
mod call_fn_with_type_in_sig {
pub mod call_fn_with_type_in_sig {
use fn_with_type_in_sig;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn bip() -> f32 {
fn_with_type_in_sig::boop(None)
}
@ -107,10 +109,10 @@ mod call_fn_with_type_in_sig {
/// sufficiently "private", we might not need to type-check again.
/// Rebuilding is probably always necessary since the layout may be
/// affected.
mod fn_with_type_in_body {
pub mod fn_with_type_in_body {
use point::Point;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn boop() -> f32 {
Point::origin().total()
}
@ -120,44 +122,41 @@ mod fn_with_type_in_body {
/// body. In this case, the effects of the change should be contained
/// to Y; X should not have to be rebuilt, nor should it need to be
/// typechecked again.
mod call_fn_with_type_in_body {
pub mod call_fn_with_type_in_body {
use fn_with_type_in_body;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn bip() -> f32 {
fn_with_type_in_body::boop()
}
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn make_origin(p: Point) -> Point {
Point { ..p }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -11,32 +11,34 @@
// Test where we change the body of a private method in an impl.
// We then test what sort of functions must be rebuilt as a result.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![crate_type = "rlib"]
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
mod point {
pub mod point {
pub struct Point {
pub x: f32,
pub y: f32,
}
fn distance_squared(this: &Point) -> f32 {
#[cfg(rpass1)]
#[cfg(cfail1)]
return this.x + this.y;
#[cfg(rpass2)]
#[cfg(cfail2)]
return this.x * this.x + this.y * this.y;
}
@ -56,10 +58,10 @@ mod point {
}
/// A fn item that calls (public) methods on `Point` from the same impl which changed
mod fn_calls_methods_in_same_impl {
pub mod fn_calls_methods_in_same_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let x = Point { x: 2.0, y: 2.0 };
x.distance_from_origin();
@ -67,10 +69,10 @@ mod fn_calls_methods_in_same_impl {
}
/// A fn item that calls (public) methods on `Point` from another impl
mod fn_calls_methods_in_another_impl {
pub mod fn_calls_methods_in_another_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let mut x = Point { x: 2.0, y: 2.0 };
x.translate(3.0, 3.0);
@ -78,34 +80,31 @@ mod fn_calls_methods_in_another_impl {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -14,10 +14,10 @@ pub struct Point {
}
fn distance_squared(this: &Point) -> f32 {
#[cfg(rpass1)]
#[cfg(cfail1)]
return this.x + this.y;
#[cfg(rpass2)]
#[cfg(cfail2)]
return this.x * this.x + this.y * this.y;
}

View file

@ -11,27 +11,29 @@
// Test where we change the body of a private method in an impl.
// We then test what sort of functions must be rebuilt as a result.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// aux-build:point.rs
// must-compile-successfully
#![crate_type = "rlib"]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
extern crate point;
/// A fn item that calls (public) methods on `Point` from the same impl which changed
mod fn_calls_methods_in_same_impl {
pub mod fn_calls_methods_in_same_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let x = Point { x: 2.0, y: 2.0 };
x.distance_from_origin();
@ -39,10 +41,10 @@ mod fn_calls_methods_in_same_impl {
}
/// A fn item that calls (public) methods on `Point` from another impl
mod fn_calls_methods_in_another_impl {
pub mod fn_calls_methods_in_another_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let mut x = Point { x: 2.0, y: 2.0 };
x.translate(3.0, 3.0);
@ -50,34 +52,31 @@ mod fn_calls_methods_in_another_impl {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -11,33 +11,35 @@
// Test where we change the body of a private method in an impl.
// We then test what sort of functions must be rebuilt as a result.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![crate_type = "rlib"]
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
mod point {
pub mod point {
pub struct Point {
pub x: f32,
pub y: f32,
}
impl Point {
fn distance_squared(&self) -> f32 {
#[cfg(rpass1)]
pub fn distance_squared(&self) -> f32 {
#[cfg(cfail1)]
return self.x + self.y;
#[cfg(rpass2)]
#[cfg(cfail2)]
return self.x * self.x + self.y * self.y;
}
@ -56,10 +58,10 @@ mod point {
}
/// A fn item that calls (public) methods on `Point` from the same impl which changed
mod fn_calls_methods_in_same_impl {
pub mod fn_calls_methods_in_same_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let x = Point { x: 2.0, y: 2.0 };
x.distance_from_origin();
@ -67,10 +69,10 @@ mod fn_calls_methods_in_same_impl {
}
/// A fn item that calls (public) methods on `Point` from another impl
mod fn_calls_methods_in_another_impl {
pub mod fn_calls_methods_in_another_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let mut x = Point { x: 2.0, y: 2.0 };
x.translate(3.0, 3.0);
@ -78,34 +80,31 @@ mod fn_calls_methods_in_another_impl {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -15,10 +15,10 @@ pub struct Point {
impl Point {
fn distance_squared(&self) -> f32 {
#[cfg(rpass1)]
#[cfg(cfail1)]
return self.x + self.y;
#[cfg(rpass2)]
#[cfg(cfail2)]
return self.x * self.x + self.y * self.y;
}

View file

@ -11,28 +11,30 @@
// Test where we change the body of a private method in an impl.
// We then test what sort of functions must be rebuilt as a result.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// aux-build:point.rs
// must-compile-successfully
#![crate_type = "rlib"]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")]
extern crate point;
/// A fn item that calls (public) methods on `Point` from the same impl which changed
mod fn_calls_methods_in_same_impl {
pub mod fn_calls_methods_in_same_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let x = Point { x: 2.0, y: 2.0 };
x.distance_from_origin();
@ -40,10 +42,10 @@ mod fn_calls_methods_in_same_impl {
}
/// A fn item that calls (public) methods on `Point` from another impl
mod fn_calls_methods_in_another_impl {
pub mod fn_calls_methods_in_another_impl {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn dirty() {
let mut x = Point { x: 2.0, y: 2.0 };
x.translate(3.0, 3.0);
@ -51,34 +53,31 @@ mod fn_calls_methods_in_another_impl {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -10,22 +10,24 @@
// Test where we change the body of a public, inherent method.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![crate_type = "rlib"]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_changed_method", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_changed_method", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
mod point {
pub mod point {
pub struct Point {
pub x: f32,
pub y: f32,
@ -33,10 +35,10 @@ mod point {
impl Point {
pub fn distance_from_origin(&self) -> f32 {
#[cfg(rpass1)]
#[cfg(cfail1)]
return self.x * self.x + self.y * self.y;
#[cfg(rpass2)]
#[cfg(cfail2)]
return (self.x * self.x + self.y * self.y).sqrt();
}
@ -47,10 +49,10 @@ mod point {
}
/// A fn item that calls the method on `Point` which changed
mod fn_calls_changed_method {
pub mod fn_calls_changed_method {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let p = Point { x: 2.0, y: 2.0 };
p.distance_from_origin();
@ -58,10 +60,10 @@ mod fn_calls_changed_method {
}
/// A fn item that calls a method on `Point` which did not change
mod fn_calls_another_method {
pub mod fn_calls_another_method {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let p = Point { x: 2.0, y: 2.0 };
p.x();
@ -69,34 +71,31 @@ mod fn_calls_another_method {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -10,30 +10,32 @@
// Test where we change the *signature* of a public, inherent method.
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![crate_type = "rlib"]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![allow(dead_code)]
// These are expected to require translation.
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-fn_calls_changed_method", cfg="rpass2")]
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
#![rustc_partition_translated(module="struct_point-fn_calls_changed_method", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
mod point {
pub mod point {
pub struct Point {
pub x: f32,
pub y: f32,
}
impl Point {
#[cfg(rpass1)]
#[cfg(cfail1)]
pub fn distance_from_point(&self, p: Option<Point>) -> f32 {
let p = p.unwrap_or(Point { x: 0.0, y: 0.0 });
let x_diff = self.x - p.x;
@ -41,7 +43,7 @@ mod point {
return x_diff * x_diff + y_diff * y_diff;
}
#[cfg(rpass2)]
#[cfg(cfail2)]
pub fn distance_from_point(&self, p: Option<&Point>) -> f32 {
const ORIGIN: &Point = &Point { x: 0.0, y: 0.0 };
let p = p.unwrap_or(ORIGIN);
@ -57,10 +59,10 @@ mod point {
}
/// A fn item that calls the method that was changed
mod fn_calls_changed_method {
pub mod fn_calls_changed_method {
use point::Point;
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let p = Point { x: 2.0, y: 2.0 };
p.distance_from_point(None);
@ -68,10 +70,10 @@ mod fn_calls_changed_method {
}
/// A fn item that calls a method that was not changed
mod fn_calls_another_method {
pub mod fn_calls_another_method {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn check() {
let p = Point { x: 2.0, y: 2.0 };
p.x();
@ -79,34 +81,31 @@ mod fn_calls_another_method {
}
/// A fn item that makes an instance of `Point` but does not invoke methods
mod fn_make_struct {
pub mod fn_make_struct {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn make_origin() -> Point {
Point { x: 2.0, y: 2.0 }
}
}
/// A fn item that reads fields from `Point` but does not invoke methods
mod fn_read_field {
pub mod fn_read_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn get_x(p: Point) -> f32 {
p.x
}
}
/// A fn item that writes to a field of `Point` but does not invoke methods
mod fn_write_field {
pub mod fn_write_field {
use point::Point;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
pub fn inc_x(p: &mut Point) {
p.x += 1.0;
}
}
fn main() {
}

View file

@ -190,7 +190,7 @@ impl Struct2 {
}
// Change UFCS Callee Indirectly -----------------------------------------------
mod change_ufcs_callee_indirectly {
pub mod change_ufcs_callee_indirectly {
#[cfg(cfail1)]
use super::Struct as Struct;
#[cfg(not(cfail1))]

View file

@ -25,7 +25,7 @@
#![crate_type="rlib"]
enum Enum {
pub enum Enum {
Struct {
x: i32,
y: i64,
@ -36,7 +36,7 @@ enum Enum {
// Change field value (struct-like) -----------------------------------------
#[cfg(cfail1)]
fn change_field_value_struct_like() -> Enum {
pub fn change_field_value_struct_like() -> Enum {
Enum::Struct {
x: 0,
y: 1,
@ -49,7 +49,7 @@ fn change_field_value_struct_like() -> Enum {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_field_value_struct_like() -> Enum {
pub fn change_field_value_struct_like() -> Enum {
Enum::Struct {
x: 0,
y: 2,
@ -61,7 +61,7 @@ fn change_field_value_struct_like() -> Enum {
// Change field order (struct-like) -----------------------------------------
#[cfg(cfail1)]
fn change_field_order_struct_like() -> Enum {
pub fn change_field_order_struct_like() -> Enum {
Enum::Struct {
x: 3,
y: 4,
@ -76,7 +76,7 @@ fn change_field_order_struct_like() -> Enum {
#[rustc_metadata_clean(cfg="cfail3")]
// FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
// would if it were not all constants
fn change_field_order_struct_like() -> Enum {
pub fn change_field_order_struct_like() -> Enum {
Enum::Struct {
y: 4,
x: 3,
@ -85,7 +85,7 @@ fn change_field_order_struct_like() -> Enum {
}
enum Enum2 {
pub enum Enum2 {
Struct {
x: i8,
y: i8,
@ -102,7 +102,7 @@ enum Enum2 {
// Change constructor path (struct-like) ------------------------------------
#[cfg(cfail1)]
fn change_constructor_path_struct_like() {
pub fn change_constructor_path_struct_like() {
let _ = Enum::Struct {
x: 0,
y: 1,
@ -115,7 +115,7 @@ fn change_constructor_path_struct_like() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_path_struct_like() {
pub fn change_constructor_path_struct_like() {
let _ = Enum2::Struct {
x: 0,
y: 1,
@ -127,7 +127,7 @@ fn change_constructor_path_struct_like() {
// Change variant (regular struct) ------------------------------------
#[cfg(cfail1)]
fn change_constructor_variant_struct_like() {
pub fn change_constructor_variant_struct_like() {
let _ = Enum2::Struct {
x: 0,
y: 1,
@ -140,7 +140,7 @@ fn change_constructor_variant_struct_like() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_variant_struct_like() {
pub fn change_constructor_variant_struct_like() {
let _ = Enum2::Struct2 {
x: 0,
y: 1,
@ -150,7 +150,7 @@ fn change_constructor_variant_struct_like() {
// Change constructor path indirectly (struct-like) -------------------------
mod change_constructor_path_indirectly_struct_like {
pub mod change_constructor_path_indirectly_struct_like {
#[cfg(cfail1)]
use super::Enum as TheEnum;
#[cfg(not(cfail1))]
@ -164,7 +164,7 @@ mod change_constructor_path_indirectly_struct_like {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_dirty(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> TheEnum {
pub fn function() -> TheEnum {
TheEnum::Struct {
x: 0,
y: 1,
@ -175,7 +175,7 @@ mod change_constructor_path_indirectly_struct_like {
// Change constructor variant indirectly (struct-like) ---------------------------
mod change_constructor_variant_indirectly_struct_like {
pub mod change_constructor_variant_indirectly_struct_like {
use super::Enum2;
#[cfg(cfail1)]
use super::Enum2::Struct as Variant;
@ -186,7 +186,7 @@ mod change_constructor_variant_indirectly_struct_like {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> Enum2 {
pub fn function() -> Enum2 {
Variant {
x: 0,
y: 1,
@ -198,7 +198,7 @@ mod change_constructor_variant_indirectly_struct_like {
// Change field value (tuple-like) -------------------------------------------
#[cfg(cfail1)]
fn change_field_value_tuple_like() -> Enum {
pub fn change_field_value_tuple_like() -> Enum {
Enum::Tuple(0, 1, 2)
}
@ -207,7 +207,7 @@ fn change_field_value_tuple_like() -> Enum {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_field_value_tuple_like() -> Enum {
pub fn change_field_value_tuple_like() -> Enum {
Enum::Tuple(0, 1, 3)
}
@ -215,7 +215,7 @@ fn change_field_value_tuple_like() -> Enum {
// Change constructor path (tuple-like) --------------------------------------
#[cfg(cfail1)]
fn change_constructor_path_tuple_like() {
pub fn change_constructor_path_tuple_like() {
let _ = Enum::Tuple(0, 1, 2);
}
@ -227,7 +227,7 @@ fn change_constructor_path_tuple_like() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_path_tuple_like() {
pub fn change_constructor_path_tuple_like() {
let _ = Enum2::Tuple(0, 1, 2);
}
@ -235,7 +235,7 @@ fn change_constructor_path_tuple_like() {
// Change constructor variant (tuple-like) --------------------------------------
#[cfg(cfail1)]
fn change_constructor_variant_tuple_like() {
pub fn change_constructor_variant_tuple_like() {
let _ = Enum2::Tuple(0, 1, 2);
}
@ -247,13 +247,13 @@ fn change_constructor_variant_tuple_like() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_variant_tuple_like() {
pub fn change_constructor_variant_tuple_like() {
let _ = Enum2::Tuple2(0, 1, 2);
}
// Change constructor path indirectly (tuple-like) ---------------------------
mod change_constructor_path_indirectly_tuple_like {
pub mod change_constructor_path_indirectly_tuple_like {
#[cfg(cfail1)]
use super::Enum as TheEnum;
#[cfg(not(cfail1))]
@ -267,7 +267,7 @@ mod change_constructor_path_indirectly_tuple_like {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_dirty(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> TheEnum {
pub fn function() -> TheEnum {
TheEnum::Tuple(0, 1, 2)
}
}
@ -275,7 +275,7 @@ mod change_constructor_path_indirectly_tuple_like {
// Change constructor variant indirectly (tuple-like) ---------------------------
mod change_constructor_variant_indirectly_tuple_like {
pub mod change_constructor_variant_indirectly_tuple_like {
use super::Enum2;
#[cfg(cfail1)]
use super::Enum2::Tuple as Variant;
@ -286,19 +286,19 @@ mod change_constructor_variant_indirectly_tuple_like {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> Enum2 {
pub fn function() -> Enum2 {
Variant(0, 1, 2)
}
}
enum Clike {
pub enum Clike {
A,
B,
C
}
enum Clike2 {
pub enum Clike2 {
B,
C,
D
@ -306,7 +306,7 @@ enum Clike2 {
// Change constructor path (C-like) --------------------------------------
#[cfg(cfail1)]
fn change_constructor_path_c_like() {
pub fn change_constructor_path_c_like() {
let _ = Clike::B;
}
@ -314,7 +314,7 @@ fn change_constructor_path_c_like() {
#[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")]
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_path_c_like() {
pub fn change_constructor_path_c_like() {
let _ = Clike2::B;
}
@ -322,7 +322,7 @@ fn change_constructor_path_c_like() {
// Change constructor variant (C-like) --------------------------------------
#[cfg(cfail1)]
fn change_constructor_variant_c_like() {
pub fn change_constructor_variant_c_like() {
let _ = Clike::A;
}
@ -331,13 +331,13 @@ fn change_constructor_variant_c_like() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_variant_c_like() {
pub fn change_constructor_variant_c_like() {
let _ = Clike::C;
}
// Change constructor path indirectly (C-like) ---------------------------
mod change_constructor_path_indirectly_c_like {
pub mod change_constructor_path_indirectly_c_like {
#[cfg(cfail1)]
use super::Clike as TheEnum;
#[cfg(not(cfail1))]
@ -351,7 +351,7 @@ mod change_constructor_path_indirectly_c_like {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_dirty(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> TheEnum {
pub fn function() -> TheEnum {
TheEnum::B
}
}
@ -359,7 +359,7 @@ mod change_constructor_path_indirectly_c_like {
// Change constructor variant indirectly (C-like) ---------------------------
mod change_constructor_variant_indirectly_c_like {
pub mod change_constructor_variant_indirectly_c_like {
use super::Clike;
#[cfg(cfail1)]
use super::Clike::A as Variant;
@ -370,7 +370,7 @@ mod change_constructor_variant_indirectly_c_like {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> Clike {
pub fn function() -> Clike {
Variant
}
}

View file

@ -25,7 +25,7 @@
#![feature(rustc_attrs)]
#![crate_type="rlib"]
struct Foo;
pub struct Foo;
// Change Method Name -----------------------------------------------------------
#[cfg(cfail1)]
@ -578,3 +578,19 @@ impl<T: Clone> Bar<T> {
#[rustc_metadata_clean(cfg="cfail3")]
pub fn add_trait_bound_to_impl_parameter(&self) { }
}
// Force instantiation of some fns so we can check their hash.
pub fn instantiation_root() {
Foo::method_privacy();
#[cfg(cfail1)]
{
Bar(0u32).change_impl_self_type();
}
#[cfg(not(cfail1))]
{
Bar(0u64).change_impl_self_type();
}
}

View file

@ -25,7 +25,7 @@
#![crate_type="rlib"]
struct RegularStruct {
pub struct RegularStruct {
x: i32,
y: i64,
z: i16,
@ -33,7 +33,7 @@ struct RegularStruct {
// Change field value (regular struct) -----------------------------------------
#[cfg(cfail1)]
fn change_field_value_regular_struct() -> RegularStruct {
pub fn change_field_value_regular_struct() -> RegularStruct {
RegularStruct {
x: 0,
y: 1,
@ -46,7 +46,7 @@ fn change_field_value_regular_struct() -> RegularStruct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_field_value_regular_struct() -> RegularStruct {
pub fn change_field_value_regular_struct() -> RegularStruct {
RegularStruct {
x: 0,
y: 2,
@ -58,7 +58,7 @@ fn change_field_value_regular_struct() -> RegularStruct {
// Change field order (regular struct) -----------------------------------------
#[cfg(cfail1)]
fn change_field_order_regular_struct() -> RegularStruct {
pub fn change_field_order_regular_struct() -> RegularStruct {
RegularStruct {
x: 3,
y: 4,
@ -71,7 +71,7 @@ fn change_field_order_regular_struct() -> RegularStruct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_field_order_regular_struct() -> RegularStruct {
pub fn change_field_order_regular_struct() -> RegularStruct {
RegularStruct {
y: 4,
x: 3,
@ -83,7 +83,7 @@ fn change_field_order_regular_struct() -> RegularStruct {
// Add field (regular struct) --------------------------------------------------
#[cfg(cfail1)]
fn add_field_regular_struct() -> RegularStruct {
pub fn add_field_regular_struct() -> RegularStruct {
let struct1 = RegularStruct {
x: 3,
y: 4,
@ -101,7 +101,7 @@ fn add_field_regular_struct() -> RegularStruct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn add_field_regular_struct() -> RegularStruct {
pub fn add_field_regular_struct() -> RegularStruct {
let struct1 = RegularStruct {
x: 3,
y: 4,
@ -119,7 +119,7 @@ fn add_field_regular_struct() -> RegularStruct {
// Change field label (regular struct) -----------------------------------------
#[cfg(cfail1)]
fn change_field_label_regular_struct() -> RegularStruct {
pub fn change_field_label_regular_struct() -> RegularStruct {
let struct1 = RegularStruct {
x: 3,
y: 4,
@ -138,7 +138,7 @@ fn change_field_label_regular_struct() -> RegularStruct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_field_label_regular_struct() -> RegularStruct {
pub fn change_field_label_regular_struct() -> RegularStruct {
let struct1 = RegularStruct {
x: 3,
y: 4,
@ -154,7 +154,7 @@ fn change_field_label_regular_struct() -> RegularStruct {
struct RegularStruct2 {
pub struct RegularStruct2 {
x: i8,
y: i8,
z: i8,
@ -162,7 +162,7 @@ struct RegularStruct2 {
// Change constructor path (regular struct) ------------------------------------
#[cfg(cfail1)]
fn change_constructor_path_regular_struct() {
pub fn change_constructor_path_regular_struct() {
let _ = RegularStruct {
x: 0,
y: 1,
@ -175,7 +175,7 @@ fn change_constructor_path_regular_struct() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_path_regular_struct() {
pub fn change_constructor_path_regular_struct() {
let _ = RegularStruct2 {
x: 0,
y: 1,
@ -186,7 +186,7 @@ fn change_constructor_path_regular_struct() {
// Change constructor path indirectly (regular struct) -------------------------
mod change_constructor_path_indirectly_regular_struct {
pub mod change_constructor_path_indirectly_regular_struct {
#[cfg(cfail1)]
use super::RegularStruct as Struct;
#[cfg(not(cfail1))]
@ -199,7 +199,7 @@ mod change_constructor_path_indirectly_regular_struct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_dirty(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> Struct {
pub fn function() -> Struct {
Struct {
x: 0,
y: 1,
@ -210,11 +210,11 @@ mod change_constructor_path_indirectly_regular_struct {
struct TupleStruct(i32, i64, i16);
pub struct TupleStruct(i32, i64, i16);
// Change field value (tuple struct) -------------------------------------------
#[cfg(cfail1)]
fn change_field_value_tuple_struct() -> TupleStruct {
pub fn change_field_value_tuple_struct() -> TupleStruct {
TupleStruct(0, 1, 2)
}
@ -223,17 +223,17 @@ fn change_field_value_tuple_struct() -> TupleStruct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_field_value_tuple_struct() -> TupleStruct {
pub fn change_field_value_tuple_struct() -> TupleStruct {
TupleStruct(0, 1, 3)
}
struct TupleStruct2(u16, u16, u16);
pub struct TupleStruct2(u16, u16, u16);
// Change constructor path (tuple struct) --------------------------------------
#[cfg(cfail1)]
fn change_constructor_path_tuple_struct() {
pub fn change_constructor_path_tuple_struct() {
let _ = TupleStruct(0, 1, 2);
}
@ -242,14 +242,14 @@ fn change_constructor_path_tuple_struct() {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_clean(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn change_constructor_path_tuple_struct() {
pub fn change_constructor_path_tuple_struct() {
let _ = TupleStruct2(0, 1, 2);
}
// Change constructor path indirectly (tuple struct) ---------------------------
mod change_constructor_path_indirectly_tuple_struct {
pub mod change_constructor_path_indirectly_tuple_struct {
#[cfg(cfail1)]
use super::TupleStruct as Struct;
#[cfg(not(cfail1))]
@ -262,7 +262,7 @@ mod change_constructor_path_indirectly_tuple_struct {
#[rustc_clean(cfg="cfail3")]
#[rustc_metadata_dirty(cfg="cfail2")]
#[rustc_metadata_clean(cfg="cfail3")]
fn function() -> Struct {
pub fn function() -> Struct {
Struct(0, 1, 2)
}
}

View file

@ -33,10 +33,9 @@ pub fn main() {
mod mod1 {
pub fn some_fn() {
#[cfg(rpass2)]
{}
let _ = 1;
}
#[cfg(rpass2)]
fn _some_other_fn() {
}
}

View file

@ -8,27 +8,27 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// revisions: rpass1 rpass2
// revisions: cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![allow(warnings)]
#![feature(rustc_attrs)]
#![rustc_partition_reused(module="krate_inherent-x", cfg="rpass2")]
#![rustc_partition_reused(module="krate_inherent-x", cfg="cfail2")]
#![crate_type = "rlib"]
fn main() { }
mod x {
struct Foo;
pub mod x {
pub struct Foo;
impl Foo {
fn foo(&self) { }
pub fn foo(&self) { }
}
fn method() {
pub fn method() {
let x: Foo = Foo;
x.foo(); // inherent methods used to add an edge from Krate
}
}
#[cfg(rpass1)]
fn bar() { } // remove this unrelated fn in rpass2, which should not affect `x::method`
#[cfg(cfail1)]
pub fn bar() { } // remove this unrelated fn in cfail2, which should not affect `x::method`

View file

@ -20,12 +20,14 @@
#![rustc_partition_reused(module="krate_inlined-x", cfg="rpass2")]
fn main() {
x::method();
#[cfg(rpass2)]
()
}
mod x {
fn method() {
pub fn method() {
// use some methods that require inlining HIR from another crate:
let mut v = vec![];
v.push(1);

View file

@ -8,47 +8,48 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// revisions: rpass1 rpass2
// revisions: cfail1 cfail2
// compile-flags: -Z query-dep-graph
// must-compile-successfully
#![allow(warnings)]
#![feature(rustc_attrs)]
#![crate_type = "rlib"]
// Here the only thing which changes is the string constant in `x`.
// Therefore, the compiler deduces (correctly) that typeck is not
// needed even for callers of `x`.
fn main() { }
mod x {
#[cfg(rpass1)]
pub mod x {
#[cfg(cfail1)]
pub fn x() {
println!("{}", "1");
}
#[cfg(rpass2)]
#[rustc_dirty(label="HirBody", cfg="rpass2")]
#[rustc_dirty(label="MirOptimized", cfg="rpass2")]
#[cfg(cfail2)]
#[rustc_dirty(label="HirBody", cfg="cfail2")]
#[rustc_dirty(label="MirOptimized", cfg="cfail2")]
pub fn x() {
println!("{}", "2");
}
}
mod y {
pub mod y {
use x;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="MirOptimized", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
#[rustc_clean(label="MirOptimized", cfg="cfail2")]
pub fn y() {
x::x();
}
}
mod z {
pub mod z {
use y;
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
#[rustc_clean(label="MirOptimized", cfg="rpass2")]
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
#[rustc_clean(label="MirOptimized", cfg="cfail2")]
pub fn z() {
y::y();
}