diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 3bcaef265f24b..db9fc005f2175 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -399,7 +399,7 @@ impl<'a> HashStable> for mir::interpret::AllocId { let tcx = tcx.expect("can't hash AllocIds during hir lowering"); if let Some(alloc) = tcx.interpret_interner.get_alloc(*self) { AllocDiscriminant::Alloc.hash_stable(hcx, hasher); - if !hcx.alloc_id_recursion_tracker.insert(*self) { + if hcx.alloc_id_recursion_tracker.insert(*self) { tcx .interpret_interner .get_corresponding_static_def_id(*self) diff --git a/src/test/incremental/issue-49595/auxiliary/lit_a.rs b/src/test/incremental/issue-49595/auxiliary/lit_a.rs new file mode 100644 index 0000000000000..f36baa0548392 --- /dev/null +++ b/src/test/incremental/issue-49595/auxiliary/lit_a.rs @@ -0,0 +1,11 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub const A: &str = "hello"; diff --git a/src/test/incremental/issue-49595/auxiliary/lit_b.rs b/src/test/incremental/issue-49595/auxiliary/lit_b.rs new file mode 100644 index 0000000000000..2252437e45937 --- /dev/null +++ b/src/test/incremental/issue-49595/auxiliary/lit_b.rs @@ -0,0 +1,11 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub const A: &str = "xxxxx"; diff --git a/src/test/incremental/issue-49595/issue_49595.rs b/src/test/incremental/issue-49595/issue_49595.rs new file mode 100644 index 0000000000000..b899e025ff796 --- /dev/null +++ b/src/test/incremental/issue-49595/issue_49595.rs @@ -0,0 +1,42 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions:cfail1 cfail2 cfail3 +// compile-flags: -Z query-dep-graph --test +// must-compile-successfully + +#![feature(rustc_attrs)] +#![crate_type = "rlib"] + +#![rustc_partition_translated(module="issue_49595-tests", cfg="cfail2")] +#![rustc_partition_translated(module="issue_49595-lit_test", cfg="cfail3")] + +mod tests { + #[cfg_attr(not(cfail1), ignore)] + #[test] + fn test() { + } +} + + +// Checks that changing a string literal without changing its span +// takes effect. + +// replacing a module to have a stable span +#[cfg_attr(not(cfail3), path = "auxiliary/lit_a.rs")] +#[cfg_attr(cfail3, path = "auxiliary/lit_b.rs")] +mod lit; + +pub mod lit_test { + #[test] + fn lit_test() { + println!("{}", ::lit::A); + } +}