diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-07-11 07:35:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 07:35:18 +0200 |
| commit | 3d6eb225e26448b09fdec1ba7222f3e7174c6ac2 (patch) | |
| tree | 17d044aac71ec4a410ebbb33c8f8349d46d395e1 /tests/ui/auto-traits | |
| parent | 2730bebbf88ae9473b339bb7f66eb77fb2c9fa6f (diff) | |
| parent | 3ad95cccf9b3af7e527869a1eb130217971b7a57 (diff) | |
| download | rust-3d6eb225e26448b09fdec1ba7222f3e7174c6ac2.tar.gz rust-3d6eb225e26448b09fdec1ba7222f3e7174c6ac2.zip | |
Rollup merge of #143302 - Kivooeo:tf27, r=tgross35
`tests/ui`: A New Order [27/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
Diffstat (limited to 'tests/ui/auto-traits')
| -rw-r--r-- | tests/ui/auto-traits/auto-traits-type-parameter.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/auto-traits/auto-traits-type-parameter.rs b/tests/ui/auto-traits/auto-traits-type-parameter.rs new file mode 100644 index 00000000000..0c448f58996 --- /dev/null +++ b/tests/ui/auto-traits/auto-traits-type-parameter.rs @@ -0,0 +1,37 @@ +//! Checks how type parameters interact with auto-traits like `Send` and `Sync` with implicit +//! bounds + +//@ run-pass + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +fn p_foo<T>(_pinned: T) {} +fn s_foo<T>(_shared: T) {} +fn u_foo<T: Send>(_unique: T) {} + +struct r { + i: isize, +} + +impl Drop for r { + fn drop(&mut self) {} +} + +fn r(i: isize) -> r { + r { i } +} + +pub fn main() { + p_foo(r(10)); + + p_foo::<Box<_>>(Box::new(r(10))); + p_foo::<Box<_>>(Box::new(10)); + p_foo(10); + + s_foo::<Box<_>>(Box::new(10)); + s_foo(10); + + u_foo::<Box<_>>(Box::new(10)); + u_foo(10); +} |
