-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quicklog(tests): simple macro failure cases
- Loading branch information
Showing
23 changed files
with
266 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use quicklog::info; | ||
|
||
use crate::common::Something; | ||
use common::Something; | ||
|
||
mod common; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use quicklog::info; | ||
|
||
use crate::common::Something; | ||
use common::Something; | ||
|
||
mod common; | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
quicklog/tests/failures/assigned_prefixed_arg_after_fmt_str.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use quicklog::info; | ||
|
||
#[path = "../common/mod.rs"] | ||
mod common; | ||
|
||
use common::Something; | ||
|
||
fn main() { | ||
let s1 = Something { | ||
some_str: "Hello world 1", | ||
}; | ||
info!(a = ?s1, "prefixed arg after fmt str: {b}", b = ?s1); | ||
} |
5 changes: 5 additions & 0 deletions
5
quicklog/tests/failures/assigned_prefixed_arg_after_fmt_str.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: expected an expression | ||
--> tests/failures/assigned_prefixed_arg_after_fmt_str.rs:12:59 | ||
| | ||
12 | info!(a = ?s1, "prefixed arg after fmt str: {b}", b = ?s1); | ||
| ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use quicklog::info; | ||
|
||
#[path = "../common/mod.rs"] | ||
mod common; | ||
|
||
use common::Something; | ||
|
||
fn main() { | ||
let s1 = Something { | ||
some_str: "Hello world 1", | ||
}; | ||
info!(a = ?s1, "prefixed arg after fmt str: {b}", ?s1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: expected an expression | ||
--> tests/failures/prefixed_arg_after_fmt_str.rs:12:55 | ||
| | ||
12 | info!(a = ?s1, "prefixed arg after fmt str: {b}", ?s1); | ||
| ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use quicklog::info; | ||
|
||
#[path = "../common/mod.rs"] | ||
mod common; | ||
|
||
use common::SimpleStruct; | ||
|
||
fn main() { | ||
let s1 = SimpleStruct { | ||
some_str: "Hello world 1", | ||
}; | ||
info!(s1, "struct does not implement Clone"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
error[E0599]: the method `to_owned` exists for struct `SimpleStruct`, but its trait bounds were not satisfied | ||
--> tests/failures/struct_missing_clone.rs:12:5 | ||
| | ||
12 | info!(s1, "struct does not implement Clone"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `SimpleStruct` due to unsatisfied trait bounds | ||
| | ||
::: tests/failures/../common/mod.rs | ||
| | ||
| pub(crate) struct SimpleStruct { | ||
| ------------------------------ | ||
| | | ||
| method `to_owned` not found for this struct | ||
| doesn't satisfy `SimpleStruct: Clone` | ||
| doesn't satisfy `SimpleStruct: ToOwned` | ||
| | ||
= note: the following trait bounds were not satisfied: | ||
`SimpleStruct: Clone` | ||
which is required by `SimpleStruct: ToOwned` | ||
= note: this error originates in the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `SimpleStruct` with `#[derive(Clone)]` | ||
--> tests/failures/../common/mod.rs | ||
| | ||
+ #[derive(Clone)] | ||
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use quicklog::info; | ||
|
||
#[path = "../common/mod.rs"] | ||
mod common; | ||
|
||
use common::SerializeStruct; | ||
|
||
fn main() { | ||
let s1 = SerializeStruct { | ||
symbol: "Hello world 1".to_string(), | ||
}; | ||
info!(?s1, "struct does not implement Debug"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error[E0277]: `SerializeStruct` doesn't implement `std::fmt::Debug` | ||
--> tests/failures/struct_missing_debug.rs:12:5 | ||
| | ||
12 | info!(?s1, "struct does not implement Debug"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SerializeStruct` cannot be formatted using `{:?}` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `SerializeStruct` | ||
= note: add `#[derive(Debug)]` to `SerializeStruct` or manually `impl std::fmt::Debug for SerializeStruct` | ||
note: required by a bound in `debug_check` | ||
--> tests/failures/struct_missing_debug.rs:12:5 | ||
| | ||
12 | info!(?s1, "struct does not implement Debug"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `debug_check` | ||
= note: this error originates in the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `SerializeStruct` with `#[derive(Debug)]` | ||
--> tests/failures/../common/mod.rs | ||
| | ||
+ #[derive(Debug)] | ||
| | ||
|
||
error[E0277]: `SerializeStruct` doesn't implement `std::fmt::Debug` | ||
--> tests/failures/struct_missing_debug.rs:12:5 | ||
| | ||
12 | info!(?s1, "struct does not implement Debug"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SerializeStruct` cannot be formatted using `{:?}` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `SerializeStruct` | ||
= note: add `#[derive(Debug)]` to `SerializeStruct` or manually `impl std::fmt::Debug for SerializeStruct` | ||
= note: this error originates in the macro `$crate::format_args` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `SerializeStruct` with `#[derive(Debug)]` | ||
--> tests/failures/../common/mod.rs | ||
| | ||
+ #[derive(Debug)] | ||
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use quicklog::info; | ||
|
||
#[path = "../common/mod.rs"] | ||
mod common; | ||
|
||
use common::Something; | ||
|
||
fn main() { | ||
let s1 = Something { | ||
some_str: "Hello world 1", | ||
}; | ||
info!(^s1, "struct does not implement Serialize"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
error[E0277]: the trait bound `Something: Serialize` is not satisfied | ||
--> tests/failures/struct_missing_display.rs:12:5 | ||
| | ||
12 | info!(^s1, "struct does not implement Serialize"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Serialize` is not implemented for `Something` | ||
| | ||
= help: the following other types implement trait `Serialize`: | ||
SerializeStruct | ||
BigStruct | ||
note: required by a bound in `serialize_check` | ||
--> tests/failures/struct_missing_display.rs:12:5 | ||
| | ||
12 | info!(^s1, "struct does not implement Serialize"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `serialize_check` | ||
= note: this error originates in the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0599]: no method named `encode` found for struct `Something` in the current scope | ||
--> tests/failures/struct_missing_display.rs:12:5 | ||
| | ||
12 | info!(^s1, "struct does not implement Serialize"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| method not found in `Something` | ||
| | ||
::: tests/failures/../common/mod.rs | ||
| | ||
| pub(crate) struct Something { | ||
| --------------------------- method `encode` not found for this struct | ||
| | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
= note: the following trait defines an item `encode`, perhaps you need to implement it: | ||
candidate #1: `Serialize` | ||
= note: this error originates in the macro `quicklog::make_store` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0599]: no method named `buffer_size_required` found for struct `Something` in the current scope | ||
--> tests/failures/struct_missing_display.rs:12:5 | ||
| | ||
12 | info!(^s1, "struct does not implement Serialize"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Something` | ||
| | ||
::: tests/failures/../common/mod.rs | ||
| | ||
| pub(crate) struct Something { | ||
| --------------------------- method `buffer_size_required` not found for this struct | ||
| | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
= note: the following trait defines an item `buffer_size_required`, perhaps you need to implement it: | ||
candidate #1: `Serialize` | ||
= note: this error originates in the macro `quicklog::make_store` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use quicklog::info; | ||
|
||
#[path = "../common/mod.rs"] | ||
mod common; | ||
|
||
use common::SerializeStruct; | ||
|
||
fn main() { | ||
let s1 = SerializeStruct { | ||
symbol: "Hello world 1".to_string(), | ||
}; | ||
info!(?s1, "struct does not implement Debug"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error[E0277]: `SerializeStruct` doesn't implement `std::fmt::Debug` | ||
--> tests/failures/struct_missing_serialize.rs:12:5 | ||
| | ||
12 | info!(?s1, "struct does not implement Debug"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SerializeStruct` cannot be formatted using `{:?}` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `SerializeStruct` | ||
= note: add `#[derive(Debug)]` to `SerializeStruct` or manually `impl std::fmt::Debug for SerializeStruct` | ||
note: required by a bound in `debug_check` | ||
--> tests/failures/struct_missing_serialize.rs:12:5 | ||
| | ||
12 | info!(?s1, "struct does not implement Debug"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `debug_check` | ||
= note: this error originates in the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `SerializeStruct` with `#[derive(Debug)]` | ||
--> tests/failures/../common/mod.rs | ||
| | ||
+ #[derive(Debug)] | ||
| | ||
|
||
error[E0277]: `SerializeStruct` doesn't implement `std::fmt::Debug` | ||
--> tests/failures/struct_missing_serialize.rs:12:5 | ||
| | ||
12 | info!(?s1, "struct does not implement Debug"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SerializeStruct` cannot be formatted using `{:?}` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `SerializeStruct` | ||
= note: add `#[derive(Debug)]` to `SerializeStruct` or manually `impl std::fmt::Debug for SerializeStruct` | ||
= note: this error originates in the macro `$crate::format_args` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider annotating `SerializeStruct` with `#[derive(Debug)]` | ||
--> tests/failures/../common/mod.rs | ||
| | ||
+ #[derive(Debug)] | ||
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use quicklog::info; | ||
|
||
fn main() { | ||
info!("trailing comma",); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
error: unexpected end of input, expected an expression | ||
--> tests/failures/trailing_comma.rs:4:5 | ||
| | ||
4 | info!("trailing comma",); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use quicklog::info; | ||
|
||
use crate::common::{Something, A}; | ||
use common::{Something, A}; | ||
|
||
mod common; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use quicklog::info; | ||
|
||
use crate::common::Something; | ||
use common::Something; | ||
|
||
mod common; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use quicklog::info; | ||
|
||
use crate::common::Something; | ||
use common::Something; | ||
|
||
mod common; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters