From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/svh/auxiliary/changing-crates-a1.rs | 3 +++ src/test/ui/svh/auxiliary/changing-crates-a2.rs | 3 +++ src/test/ui/svh/auxiliary/changing-crates-b.rs | 5 ++++ src/test/ui/svh/auxiliary/svh-a-base.rs | 25 ++++++++++++++++++++ src/test/ui/svh/auxiliary/svh-a-change-lit.rs | 25 ++++++++++++++++++++ .../svh/auxiliary/svh-a-change-significant-cfg.rs | 27 ++++++++++++++++++++++ .../ui/svh/auxiliary/svh-a-change-trait-bound.rs | 25 ++++++++++++++++++++ src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs | 25 ++++++++++++++++++++ src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs | 25 ++++++++++++++++++++ .../ui/svh/auxiliary/svh-a-change-type-static.rs | 25 ++++++++++++++++++++ src/test/ui/svh/auxiliary/svh-b.rs | 13 +++++++++++ src/test/ui/svh/auxiliary/svh-uta-base.rs | 22 ++++++++++++++++++ .../ui/svh/auxiliary/svh-uta-change-use-trait.rs | 22 ++++++++++++++++++ src/test/ui/svh/auxiliary/svh-utb.rs | 12 ++++++++++ 14 files changed, 257 insertions(+) create mode 100644 src/test/ui/svh/auxiliary/changing-crates-a1.rs create mode 100644 src/test/ui/svh/auxiliary/changing-crates-a2.rs create mode 100644 src/test/ui/svh/auxiliary/changing-crates-b.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-base.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-change-lit.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs create mode 100644 src/test/ui/svh/auxiliary/svh-a-change-type-static.rs create mode 100644 src/test/ui/svh/auxiliary/svh-b.rs create mode 100644 src/test/ui/svh/auxiliary/svh-uta-base.rs create mode 100644 src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs create mode 100644 src/test/ui/svh/auxiliary/svh-utb.rs (limited to 'src/test/ui/svh/auxiliary') diff --git a/src/test/ui/svh/auxiliary/changing-crates-a1.rs b/src/test/ui/svh/auxiliary/changing-crates-a1.rs new file mode 100644 index 000000000..bc0559b8b --- /dev/null +++ b/src/test/ui/svh/auxiliary/changing-crates-a1.rs @@ -0,0 +1,3 @@ +#![crate_name = "a"] + +pub fn foo() {} diff --git a/src/test/ui/svh/auxiliary/changing-crates-a2.rs b/src/test/ui/svh/auxiliary/changing-crates-a2.rs new file mode 100644 index 000000000..fafc6d5b1 --- /dev/null +++ b/src/test/ui/svh/auxiliary/changing-crates-a2.rs @@ -0,0 +1,3 @@ +#![crate_name = "a"] + +pub fn foo() { println!("hello!"); } diff --git a/src/test/ui/svh/auxiliary/changing-crates-b.rs b/src/test/ui/svh/auxiliary/changing-crates-b.rs new file mode 100644 index 000000000..f9ce29e4c --- /dev/null +++ b/src/test/ui/svh/auxiliary/changing-crates-b.rs @@ -0,0 +1,5 @@ +#![crate_name = "b"] + +extern crate a; + +pub fn foo() { a::foo::(); } diff --git a/src/test/ui/svh/auxiliary/svh-a-base.rs b/src/test/ui/svh/auxiliary/svh-a-base.rs new file mode 100644 index 000000000..36b41fc81 --- /dev/null +++ b/src/test/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(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-a-change-lit.rs b/src/test/ui/svh/auxiliary/svh-a-change-lit.rs new file mode 100644 index 000000000..c76f2c992 --- /dev/null +++ b/src/test/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(_: isize) -> isize { + 0 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs b/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs new file mode 100644 index 000000000..37f59c97e --- /dev/null +++ b/src/test/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(_: isize) -> isize { + 3 +} + +#[cfg(not(some_flag))] +pub fn an_unused_name() -> isize { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs b/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs new file mode 100644 index 000000000..be24b1e22 --- /dev/null +++ b/src/test/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(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs new file mode 100644 index 000000000..3fe102245 --- /dev/null +++ b/src/test/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(_: i32) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs new file mode 100644 index 000000000..06e4fad06 --- /dev/null +++ b/src/test/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(_: isize) -> i64 { + 3 +} + +pub fn an_unused_name() -> i32 { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs new file mode 100644 index 000000000..440cb3213 --- /dev/null +++ b/src/test/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(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/src/test/ui/svh/auxiliary/svh-b.rs b/src/test/ui/svh/auxiliary/svh-b.rs new file mode 100644 index 000000000..57029f708 --- /dev/null +++ b/src/test/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/src/test/ui/svh/auxiliary/svh-uta-base.rs b/src/test/ui/svh/auxiliary/svh-uta-base.rs new file mode 100644 index 000000000..221a096e0 --- /dev/null +++ b/src/test/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(_: isize) -> isize { + use traits::TraitA; + let v = (); + v.val() +} diff --git a/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs b/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs new file mode 100644 index 000000000..823d29571 --- /dev/null +++ b/src/test/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(_: isize) -> isize { + use traits::TraitB; + let v = (); + v.val() +} diff --git a/src/test/ui/svh/auxiliary/svh-utb.rs b/src/test/ui/svh/auxiliary/svh-utb.rs new file mode 100644 index 000000000..a03e29dce --- /dev/null +++ b/src/test/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); } -- cgit v1.2.3