forked from jam1garner/binrw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address edition 2024 UI test failures
The (necessary) use of function signature inference for the read function, in the absence of an actually valid function to infer from, results in the compiler generating warnings about `!` to `()` decay behaviour changing in Rust 2024, even though this code is already doomed to fail. We will see once edition 2024 is released whether the compiler emits a diagnostic about `BinRead` not being implemented for `!` or not. (cherry picked from commit 4ca8521)
- Loading branch information
Showing
6 changed files
with
17 additions
and
16 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,3 +1,4 @@ | ||
#![allow(dependency_on_unit_never_type_fallback)] | ||
use binrw::BinRead; | ||
|
||
#[derive(BinRead)] | ||
|
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,5 +1,5 @@ | ||
error[E0425]: cannot find value `does_not_exist` in this scope | ||
--> $DIR/invalid_map_fn.rs:5:16 | ||
--> tests/ui/invalid_map_fn.rs:6:16 | ||
| | ||
5 | #[br(map = does_not_exist)] | ||
6 | #[br(map = does_not_exist)] | ||
| ^^^^^^^^^^^^^^ not found in this scope |
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,10 +1,10 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/invalid_map_return_type.rs:5:20 | ||
--> tests/ui/invalid_map_return_type.rs:5:24 | ||
| | ||
5 | #[br(map = |_| 0u8)] | ||
| ^^^ expected `i32`, found `u8` | ||
5 | #[br(map = |_: ()| 0u8)] | ||
| ^^^ expected `i32`, found `u8` | ||
| | ||
help: change the type of the numeric literal from `u8` to `i32` | ||
| | ||
5 | #[br(map = |_| 0i32)] | ||
| ~~~ | ||
5 | #[br(map = |_: ()| 0i32)] | ||
| ~~~ |
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,14 +1,14 @@ | ||
error[E0308]: mismatched types | ||
--> tests/ui/invalid_try_map_return_type.rs:5:24 | ||
--> tests/ui/invalid_try_map_return_type.rs:5:28 | ||
| | ||
5 | #[br(try_map = |_| 0)] | ||
| ^ expected `Result<i32, _>`, found integer | ||
5 | #[br(try_map = |_: ()| 0)] | ||
| ^ expected `Result<i32, _>`, found integer | ||
| | ||
= note: expected enum `Result<i32, _>` | ||
found type `{integer}` | ||
help: try wrapping the expression in a variant of `Result` | ||
| | ||
5 | #[br(try_map = |_| Ok(0))] | ||
| +++ + | ||
5 | #[br(try_map = |_| Err(0))] | ||
| ++++ + | ||
5 | #[br(try_map = |_: ()| Ok(0))] | ||
| +++ + | ||
5 | #[br(try_map = |_: ()| Err(0))] | ||
| ++++ + |