Skip to content

Commit f81f1dc

Browse files
Remove cfg-magic from fail* examples
Now, the user has to simply add a line that has been commented to see the error. A lot simpler.
1 parent 53e68d9 commit f81f1dc

File tree

3 files changed

+30
-56
lines changed

3 files changed

+30
-56
lines changed

examples/error_messages.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//! This file showcases a few error messages emitted by `auto_impl`. You have
2+
//! to add specific lines to see the error. Then simply compile with:
3+
//!
4+
//! ```
5+
//! cargo build --example error_messages
6+
//! ```
7+
//!
8+
//! If you want to see nicer error messages, add `--features=nightly`.
9+
#![allow(unused_imports, dead_code)]
10+
11+
use auto_impl::auto_impl;
12+
13+
14+
// Shows the error message for the case that `#[auto_impl]` was used with
15+
// incorrect proxy types. Only proxy types like `&` and `Box` are allowed. Add
16+
// this next line to see the error!
17+
//#[auto_impl(Boxxi)]
18+
trait Foo {
19+
fn foo(&self) -> u32;
20+
}
21+
22+
// Shows the error message for the case the `#[auto_impl]` wasn't applied to a
23+
// valid trait (in this case a struct). Add this next line to see the error!
24+
//#[auto_impl(&, Box)]
25+
struct Bar {
26+
x: u32,
27+
}
28+
29+
30+
fn main() {}

examples/fail_invalid_proxy.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

examples/fail_on_struct.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)