about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2014-05-14 15:24:10 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2014-05-15 11:09:26 +0200
commit5236af8c0ff33d60e30fdde367b476a1efa1d09e (patch)
tree4c0b1c5e4c1e2bd34dcff4b2f6f97f1ac319587e /src
parent930308b16e72f220cbca1743cc0c8e6b9e75b3c5 (diff)
downloadrust-5236af8c0ff33d60e30fdde367b476a1efa1d09e.tar.gz
rust-5236af8c0ff33d60e30fdde367b476a1efa1d09e.zip
Added tests checking that changes in type sig are recognized in SVH.
(Only after adding the tests did I realize that this is not really a
special case at the AST level; as far as the visitor is concerned,
`int` and `i32` and `i64` are just idents.)
Diffstat (limited to 'src')
-rw-r--r--src/test/auxiliary/svh-a-change-type-arg.rs37
-rw-r--r--src/test/auxiliary/svh-a-change-type-ret.rs37
-rw-r--r--src/test/auxiliary/svh-a-change-type-static.rs37
-rw-r--r--src/test/compile-fail/svh-change-type-arg.rs24
-rw-r--r--src/test/compile-fail/svh-change-type-ret.rs24
-rw-r--r--src/test/compile-fail/svh-change-type-static.rs24
6 files changed, 183 insertions, 0 deletions
diff --git a/src/test/auxiliary/svh-a-change-type-arg.rs b/src/test/auxiliary/svh-a-change-type-arg.rs
new file mode 100644
index 00000000000..33f2bf862ed
--- /dev/null
+++ b/src/test/auxiliary/svh-a-change-type-arg.rs
@@ -0,0 +1,37 @@
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![feature(macro_rules)]
+
+#![crate_id = "a"]
+
+macro_rules! three {
+    () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : int = 2;
+
+pub fn foo<T:U>(_: i32) -> int {
+    3
+}
+
+pub fn an_unused_name() -> int {
+    4
+}
diff --git a/src/test/auxiliary/svh-a-change-type-ret.rs b/src/test/auxiliary/svh-a-change-type-ret.rs
new file mode 100644
index 00000000000..3eea77fdb95
--- /dev/null
+++ b/src/test/auxiliary/svh-a-change-type-ret.rs
@@ -0,0 +1,37 @@
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![feature(macro_rules)]
+
+#![crate_id = "a"]
+
+macro_rules! three {
+    () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : int = 2;
+
+pub fn foo<T:U>(_: int) -> i64 {
+    3
+}
+
+pub fn an_unused_name() -> i32 {
+    4
+}
diff --git a/src/test/auxiliary/svh-a-change-type-static.rs b/src/test/auxiliary/svh-a-change-type-static.rs
new file mode 100644
index 00000000000..ff8b8d6db4c
--- /dev/null
+++ b/src/test/auxiliary/svh-a-change-type-static.rs
@@ -0,0 +1,37 @@
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![feature(macro_rules)]
+
+#![crate_id = "a"]
+
+macro_rules! three {
+    () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : i32 = 2;
+
+pub fn foo<T:U>(_: int) -> int {
+    3
+}
+
+pub fn an_unused_name() -> int {
+    4
+}
diff --git a/src/test/compile-fail/svh-change-type-arg.rs b/src/test/compile-fail/svh-change-type-arg.rs
new file mode 100644
index 00000000000..77b0a9211ca
--- /dev/null
+++ b/src/test/compile-fail/svh-change-type-arg.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// note that these aux-build directives must be in this order
+// aux-build:svh-a-base.rs
+// aux-build:svh-b.rs
+// aux-build:svh-a-change-type-arg.rs
+
+#![feature(macro_rules)]
+
+extern crate a;
+extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+//~^ NOTE: perhaps this crate needs to be recompiled
+
+fn main() {
+    b::foo()
+}
diff --git a/src/test/compile-fail/svh-change-type-ret.rs b/src/test/compile-fail/svh-change-type-ret.rs
new file mode 100644
index 00000000000..13dcfa3b5da
--- /dev/null
+++ b/src/test/compile-fail/svh-change-type-ret.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// note that these aux-build directives must be in this order
+// aux-build:svh-a-base.rs
+// aux-build:svh-b.rs
+// aux-build:svh-a-change-type-ret.rs
+
+#![feature(macro_rules)]
+
+extern crate a;
+extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+//~^ NOTE: perhaps this crate needs to be recompiled
+
+fn main() {
+    b::foo()
+}
diff --git a/src/test/compile-fail/svh-change-type-static.rs b/src/test/compile-fail/svh-change-type-static.rs
new file mode 100644
index 00000000000..7d26bdd15fb
--- /dev/null
+++ b/src/test/compile-fail/svh-change-type-static.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// note that these aux-build directives must be in this order
+// aux-build:svh-a-base.rs
+// aux-build:svh-b.rs
+// aux-build:svh-a-change-type-static.rs
+
+#![feature(macro_rules)]
+
+extern crate a;
+extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+//~^ NOTE: perhaps this crate needs to be recompiled
+
+fn main() {
+    b::foo()
+}