about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo.net>2017-07-07 14:23:38 +0200
committerMichael Woerister <michaelwoerister@posteo.net>2017-07-07 14:23:38 +0200
commitbca857021efb4fe5288f596f2553878dd4bed241 (patch)
treedd7a8134c9b68ced3f819fe460f3aae7e4e04588 /src/test
parentafb853a3d742ada964ea06cccd422b08ea250cd3 (diff)
incr.comp.: Don't include span information in the ICH of type definitions.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/incremental/spans_in_type_debuginfo.rs63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/test/incremental/spans_in_type_debuginfo.rs b/src/test/incremental/spans_in_type_debuginfo.rs
new file mode 100644
index 00000000000..7d8e6c9d9d7
--- /dev/null
+++ b/src/test/incremental/spans_in_type_debuginfo.rs
@@ -0,0 +1,63 @@
+// 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 that moving a type definition within a source file does not affect
+// re-compilation.
+
+// revisions:rpass1 rpass2
+// compile-flags: -Z query-dep-graph -g
+
+#![rustc_partition_reused(module="spans_in_type_debuginfo", cfg="rpass2")]
+#![rustc_partition_reused(module="spans_in_type_debuginfo-structs", cfg="rpass2")]
+#![rustc_partition_reused(module="spans_in_type_debuginfo-enums", cfg="rpass2")]
+
+#![feature(rustc_attrs)]
+
+mod structs {
+    #[cfg(rpass1)]
+    pub struct X {
+        pub x: u32,
+    }
+
+    #[cfg(rpass2)]
+    pub struct X {
+        pub x: u32,
+    }
+
+    pub fn foo(x: X) -> u32 {
+        x.x
+    }
+}
+
+mod enums {
+    #[cfg(rpass1)]
+    pub enum X {
+        A { x: u32 },
+        B(u32),
+    }
+
+    #[cfg(rpass2)]
+    pub enum X {
+        A { x: u32 },
+        B(u32),
+    }
+
+    pub fn foo(x: X) -> u32 {
+        match x {
+            X::A { x } => x,
+            X::B(x) => x,
+        }
+    }
+}
+
+pub fn main() {
+    let _ = structs::foo(structs::X { x: 1 });
+    let _ = enums::foo(enums::X::A { x: 2 });
+}