File: error_messages.rs

package info (click to toggle)
rust-auto-impl 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 556 kB
  • sloc: makefile: 2; sh: 1
file content (26 lines) | stat: -rw-r--r-- 746 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! This file showcases a few error messages emitted by `auto_impl`. You have
//! to add specific lines to see the error. Then simply compile with:
//!
//! ```
//! cargo build --example error_messages
//! ```
#![allow(unused_imports, dead_code)]

use auto_impl::auto_impl;

// Shows the error message for the case that `#[auto_impl]` was used with
// incorrect proxy types. Only proxy types like `&` and `Box` are allowed. Add
// this next line to see the error!
//#[auto_impl(Boxxi)]
trait Foo {
    fn foo(&self) -> u32;
}

// Shows the error message for the case the `#[auto_impl]` wasn't applied to a
// valid trait (in this case a struct). Add this next line to see the error!
//#[auto_impl(&, Box)]
struct Bar {
    x: u32,
}

fn main() {}