Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error messages #390

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ mod traits;

#[doc(hidden)]
pub mod __private {
#[allow(unused_imports)] // Easier than conditionally checking any optional external dependencies
pub use crate::{external::__private::*, traits::__private::*};

pub use core;
Expand Down
9 changes: 9 additions & 0 deletions tests/compile-fail/bitflags_trait_custom.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ note: required by a bound in `BitFlags`
|
| pub trait BitFlags: ImplementedByBitFlagsMacro + Flags {
| ^^^^^ required by this bound in `BitFlags`

error[E0046]: not all trait items implemented, missing: `Iter`, `IterNames`
--> tests/compile-fail/bitflags_trait_custom.rs:5:1
|
5 | impl BitFlags for BootlegFlags {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Iter`, `IterNames` in implementation
|
= help: implement the missing item: `type Iter = /* Type */;`
= help: implement the missing item: `type IterNames = /* Type */;`
18 changes: 18 additions & 0 deletions tests/compile-fail/unnamed_const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,21 @@ error[E0599]: no associated item named `_` found for struct `Unnamed` in the cur
8 | | }
9 | | }
| |_- associated item `_` not found for this struct
|
note: if you're trying to build a new `Unnamed` consider using one of the following associated functions:
_::<impl Unnamed>::empty
_::<impl Unnamed>::all
_::<impl Unnamed>::from_bits
_::<impl Unnamed>::from_bits_truncate
and $N others
--> tests/compile-fail/unnamed_const.rs:3:1
|
3 | / bitflags! {
4 | | pub struct Unnamed: u8 {
5 | | const _ = 1;
6 | |
7 | | const A = Self::_.bits();
8 | | }
9 | | }
| |_^
= note: this error originates in the macro `__impl_bitflags` which comes from the expansion of the macro `bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)