Vendor things

This commit is contained in:
John Doty 2024-03-08 11:03:01 -08:00
parent 5deceec006
commit 977e3c17e5
19434 changed files with 10682014 additions and 0 deletions

View file

@ -0,0 +1,8 @@
use anyhow::{ensure, Result};
fn main() -> Result<()> {
// `ensure!` must not partition this into `(false) == (false == true)`
// because Rust doesn't ordinarily allow this form of expression.
ensure!(false == false == true);
Ok(())
}

View file

@ -0,0 +1,10 @@
error: comparison operators cannot be chained
--> tests/ui/chained-comparison.rs:6:19
|
6 | ensure!(false == false == true);
| ^^ ^^
|
help: split the comparison into two
|
6 | ensure!(false == false && false == true);
| ++++++++

View file

@ -0,0 +1,6 @@
use anyhow::{ensure, Result};
fn main() -> Result<()> {
ensure!();
Ok(())
}

View file

@ -0,0 +1,12 @@
error: unexpected end of macro invocation
--> tests/ui/empty-ensure.rs:4:5
|
4 | ensure!();
| ^^^^^^^^^ missing tokens in macro arguments
|
note: while trying to match meta-variable `$cond:expr`
--> src/ensure.rs
|
| ($cond:expr $(,)?) => {
| ^^^^^^^^^^
= note: this error originates in the macro `$crate::__parse_ensure` which comes from the expansion of the macro `ensure` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,11 @@
#![deny(unused_must_use)]
use anyhow::anyhow;
fn main() -> anyhow::Result<()> {
if true {
// meant to write bail!
anyhow!("it failed");
}
Ok(())
}

View file

@ -0,0 +1,12 @@
error: unused return value of `anyhow::__private::must_use` that must be used
--> tests/ui/must-use.rs:8:9
|
8 | anyhow!("it failed");
| ^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> tests/ui/must-use.rs:1:9
|
1 | #![deny(unused_must_use)]
| ^^^^^^^^^^^^^^^
= note: this error originates in the macro `anyhow` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,8 @@
use anyhow::anyhow;
#[derive(Debug)]
struct Error;
fn main() {
let _ = anyhow!(Error);
}

View file

@ -0,0 +1,32 @@
error[E0599]: the method `anyhow_kind` exists for reference `&Error`, but its trait bounds were not satisfied
--> tests/ui/no-impl.rs:7:13
|
4 | struct Error;
| ------------ doesn't satisfy `Error: Into<anyhow::Error>`, `Error: anyhow::kind::TraitKind` or `Error: std::fmt::Display`
...
7 | let _ = anyhow!(Error);
| ^^^^^^^^^^^^^^ method cannot be called on `&Error` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`Error: Into<anyhow::Error>`
which is required by `Error: anyhow::kind::TraitKind`
`Error: std::fmt::Display`
which is required by `&Error: anyhow::kind::AdhocKind`
`&Error: Into<anyhow::Error>`
which is required by `&Error: anyhow::kind::TraitKind`
note: the traits `Into` and `std::fmt::Display` must be implemented
--> $RUST/core/src/fmt/mod.rs
|
| pub trait Display {
| ^^^^^^^^^^^^^^^^^
|
::: $RUST/core/src/convert/mod.rs
|
| pub trait Into<T>: Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `anyhow_kind`, perhaps you need to implement one of them:
candidate #1: `anyhow::kind::AdhocKind`
candidate #2: `anyhow::kind::TraitKind`
candidate #3: `anyhow::kind::BoxedKind`
= note: this error originates in the macro `anyhow` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,5 @@
use anyhow::anyhow;
fn main() {
let _ = anyhow!(&String::new());
}

View file

@ -0,0 +1,9 @@
error[E0716]: temporary value dropped while borrowed
--> tests/ui/temporary-value.rs:4:22
|
4 | let _ = anyhow!(&String::new());
| ---------^^^^^^^^^^^^^-
| | |
| | creates a temporary value which is freed while still in use
| temporary value is freed at the end of this statement
| argument requires that borrow lasts for `'static`

View file

@ -0,0 +1,5 @@
use anyhow::{bail, Result};
fn main() -> Result<()> {
bail!("{} not found");
}

View file

@ -0,0 +1,5 @@
error: 1 positional argument in format string, but no arguments were given
--> tests/ui/wrong-interpolation.rs:4:12
|
4 | bail!("{} not found");
| ^^