about summary refs log tree commit diff
path: root/src/test/incremental
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-04-08 10:01:59 +0000
committerbors <bors@rust-lang.org>2018-04-08 10:01:59 +0000
commitbeab37c90480eb3eee1d4b7b7ed03e95c92f72e5 (patch)
treef387f487d61f03feb8a5ce6e77bd0c51ff064c34 /src/test/incremental
parent66fcc564442cdbb3c94a0aeb4bba478a70fdd1eb (diff)
parent3832e8b3e3586005ac6443b417541814749e80d5 (diff)
downloadrust-beab37c90480eb3eee1d4b7b7ed03e95c92f72e5.tar.gz
rust-beab37c90480eb3eee1d4b7b7ed03e95c92f72e5.zip
Auto merge of #49752 - sinkuu:fix_incrcmp_str_lit, r=oli-obk
[incremental] Hash `Allocation`s

`HashSet::insert` returns `true` if the value did not exist, which is the timing we want to hash the `Allocation`.

Fixes #49595

cc @oli-obk
Diffstat (limited to 'src/test/incremental')
-rw-r--r--src/test/incremental/issue-49595/auxiliary/lit_a.rs11
-rw-r--r--src/test/incremental/issue-49595/auxiliary/lit_b.rs11
-rw-r--r--src/test/incremental/issue-49595/issue_49595.rs42
3 files changed, 64 insertions, 0 deletions
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 00000000000..f36baa05483
--- /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 <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.
+
+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 00000000000..2252437e459
--- /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 <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.
+
+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 00000000000..b899e025ff7
--- /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 <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.
+
+// 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);
+    }
+}