chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

7
vendor/dyn-clone/tests/compiletest.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
#[rustversion::attr(not(nightly), ignore = "requires nightly")]
#[cfg_attr(miri, ignore = "incompatible with miri")]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
}

57
vendor/dyn-clone/tests/macros.rs vendored Normal file
View File

@@ -0,0 +1,57 @@
#![allow(clippy::extra_unused_type_parameters)]
use dyn_clone::{clone_trait_object, DynClone};
fn assert_clone<T: Clone>() {}
#[test]
fn test_plain() {
trait Trait: DynClone {}
clone_trait_object!(Trait);
assert_clone::<Box<dyn Trait>>();
assert_clone::<Box<dyn Trait + Send>>();
assert_clone::<Box<dyn Trait + Sync>>();
assert_clone::<Box<dyn Trait + Send + Sync>>();
}
#[test]
fn test_type_parameter() {
trait Trait<T>: DynClone {}
clone_trait_object!(<T> Trait<T>);
assert_clone::<Box<dyn Trait<u32>>>();
}
#[test]
fn test_generic_bound() {
trait Trait<T: PartialEq<T>, U>: DynClone {}
clone_trait_object!(<T: PartialEq<T>, U> Trait<T, U>);
assert_clone::<Box<dyn Trait<u32, ()>>>();
}
#[test]
fn test_where_clause() {
trait Trait<T>: DynClone
where
T: Clone,
{
}
clone_trait_object!(<T> Trait<T> where T: Clone);
assert_clone::<Box<dyn Trait<u32>>>();
}
#[test]
fn test_lifetime() {
trait Trait<'a>: DynClone {}
clone_trait_object!(<'a> Trait<'a>);
assert_clone::<Box<dyn Trait>>();
}

64
vendor/dyn-clone/tests/trait.rs vendored Normal file
View File

@@ -0,0 +1,64 @@
#![cfg(target_has_atomic = "ptr")]
use dyn_clone::DynClone;
use std::fmt::{self, Display};
use std::sync::{Arc, Mutex};
struct Log {
id: u64,
events: Arc<Mutex<Vec<String>>>,
}
impl Clone for Log {
fn clone(&self) -> Self {
Log {
id: self.id + 1,
events: self.events.clone(),
}
}
}
impl Display for Log {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "id={}", self.id)
}
}
impl Drop for Log {
fn drop(&mut self) {
self.events.lock().unwrap().push(format!("dropping {self}"));
}
}
#[test]
fn clone_sized() {
let arc = Arc::new(0);
assert_eq!(Arc::strong_count(&arc), 1);
let c = dyn_clone::clone(&arc);
assert_eq!(Arc::strong_count(&arc), 2);
drop(c);
assert_eq!(Arc::strong_count(&arc), 1);
}
#[test]
fn clone_trait_object() {
trait MyTrait: Display + Sync + DynClone {}
impl MyTrait for Log {}
let events = Arc::new(Mutex::new(Vec::new()));
let mut expected = Vec::new();
{
let b11: Box<dyn MyTrait> = Box::new(Log {
id: 11,
events: events.clone(),
});
let b12 = dyn_clone::clone_box(&*b11);
assert_eq!(b11.to_string(), "id=11");
assert_eq!(b12.to_string(), "id=12");
expected.push("dropping id=12".to_owned());
expected.push("dropping id=11".to_owned());
}
assert_eq!(*events.lock().unwrap(), expected);
}

View File

@@ -0,0 +1,5 @@
pub trait MyTrait {}
dyn_clone::clone_trait_object!(MyTrait);
fn main() {}

View File

@@ -0,0 +1,91 @@
error[E0277]: the trait bound `dyn MyTrait: DynClone` is not satisfied
--> tests/ui/missing-supertrait.rs:3:1
|
3 | dyn_clone::clone_trait_object!(MyTrait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `Clone` is not implemented for `dyn MyTrait`
| required by a bound introduced by this call
|
= help: the following other types implement trait `DynClone`:
[T]
str
= note: required for `dyn MyTrait` to implement `DynClone`
note: required by a bound in `clone_box`
--> src/lib.rs
|
| pub fn clone_box<T>(t: &T) -> Box<T>
| --------- required by a bound in this function
| where
| T: ?Sized + DynClone,
| ^^^^^^^^ required by this bound in `clone_box`
= note: this error originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `dyn_clone::clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `dyn MyTrait + Send: DynClone` is not satisfied
--> tests/ui/missing-supertrait.rs:3:1
|
3 | dyn_clone::clone_trait_object!(MyTrait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `Clone` is not implemented for `dyn MyTrait + Send`
| required by a bound introduced by this call
|
= help: the following other types implement trait `DynClone`:
[T]
str
= note: required for `dyn MyTrait + Send` to implement `DynClone`
note: required by a bound in `clone_box`
--> src/lib.rs
|
| pub fn clone_box<T>(t: &T) -> Box<T>
| --------- required by a bound in this function
| where
| T: ?Sized + DynClone,
| ^^^^^^^^ required by this bound in `clone_box`
= note: this error originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `dyn_clone::clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `dyn MyTrait + Sync: DynClone` is not satisfied
--> tests/ui/missing-supertrait.rs:3:1
|
3 | dyn_clone::clone_trait_object!(MyTrait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `Clone` is not implemented for `dyn MyTrait + Sync`
| required by a bound introduced by this call
|
= help: the following other types implement trait `DynClone`:
[T]
str
= note: required for `dyn MyTrait + Sync` to implement `DynClone`
note: required by a bound in `clone_box`
--> src/lib.rs
|
| pub fn clone_box<T>(t: &T) -> Box<T>
| --------- required by a bound in this function
| where
| T: ?Sized + DynClone,
| ^^^^^^^^ required by this bound in `clone_box`
= note: this error originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `dyn_clone::clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `dyn MyTrait + Send + Sync: DynClone` is not satisfied
--> tests/ui/missing-supertrait.rs:3:1
|
3 | dyn_clone::clone_trait_object!(MyTrait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `Clone` is not implemented for `dyn MyTrait + Send + Sync`
| required by a bound introduced by this call
|
= help: the following other types implement trait `DynClone`:
[T]
str
= note: required for `dyn MyTrait + Send + Sync` to implement `DynClone`
note: required by a bound in `clone_box`
--> src/lib.rs
|
| pub fn clone_box<T>(t: &T) -> Box<T>
| --------- required by a bound in this function
| where
| T: ?Sized + DynClone,
| ^^^^^^^^ required by this bound in `clone_box`
= note: this error originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `dyn_clone::clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info)