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

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");
}

View File

@@ -0,0 +1,36 @@
use std::future::Future;
use std::pin::Pin;
use std::ptr;
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
// Executor for a future that resolves immediately (test only).
#[allow(clippy::missing_panics_doc)]
pub fn block_on_simple<F: Future>(mut fut: F) -> F::Output {
unsafe fn clone(_null: *const ()) -> RawWaker {
unimplemented!()
}
unsafe fn wake(_null: *const ()) {
unimplemented!()
}
unsafe fn wake_by_ref(_null: *const ()) {
unimplemented!()
}
unsafe fn drop(_null: *const ()) {}
let data = ptr::null();
let vtable = &RawWakerVTable::new(clone, wake, wake_by_ref, drop);
let raw_waker = RawWaker::new(data, vtable);
let waker = unsafe { Waker::from_raw(raw_waker) };
let mut cx = Context::from_waker(&waker);
// fut does not move until it gets dropped.
let fut = unsafe { Pin::new_unchecked(&mut fut) };
match fut.poll(&mut cx) {
Poll::Ready(output) => output,
Poll::Pending => panic!("future did not resolve immediately"),
}
}

1728
vendor/async-trait/tests/test.rs vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
use async_trait::async_trait;
pub struct Struct;
#[async_trait]
pub trait Trait {
async fn f((_a, _b): (Struct, Struct)) {
// Expands to something like:
//
// fn f(__arg0: (Struct, Struct)) -> … {
// Box::pin(async move {
// let (_a, _b) = __arg0;
// …
// })
// }
//
// but user's code must not be allowed to name that temporary argument:
let _ = __arg0;
}
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error[E0425]: cannot find value `__arg0` in this scope
--> tests/ui/arg-implementation-detail.rs:18:17
|
18 | let _ = __arg0;
| ^^^^^^ not found in this scope

View File

@@ -0,0 +1,15 @@
#![deny(bare_trait_objects)]
use async_trait::async_trait;
#[async_trait]
trait Trait {
async fn f(&self);
}
#[async_trait]
impl Trait for Send + Sync {
async fn f(&self) {}
}
fn main() {}

View File

@@ -0,0 +1,15 @@
error[E0782]: expected a type, found a trait
--> tests/ui/bare-trait-object.rs:11:16
|
11 | impl Trait for Send + Sync {
| ^^^^^^^^^^^
|
help: you can add the `dyn` keyword if you want a trait object
|
11 | impl Trait for dyn Send + Sync {
| +++
help: alternatively use a blanket implementation to implement `Trait` for all types that also implement `Send + Sync`
|
11 - impl Trait for Send + Sync {
11 + impl<T: Send + Sync> Trait for T {
|

View File

@@ -0,0 +1,26 @@
// https://github.com/rust-lang/rust/issues/93828
use async_trait::async_trait;
pub trait IntoUrl {}
#[async_trait]
pub trait ClientExt {
async fn publish<T: IntoUrl>(&self, url: T);
}
struct Client;
#[async_trait]
impl ClientExt for Client {
async fn publish<T: IntoUrl>(&self, _url: T) {}
}
struct Client2;
#[async_trait]
impl ClientExt for Client2 {
async fn publish<T>(&self, _url: T) {}
}
fn main() {}

View File

@@ -0,0 +1,33 @@
error: future cannot be sent between threads safely
--> tests/ui/consider-restricting.rs:16:5
|
16 | async fn publish<T: IntoUrl>(&self, _url: T) {}
| ^^^^^ future created by async block is not `Send`
|
note: captured value is not `Send`
--> tests/ui/consider-restricting.rs:16:41
|
16 | async fn publish<T: IntoUrl>(&self, _url: T) {}
| ^^^^ has type `T` which is not `Send`
= note: required for the cast from `Pin<Box<{async block@$DIR/tests/ui/consider-restricting.rs:16:5: 16:10}>>` to `Pin<Box<dyn Future<Output = ()> + Send>>`
help: consider further restricting type parameter `T` with trait `Send`
|
16 | async fn publish<T: IntoUrl + std::marker::Send>(&self, _url: T) {}
| +++++++++++++++++++
error: future cannot be sent between threads safely
--> tests/ui/consider-restricting.rs:23:5
|
23 | async fn publish<T>(&self, _url: T) {}
| ^^^^^ future created by async block is not `Send`
|
note: captured value is not `Send`
--> tests/ui/consider-restricting.rs:23:32
|
23 | async fn publish<T>(&self, _url: T) {}
| ^^^^ has type `T` which is not `Send`
= note: required for the cast from `Pin<Box<{async block@$DIR/tests/ui/consider-restricting.rs:23:5: 23:10}>>` to `Pin<Box<dyn Future<Output = ()> + Send>>`
help: consider further restricting type parameter `T` with trait `Send`
|
23 | async fn publish<T + std::marker::Send>(&self, _url: T) {}
| +++++++++++++++++++

View File

@@ -0,0 +1,24 @@
#![allow(unused_macro_rules)]
use async_trait::async_trait;
macro_rules! picky {
($(t:tt)*) => {};
}
#[async_trait]
trait Trait {
async fn method();
}
struct Struct;
#[async_trait]
impl Trait for Struct {
async fn method() {
picky!({ 123, self });
picky!({ 123 });
}
}
fn main() {}

View File

@@ -0,0 +1,21 @@
error: no rules expected `{`
--> tests/ui/delimiter-span.rs:19:16
|
5 | macro_rules! picky {
| ------------------ when calling this macro
...
19 | picky!({ 123, self });
| ^ no rules expected this token in macro call
|
= note: while trying to match sequence start
error: no rules expected `{`
--> tests/ui/delimiter-span.rs:20:16
|
5 | macro_rules! picky {
| ------------------ when calling this macro
...
20 | picky!({ 123 });
| ^ no rules expected this token in macro call
|
= note: while trying to match sequence start

View File

@@ -0,0 +1,23 @@
use async_trait::async_trait;
#[async_trait]
trait Foo {
async fn bar(&self, x: &str, y: &'_ str) -> &'static str;
}
struct S(String);
#[async_trait]
impl Foo for S {
async fn bar(&self, x: &str, y: &'_ str) -> &'static str {
if false {
&self.0
} else if false {
x
} else {
y
}
}
}
fn main() {}

View File

@@ -0,0 +1,29 @@
error: lifetime may not live long enough
--> tests/ui/lifetime-defined-here.rs:12:49
|
12 | async fn bar(&self, x: &str, y: &'_ str) -> &'static str {
| - ^^^^^^^^^^^^ type annotation requires that `'life0` must outlive `'static`
| |
| lifetime `'life0` defined here
error: lifetime may not live long enough
--> tests/ui/lifetime-defined-here.rs:12:49
|
12 | async fn bar(&self, x: &str, y: &'_ str) -> &'static str {
| - ^^^^^^^^^^^^ type annotation requires that `'life1` must outlive `'static`
| |
| lifetime `'life1` defined here
error: lifetime may not live long enough
--> tests/ui/lifetime-defined-here.rs:12:49
|
12 | async fn bar(&self, x: &str, y: &'_ str) -> &'static str {
| -- ^^^^^^^^^^^^ type annotation requires that `'life2` must outlive `'static`
| |
| lifetime `'life2` defined here
help: the following changes may resolve your lifetime errors
|
= help: replace `'life0` with `'static`
= help: replace `'life1` with `'static`
= help: replace `'life2` with `'static`

View File

@@ -0,0 +1,36 @@
use async_trait::async_trait;
struct A;
struct B;
#[async_trait]
pub trait Trait<'r> {
async fn method(&'r self);
}
#[async_trait]
impl Trait for A {
async fn method(&self) {}
}
#[async_trait]
impl<'r> Trait<'r> for B {
async fn method(&self) {}
}
#[async_trait]
pub trait Trait2 {
async fn method<'r>(&'r self);
}
#[async_trait]
impl Trait2 for A {
async fn method(&self) {}
}
#[async_trait]
impl<'r> Trait2<'r> for B {
async fn method(&'r self) {}
}
fn main() {}

View File

@@ -0,0 +1,33 @@
error[E0726]: implicit elided lifetime not allowed here
--> tests/ui/lifetime-span.rs:12:6
|
12 | impl Trait for A {
| ^^^^^ expected lifetime parameter
|
help: indicate the anonymous lifetime
|
12 | impl Trait<'_> for A {
| ++++
error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> tests/ui/lifetime-span.rs:32:10
|
32 | impl<'r> Trait2<'r> for B {
| ^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
note: trait defined here, with 0 lifetime parameters
--> tests/ui/lifetime-span.rs:22:11
|
22 | pub trait Trait2 {
| ^^^^^^
error[E0195]: lifetime parameters or bounds on method `method` do not match the trait declaration
--> tests/ui/lifetime-span.rs:33:14
|
23 | async fn method<'r>(&'r self);
| ---- lifetimes in impl do not match this method in trait
...
33 | async fn method(&'r self) {}
| ^^^^^^^^^^^^^^^^ lifetimes do not match method in trait

View File

@@ -0,0 +1,15 @@
use async_trait::async_trait;
#[async_trait]
pub trait Trait {
async fn method();
}
pub struct Struct;
#[async_trait]
impl Trait for Struct {
fn method() {}
}
fn main() {}

View File

@@ -0,0 +1,8 @@
error[E0195]: lifetime parameters or bounds on associated function `method` do not match the trait declaration
--> tests/ui/missing-async-in-impl.rs:12:14
|
5 | async fn method();
| -------- lifetimes in impl do not match this associated function in trait
...
12 | fn method() {}
| ^ lifetimes do not match associated function in trait

View File

@@ -0,0 +1,15 @@
use async_trait::async_trait;
#[async_trait]
pub trait Trait {
fn method();
}
pub struct Struct;
#[async_trait]
impl Trait for Struct {
async fn method() {}
}
fn main() {}

View File

@@ -0,0 +1,8 @@
error[E0195]: lifetime parameters or bounds on associated function `method` do not match the trait declaration
--> tests/ui/missing-async-in-trait.rs:12:14
|
5 | fn method();
| - lifetimes in impl do not match this associated function in trait
...
12 | async fn method() {}
| ^^^^^^^^ lifetimes do not match associated function in trait

View File

@@ -0,0 +1,15 @@
use async_trait::async_trait;
#[async_trait]
trait Trait {
async fn f(&self);
}
struct Thing;
#[async_trait]
impl Trait for Thing {
async fn f(&self);
}
fn main() {}

View File

@@ -0,0 +1,7 @@
error: associated function in `impl` without body
--> tests/ui/missing-body.rs:12:5
|
12 | async fn f(&self);
| ^^^^^^^^^^^^^^^^^-
| |
| help: provide a definition for the function: `{ <body> }`

21
vendor/async-trait/tests/ui/must-use.rs vendored Normal file
View File

@@ -0,0 +1,21 @@
#![deny(unused_must_use)]
use async_trait::async_trait;
#[async_trait]
trait Interface {
async fn f(&self);
}
struct Thing;
#[async_trait]
impl Interface for Thing {
async fn f(&self) {}
}
pub async fn f() {
Thing.f();
}
fn main() {}

View File

@@ -0,0 +1,23 @@
error: unused pinned boxed `Future` trait object that must be used
--> tests/ui/must-use.rs:18:5
|
18 | Thing.f();
| ^^^^^^^^^
|
= note: futures do nothing unless you `.await` or poll them
note: the lint level is defined here
--> tests/ui/must-use.rs:1:9
|
1 | #![deny(unused_must_use)]
| ^^^^^^^^^^^^^^^
error: unused return value of `Interface::f` that must be used
--> tests/ui/must-use.rs:18:5
|
18 | Thing.f();
| ^^^^^^^^^
|
help: use `let _ = ...` to ignore the resulting value
|
18 | let _ = Thing.f();
| +++++++

View File

@@ -0,0 +1,13 @@
pub trait Trait {
async fn method(&self);
}
pub struct Struct;
impl Trait for Struct {
async fn method(&self) {}
}
fn main() {
let _: &dyn Trait;
}

View File

@@ -0,0 +1,17 @@
error[E0038]: the trait `Trait` is not dyn compatible
--> tests/ui/no-attribute-macro.rs:12:17
|
12 | let _: &dyn Trait;
| ^^^^^ `Trait` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> tests/ui/no-attribute-macro.rs:2:14
|
1 | pub trait Trait {
| ----- this trait is not dyn compatible...
2 | async fn method(&self);
| ^^^^^^ ...because method `method` is `async`
= help: consider moving `method` to another trait
= help: only type `Struct` implements `Trait` within this crate; consider using it directly instead.
= note: `Trait` may be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type

View File

@@ -0,0 +1,30 @@
use async_trait::async_trait;
pub struct S {}
pub enum E {
V {},
}
#[async_trait]
pub trait Trait {
async fn method(self);
}
#[async_trait]
impl Trait for S {
async fn method(self) {
let _: () = self;
let _: Self = Self;
}
}
#[async_trait]
impl Trait for E {
async fn method(self) {
let _: () = self;
let _: Self = Self::V;
}
}
fn main() {}

View File

@@ -0,0 +1,32 @@
error[E0308]: mismatched types
--> tests/ui/self-span.rs:17:21
|
17 | let _: () = self;
| -- ^^^^ expected `()`, found `S`
| |
| expected due to this
error: the `Self` constructor can only be used with tuple or unit structs
--> tests/ui/self-span.rs:18:23
|
18 | let _: Self = Self;
| ^^^^ help: use curly brackets: `Self { /* fields */ }`
error[E0308]: mismatched types
--> tests/ui/self-span.rs:25:21
|
25 | let _: () = self;
| -- ^^^^ expected `()`, found `E`
| |
| expected due to this
error[E0533]: expected value, found struct variant `Self::V`
--> tests/ui/self-span.rs:26:23
|
26 | let _: Self = Self::V;
| ^^^^^^^ not a value
|
help: you might have meant to create a new value of the struct
|
26 | let _: Self = Self::V {};
| ++

View File

@@ -0,0 +1,22 @@
use async_trait::async_trait;
use std::sync::Mutex;
async fn f() {}
#[async_trait]
trait Test {
async fn test(&self) {
let mutex = Mutex::new(());
let _guard = mutex.lock().unwrap();
f().await;
}
async fn test_ret(&self) -> bool {
let mutex = Mutex::new(());
let _guard = mutex.lock().unwrap();
f().await;
true
}
}
fn main() {}

View File

@@ -0,0 +1,31 @@
error: future cannot be sent between threads safely
--> tests/ui/send-not-implemented.rs:8:5
|
8 | async fn test(&self) {
| ^^^^^ future created by async block is not `Send`
|
= help: within `{async block@$DIR/tests/ui/send-not-implemented.rs:8:5: 8:10}`, the trait `Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
note: future is not `Send` as this value is used across an await
--> tests/ui/send-not-implemented.rs:11:13
|
10 | let _guard = mutex.lock().unwrap();
| ------ has type `std::sync::MutexGuard<'_, ()>` which is not `Send`
11 | f().await;
| ^^^^^ await occurs here, with `_guard` maybe used later
= note: required for the cast from `Pin<Box<{async block@$DIR/tests/ui/send-not-implemented.rs:8:5: 8:10}>>` to `Pin<Box<dyn Future<Output = ()> + Send>>`
error: future cannot be sent between threads safely
--> tests/ui/send-not-implemented.rs:14:5
|
14 | async fn test_ret(&self) -> bool {
| ^^^^^ future created by async block is not `Send`
|
= help: within `{async block@$DIR/tests/ui/send-not-implemented.rs:14:5: 14:10}`, the trait `Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
note: future is not `Send` as this value is used across an await
--> tests/ui/send-not-implemented.rs:17:13
|
16 | let _guard = mutex.lock().unwrap();
| ------ has type `std::sync::MutexGuard<'_, ()>` which is not `Send`
17 | f().await;
| ^^^^^ await occurs here, with `_guard` maybe used later
= note: required for the cast from `Pin<Box<{async block@$DIR/tests/ui/send-not-implemented.rs:14:5: 14:10}>>` to `Pin<Box<dyn Future<Output = bool> + Send>>`

View File

@@ -0,0 +1,21 @@
use async_trait::async_trait;
#[async_trait]
trait Interface {
async fn f(&self);
async fn g(&self) -> ();
}
struct Thing;
#[async_trait]
impl Interface for Thing {
async fn f(&self) {
0
}
async fn g(&self) {
0
}
}
fn main() {}

View File

@@ -0,0 +1,11 @@
error[E0308]: mismatched types
--> tests/ui/type-mismatch.rs:14:9
|
14 | 0
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> tests/ui/type-mismatch.rs:17:9
|
17 | 0
| ^ expected `()`, found integer

View File

@@ -0,0 +1,20 @@
#![deny(warnings)]
use async_trait::async_trait;
#[async_trait]
pub trait Trait {
async fn f() {
unimplemented!()
}
}
#[async_trait]
pub trait TraitFoo {
async fn f() {
let _y = unimplemented!();
let _z = _y;
}
}
fn main() {}

View File

@@ -0,0 +1,14 @@
error: unreachable statement
--> tests/ui/unreachable.rs:16:9
|
15 | let _y = unimplemented!();
| ---------------- any code following this expression is unreachable
16 | let _z = _y;
| ^^^^^^^^^^^^ unreachable statement
|
note: the lint level is defined here
--> tests/ui/unreachable.rs:1:9
|
1 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(unreachable_code)]` implied by `#[deny(warnings)]`

View File

@@ -0,0 +1,15 @@
use async_trait::async_trait;
#[async_trait]
pub trait Trait {
async fn method();
}
#[async_trait]
impl Trait for &'static str {
async fn method() {
let _ = Self;
}
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: the `Self` constructor can only be used with tuple or unit structs
--> tests/ui/unsupported-self.rs:11:17
|
11 | let _ = Self;
| ^^^^