Skip to content

Commit 5236af8

Browse files
committed
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.)
1 parent 930308b commit 5236af8

6 files changed

+183
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! The `svh-a-*.rs` files are all deviations from the base file
12+
//! svh-a-base.rs with some difference (usually in `fn foo`) that
13+
//! should not affect the strict version hash (SVH) computation
14+
//! (#14132).
15+
16+
#![feature(macro_rules)]
17+
18+
#![crate_id = "a"]
19+
20+
macro_rules! three {
21+
() => { 3 }
22+
}
23+
24+
pub trait U {}
25+
pub trait V {}
26+
impl U for () {}
27+
impl V for () {}
28+
29+
static A_CONSTANT : int = 2;
30+
31+
pub fn foo<T:U>(_: i32) -> int {
32+
3
33+
}
34+
35+
pub fn an_unused_name() -> int {
36+
4
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! The `svh-a-*.rs` files are all deviations from the base file
12+
//! svh-a-base.rs with some difference (usually in `fn foo`) that
13+
//! should not affect the strict version hash (SVH) computation
14+
//! (#14132).
15+
16+
#![feature(macro_rules)]
17+
18+
#![crate_id = "a"]
19+
20+
macro_rules! three {
21+
() => { 3 }
22+
}
23+
24+
pub trait U {}
25+
pub trait V {}
26+
impl U for () {}
27+
impl V for () {}
28+
29+
static A_CONSTANT : int = 2;
30+
31+
pub fn foo<T:U>(_: int) -> i64 {
32+
3
33+
}
34+
35+
pub fn an_unused_name() -> i32 {
36+
4
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! The `svh-a-*.rs` files are all deviations from the base file
12+
//! svh-a-base.rs with some difference (usually in `fn foo`) that
13+
//! should not affect the strict version hash (SVH) computation
14+
//! (#14132).
15+
16+
#![feature(macro_rules)]
17+
18+
#![crate_id = "a"]
19+
20+
macro_rules! three {
21+
() => { 3 }
22+
}
23+
24+
pub trait U {}
25+
pub trait V {}
26+
impl U for () {}
27+
impl V for () {}
28+
29+
static A_CONSTANT : i32 = 2;
30+
31+
pub fn foo<T:U>(_: int) -> int {
32+
3
33+
}
34+
35+
pub fn an_unused_name() -> int {
36+
4
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// note that these aux-build directives must be in this order
12+
// aux-build:svh-a-base.rs
13+
// aux-build:svh-b.rs
14+
// aux-build:svh-a-change-type-arg.rs
15+
16+
#![feature(macro_rules)]
17+
18+
extern crate a;
19+
extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
20+
//~^ NOTE: perhaps this crate needs to be recompiled
21+
22+
fn main() {
23+
b::foo()
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// note that these aux-build directives must be in this order
12+
// aux-build:svh-a-base.rs
13+
// aux-build:svh-b.rs
14+
// aux-build:svh-a-change-type-ret.rs
15+
16+
#![feature(macro_rules)]
17+
18+
extern crate a;
19+
extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
20+
//~^ NOTE: perhaps this crate needs to be recompiled
21+
22+
fn main() {
23+
b::foo()
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// note that these aux-build directives must be in this order
12+
// aux-build:svh-a-base.rs
13+
// aux-build:svh-b.rs
14+
// aux-build:svh-a-change-type-static.rs
15+
16+
#![feature(macro_rules)]
17+
18+
extern crate a;
19+
extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
20+
//~^ NOTE: perhaps this crate needs to be recompiled
21+
22+
fn main() {
23+
b::foo()
24+
}

0 commit comments

Comments
 (0)