diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/svh | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/svh')
30 files changed, 468 insertions, 0 deletions
diff --git a/tests/ui/svh/auxiliary/changing-crates-a1.rs b/tests/ui/svh/auxiliary/changing-crates-a1.rs new file mode 100644 index 000000000..bc0559b8b --- /dev/null +++ b/tests/ui/svh/auxiliary/changing-crates-a1.rs @@ -0,0 +1,3 @@ +#![crate_name = "a"] + +pub fn foo<T>() {} diff --git a/tests/ui/svh/auxiliary/changing-crates-a2.rs b/tests/ui/svh/auxiliary/changing-crates-a2.rs new file mode 100644 index 000000000..fafc6d5b1 --- /dev/null +++ b/tests/ui/svh/auxiliary/changing-crates-a2.rs @@ -0,0 +1,3 @@ +#![crate_name = "a"] + +pub fn foo<T>() { println!("hello!"); } diff --git a/tests/ui/svh/auxiliary/changing-crates-b.rs b/tests/ui/svh/auxiliary/changing-crates-b.rs new file mode 100644 index 000000000..f9ce29e4c --- /dev/null +++ b/tests/ui/svh/auxiliary/changing-crates-b.rs @@ -0,0 +1,5 @@ +#![crate_name = "b"] + +extern crate a; + +pub fn foo() { a::foo::<isize>(); } diff --git a/tests/ui/svh/auxiliary/svh-a-base.rs b/tests/ui/svh/auxiliary/svh-a-base.rs new file mode 100644 index 000000000..36b41fc81 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-base.rs @@ -0,0 +1,25 @@ +//! 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). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +pub fn foo<T:U>(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-a-change-lit.rs b/tests/ui/svh/auxiliary/svh-a-change-lit.rs new file mode 100644 index 000000000..c76f2c992 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-change-lit.rs @@ -0,0 +1,25 @@ +//! 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). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +pub fn foo<T:U>(_: isize) -> isize { + 0 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-a-change-significant-cfg.rs b/tests/ui/svh/auxiliary/svh-a-change-significant-cfg.rs new file mode 100644 index 000000000..37f59c97e --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-change-significant-cfg.rs @@ -0,0 +1,27 @@ +//! 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). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +#[cfg(some_flag)] +pub fn foo<T:U>(_: isize) -> isize { + 3 +} + +#[cfg(not(some_flag))] +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-a-change-trait-bound.rs b/tests/ui/svh/auxiliary/svh-a-change-trait-bound.rs new file mode 100644 index 000000000..be24b1e22 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-change-trait-bound.rs @@ -0,0 +1,25 @@ +//! 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). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +pub fn foo<T:V>(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-a-change-type-arg.rs b/tests/ui/svh/auxiliary/svh-a-change-type-arg.rs new file mode 100644 index 000000000..3fe102245 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-change-type-arg.rs @@ -0,0 +1,25 @@ +//! 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). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +pub fn foo<T:U>(_: i32) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-a-change-type-ret.rs b/tests/ui/svh/auxiliary/svh-a-change-type-ret.rs new file mode 100644 index 000000000..06e4fad06 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-change-type-ret.rs @@ -0,0 +1,25 @@ +//! 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). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +pub fn foo<T:U>(_: isize) -> i64 { + 3 +} + +pub fn an_unused_name() -> i32 { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-a-change-type-static.rs b/tests/ui/svh/auxiliary/svh-a-change-type-static.rs new file mode 100644 index 000000000..440cb3213 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-a-change-type-static.rs @@ -0,0 +1,25 @@ +//! 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). + +#![crate_name = "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>(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/svh/auxiliary/svh-b.rs b/tests/ui/svh/auxiliary/svh-b.rs new file mode 100644 index 000000000..57029f708 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-b.rs @@ -0,0 +1,13 @@ +//! This is a client of the `a` crate defined in `svn-a-base.rs`. The +//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use +//! it by swapping in a different object code library crate built from +//! some variant of `svn-a-base.rs`, and then we are checking if the +//! compiler properly ignores or accepts the change, based on whether +//! the change could affect the downstream crate content or not +//! (#14132). + +#![crate_name = "b"] + +extern crate a; + +pub fn foo() { assert_eq!(a::foo::<()>(0), 3); } diff --git a/tests/ui/svh/auxiliary/svh-uta-base.rs b/tests/ui/svh/auxiliary/svh-uta-base.rs new file mode 100644 index 000000000..221a096e0 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-uta-base.rs @@ -0,0 +1,22 @@ +//! "svh-uta-trait.rs" is checking that we detect a +//! change from `use foo::TraitB` to use `foo::TraitB` in the hash +//! (SVH) computation (#14132), since that will affect method +//! resolution. +//! +//! This is the upstream crate. + +#![crate_name = "uta"] + +mod traits { + pub trait TraitA { fn val(&self) -> isize { 2 } } + pub trait TraitB { fn val(&self) -> isize { 3 } } +} + +impl traits::TraitA for () {} +impl traits::TraitB for () {} + +pub fn foo<T>(_: isize) -> isize { + use traits::TraitA; + let v = (); + v.val() +} diff --git a/tests/ui/svh/auxiliary/svh-uta-change-use-trait.rs b/tests/ui/svh/auxiliary/svh-uta-change-use-trait.rs new file mode 100644 index 000000000..823d29571 --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-uta-change-use-trait.rs @@ -0,0 +1,22 @@ +//! "svh-uta-trait.rs" is checking that we detect a +//! change from `use foo::TraitB` to use `foo::TraitB` in the hash +//! (SVH) computation (#14132), since that will affect method +//! resolution. +//! +//! This is the upstream crate. + +#![crate_name = "uta"] + +mod traits { + pub trait TraitA { fn val(&self) -> isize { 2 } } + pub trait TraitB { fn val(&self) -> isize { 3 } } +} + +impl traits::TraitA for () {} +impl traits::TraitB for () {} + +pub fn foo<T>(_: isize) -> isize { + use traits::TraitB; + let v = (); + v.val() +} diff --git a/tests/ui/svh/auxiliary/svh-utb.rs b/tests/ui/svh/auxiliary/svh-utb.rs new file mode 100644 index 000000000..a03e29dce --- /dev/null +++ b/tests/ui/svh/auxiliary/svh-utb.rs @@ -0,0 +1,12 @@ +//! "svh-uta-trait.rs" is checking that we detect a +//! change from `use foo::TraitB` to use `foo::TraitB` in the hash +//! (SVH) computation (#14132), since that will affect method +//! resolution. +//! +//! This is the downstream crate. + +#![crate_name = "utb"] + +extern crate uta; + +pub fn foo() { assert_eq!(uta::foo::<()>(0), 3); } diff --git a/tests/ui/svh/changing-crates.rs b/tests/ui/svh/changing-crates.rs new file mode 100644 index 000000000..66298e06e --- /dev/null +++ b/tests/ui/svh/changing-crates.rs @@ -0,0 +1,10 @@ +// note that these aux-build directives must be in this order +// aux-build:changing-crates-a1.rs +// aux-build:changing-crates-b.rs +// aux-build:changing-crates-a2.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() {} diff --git a/tests/ui/svh/changing-crates.stderr b/tests/ui/svh/changing-crates.stderr new file mode 100644 index 000000000..caefdfc96 --- /dev/null +++ b/tests/ui/svh/changing-crates.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/changing-crates.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-change-lit.rs b/tests/ui/svh/svh-change-lit.rs new file mode 100644 index 000000000..ea500711b --- /dev/null +++ b/tests/ui/svh/svh-change-lit.rs @@ -0,0 +1,12 @@ +// 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-lit.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() { + b::foo() +} diff --git a/tests/ui/svh/svh-change-lit.stderr b/tests/ui/svh/svh-change-lit.stderr new file mode 100644 index 000000000..5e890c6aa --- /dev/null +++ b/tests/ui/svh/svh-change-lit.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-lit.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-change-significant-cfg.rs b/tests/ui/svh/svh-change-significant-cfg.rs new file mode 100644 index 000000000..ff919ea83 --- /dev/null +++ b/tests/ui/svh/svh-change-significant-cfg.rs @@ -0,0 +1,12 @@ +// 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-significant-cfg.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() { + b::foo() +} diff --git a/tests/ui/svh/svh-change-significant-cfg.stderr b/tests/ui/svh/svh-change-significant-cfg.stderr new file mode 100644 index 000000000..dcc250d52 --- /dev/null +++ b/tests/ui/svh/svh-change-significant-cfg.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-significant-cfg.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-change-trait-bound.rs b/tests/ui/svh/svh-change-trait-bound.rs new file mode 100644 index 000000000..a4ba06eaf --- /dev/null +++ b/tests/ui/svh/svh-change-trait-bound.rs @@ -0,0 +1,12 @@ +// 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-trait-bound.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() { + b::foo() +} diff --git a/tests/ui/svh/svh-change-trait-bound.stderr b/tests/ui/svh/svh-change-trait-bound.stderr new file mode 100644 index 000000000..2035993d2 --- /dev/null +++ b/tests/ui/svh/svh-change-trait-bound.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-trait-bound.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-change-type-arg.rs b/tests/ui/svh/svh-change-type-arg.rs new file mode 100644 index 000000000..d1651814b --- /dev/null +++ b/tests/ui/svh/svh-change-type-arg.rs @@ -0,0 +1,12 @@ +// 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 +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() { + b::foo() +} diff --git a/tests/ui/svh/svh-change-type-arg.stderr b/tests/ui/svh/svh-change-type-arg.stderr new file mode 100644 index 000000000..eef85aa95 --- /dev/null +++ b/tests/ui/svh/svh-change-type-arg.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-arg.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-change-type-ret.rs b/tests/ui/svh/svh-change-type-ret.rs new file mode 100644 index 000000000..a4be50a64 --- /dev/null +++ b/tests/ui/svh/svh-change-type-ret.rs @@ -0,0 +1,12 @@ +// 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 +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() { + b::foo() +} diff --git a/tests/ui/svh/svh-change-type-ret.stderr b/tests/ui/svh/svh-change-type-ret.stderr new file mode 100644 index 000000000..247f74e50 --- /dev/null +++ b/tests/ui/svh/svh-change-type-ret.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-ret.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-change-type-static.rs b/tests/ui/svh/svh-change-type-static.rs new file mode 100644 index 000000000..c470761be --- /dev/null +++ b/tests/ui/svh/svh-change-type-static.rs @@ -0,0 +1,12 @@ +// 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 +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() { + b::foo() +} diff --git a/tests/ui/svh/svh-change-type-static.stderr b/tests/ui/svh/svh-change-type-static.stderr new file mode 100644 index 000000000..78b54f227 --- /dev/null +++ b/tests/ui/svh/svh-change-type-static.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-static.rs:8:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. diff --git a/tests/ui/svh/svh-use-trait.rs b/tests/ui/svh/svh-use-trait.rs new file mode 100644 index 000000000..e144fdffb --- /dev/null +++ b/tests/ui/svh/svh-use-trait.rs @@ -0,0 +1,17 @@ +// note that these aux-build directives must be in this order +// aux-build:svh-uta-base.rs +// aux-build:svh-utb.rs +// aux-build:svh-uta-change-use-trait.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +//! "svh-uta-trait.rs" is checking that we detect a +//! change from `use foo::TraitB` to use `foo::TraitB` in the hash +//! (SVH) computation (#14132), since that will affect method +//! resolution. + +extern crate uta; +extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends + +fn main() { + utb::foo() +} diff --git a/tests/ui/svh/svh-use-trait.stderr b/tests/ui/svh/svh-use-trait.stderr new file mode 100644 index 000000000..d8a81864d --- /dev/null +++ b/tests/ui/svh/svh-use-trait.stderr @@ -0,0 +1,14 @@ +error[E0460]: found possibly newer version of crate `uta` which `utb` depends on + --> $DIR/svh-use-trait.rs:13:1 + | +LL | extern crate utb; + | ^^^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `uta`: $PATH_uta + crate `utb`: $PATH_utb + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0460`. |