Skip to content

incr.comp.: "change nothing" test fails. #42538

Closed
@lseugene

Description

@lseugene

I've been slightly modified incremental/struct_change_nothing.rs test with impl block added. And now it fails.

// 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.

// Test incremental compilation tracking where we change nothing
// in between revisions (hashing should be stable).

// revisions:rpass1 rpass2
// compile-flags: -Z query-dep-graph

#![feature(rustc_attrs)]
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![rustc_partition_reused(module="struct_change_nothing", cfg="rpass2")]

#[cfg(rpass1)]
pub struct X {
    pub x: u32,
}

#[cfg(rpass2)]
pub struct X {
    pub x: u32,
}

#[cfg(rpass1)]
impl X {
    fn get(&self) -> u32 {
        self.x
    }
    pub fn dbl(&self) -> u32 {
        self.get() + self.get()
    }
}

#[cfg(rpass2)]
impl X {
    fn get(&self) -> u32 {
        self.x
    }
    pub fn dbl(&self) -> u32 {
        self.get() + self.get()
    }
}

pub struct EmbedX {
    x: X,
}

pub struct Y {
    pub y: char,
}

#[rustc_clean(label="TypeckTables", cfg="rpass2")]
pub fn use_X() -> u32 {
    let x: X = X { x: 42 };
    x.x as u32
}

#[rustc_clean(label="TypeckTables", cfg="rpass2")]
pub fn use_EmbedX(x: EmbedX) -> u32 {
    let x: X = X { x: 42 };
    x.x as u32
}

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

pub fn main() {}

pass2 output:

$ rustc -Zquery-dep-graph -Zincremental=inc -Zincremental-info src/struct_change_nothing.rs --cfg=rpass2
incremental: session directory: 4 files hard-linked
incremental: session directory: 0 files copied
incremental: module WorkProductId("struct_change_nothing") is dirty because HirBody("struct_change_nothing/8cd878b::{{impl}}[0]::dbl[0]") changed or was removed
error: expected module named `struct_change_nothing` to be Reused but is Translated
  --> src/struct_change_nothing.rs:21:1
   |
21 | #![rustc_partition_reused(module="struct_change_nothing", cfg="rpass2")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

incremental: 23693 nodes in dep-graph
incremental: 39644 edges in dep-graph
incremental: 1080 nodes in reduced dep-graph
incremental: 3646 edges in serialized dep-graph
incremental: 686 hashes in serialized dep-graph
incremental: re-using 0 out of 1 modules
error: aborting due to previous error(s)
$ rustc --version
rustc 1.19.0-nightly (76242aebb 2017-06-06)
$ cargo --version
cargo 0.20.0-nightly (38ca9b702 2017-05-14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions