-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from auto-impl-rs/use-trybuild
Use `trybuild` to do compile-fail/pass tests (and fix some minor bugs)
- Loading branch information
Showing
74 changed files
with
347 additions
and
243 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
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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -7,3 +7,5 @@ enum Foo { | |
Name(String), | ||
Rgb(u8, u8, u8), | ||
} | ||
|
||
fn main() {} |
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,9 @@ | ||
error: couldn't parse trait item | ||
|
||
note: expected `trait` | ||
|
||
note: the #[auto_impl] attribute can only be applied to traits! | ||
--> $DIR/attr_on_enum.rs:5:1 | ||
| | ||
5 | enum Foo { | ||
| ^^^^ |
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ use auto_impl::auto_impl; | |
fn foo(s: String) -> u32 { | ||
3 | ||
} | ||
|
||
fn main() {} |
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,9 @@ | ||
error: couldn't parse trait item | ||
|
||
note: expected `trait` | ||
|
||
note: the #[auto_impl] attribute can only be applied to traits! | ||
--> $DIR/attr_on_fn.rs:5:1 | ||
| | ||
5 | fn foo(s: String) -> u32 { | ||
| ^^ |
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ trait Foo {} | |
|
||
#[auto_impl(&, &mut)] | ||
impl Foo for usize {} | ||
|
||
fn main() {} |
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,9 @@ | ||
error: couldn't parse trait item | ||
|
||
note: expected `trait` | ||
|
||
note: the #[auto_impl] attribute can only be applied to traits! | ||
--> $DIR/attr_on_impl_block.rs:7:1 | ||
| | ||
7 | impl Foo for usize {} | ||
| ^^^^ |
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 |
---|---|---|
|
@@ -6,3 +6,6 @@ struct Foo { | |
x: usize, | ||
bar: String, | ||
} | ||
|
||
|
||
fn main() {} |
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,9 @@ | ||
error: couldn't parse trait item | ||
|
||
note: expected `trait` | ||
|
||
note: the #[auto_impl] attribute can only be applied to traits! | ||
--> $DIR/attr_on_struct.rs:5:1 | ||
| | ||
5 | struct Foo { | ||
| ^^^^^^ |
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ use auto_impl::auto_impl; | |
|
||
#[auto_impl(&, &mut)] | ||
type Baz = String; | ||
|
||
|
||
fn main() {} |
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,9 @@ | ||
error: couldn't parse trait item | ||
|
||
note: expected `trait` | ||
|
||
note: the #[auto_impl] attribute can only be applied to traits! | ||
--> $DIR/attr_on_type.rs:5:1 | ||
| | ||
5 | type Baz = String; | ||
| ^^^^ |
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ use auto_impl::auto_impl; | |
|
||
#[auto_impl(&, &mut)] | ||
struct Foo(usize, String); | ||
|
||
|
||
fn main() {} |
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,9 @@ | ||
error: couldn't parse trait item | ||
|
||
note: expected `trait` | ||
|
||
note: the #[auto_impl] attribute can only be applied to traits! | ||
--> $DIR/attr_on_unit_struct.rs:5:1 | ||
| | ||
5 | struct Foo(usize, String); | ||
| ^^^^^^ |
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 |
---|---|---|
|
@@ -7,3 +7,6 @@ trait Foo { | |
|
||
fn a(&self); | ||
} | ||
|
||
|
||
fn main() {} |
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: this trait cannot be auto-implemented for Fn-traits (only traits with exactly one method and no other items are allowed) | ||
|
||
note: auto-impl requested here | ||
--> $DIR/fn_associated_const.rs:5:1 | ||
| | ||
5 | trait Foo { | ||
| ^^^^^ |
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 |
---|---|---|
|
@@ -7,3 +7,6 @@ trait Foo { | |
|
||
fn a(&self); | ||
} | ||
|
||
|
||
fn main() {} |
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: this trait cannot be auto-implemented for Fn-traits (only traits with exactly one method and no other items are allowed) | ||
|
||
note: auto-impl requested here | ||
--> $DIR/fn_associated_type.rs:5:1 | ||
| | ||
5 | trait Foo { | ||
| ^^^^^ |
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 |
---|---|---|
|
@@ -6,3 +6,6 @@ trait Foo { | |
fn a(&self); | ||
fn b(&self); | ||
} | ||
|
||
|
||
fn main() {} |
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: this trait cannot be auto-implemented for Fn-traits (only traits with exactly one method and no other items are allowed) | ||
|
||
note: auto-impl requested here | ||
--> $DIR/fn_multiple_methods.rs:5:1 | ||
| | ||
5 | trait Foo { | ||
| ^^^^^ |
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 |
---|---|---|
|
@@ -5,3 +5,6 @@ use auto_impl::auto_impl; | |
trait Foo { | ||
unsafe fn a(&self); | ||
} | ||
|
||
|
||
fn main() {} |
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: the trait 'Foo' cannot be auto-implemented for Fn-traits: unsafe methods are not allowed | ||
|
||
note: auto-impl requested here | ||
--> $DIR/fn_unsafe_method.rs:6:5 | ||
| | ||
6 | unsafe fn a(&self); | ||
| ^^^^^^ |
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 |
---|---|---|
|
@@ -6,3 +6,6 @@ trait Foo { | |
#[auto_impl(keep_default_for(&))] | ||
type Foo; | ||
} | ||
|
||
|
||
fn main() {} |
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: `auto_impl` attributes are only allowed on methods | ||
--> $DIR/keep_default_for_on_assoc_type.rs:6:5 | ||
| | ||
6 | #[auto_impl(keep_default_for(&))] | ||
| ^ |
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 |
---|---|---|
|
@@ -6,3 +6,6 @@ trait Foo { | |
#[auto_impl(keep_default_for(&))] | ||
fn required(&self); | ||
} | ||
|
||
|
||
fn main() {} |
7 changes: 7 additions & 0 deletions
7
tests/compile-fail/keep_default_for_on_required_method.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,7 @@ | ||
error: the method `required` has the attribute `keep_default_for` but is not a default method (no body is provided) | ||
|
||
note: auto-impl requested here | ||
--> $DIR/keep_default_for_on_required_method.rs:7:5 | ||
| | ||
7 | fn required(&self); | ||
| ^^ |
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 |
---|---|---|
|
@@ -6,3 +6,6 @@ trait Foo { | |
#[auto_impl(ferris_for_life)] | ||
fn a(&self); | ||
} | ||
|
||
|
||
fn main() {} |
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: expected arguments for 'ferris_for_life' in parenthesis `()`, found nothing | ||
|
||
note: auto-impl requested here | ||
--> $DIR/method_attr_invalid.rs:6:17 | ||
| | ||
6 | #[auto_impl(ferris_for_life)] | ||
| ^^^^^^^^^^^^^^^ |
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 |
---|---|---|
|
@@ -5,3 +5,6 @@ use auto_impl::auto_impl; | |
trait Foo { | ||
fn foo(&mut self); | ||
} | ||
|
||
|
||
fn main() {} |
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: the trait `Foo` cannot be auto-implemented for Arc-smartpointer, because this method has a `&mut self` receiver (only `&self` and no receiver are allowed) | ||
|
||
note: auto-impl requested here | ||
--> $DIR/mut_self_for_arc.rs:6:5 | ||
| | ||
6 | fn foo(&mut self); | ||
| ^^ |
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 |
---|---|---|
|
@@ -5,3 +5,6 @@ use auto_impl::auto_impl; | |
trait Foo { | ||
fn foo(&mut self); | ||
} | ||
|
||
|
||
fn main() {} |
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: the trait `Foo` cannot be auto-implemented for immutable references, because this method has a `&mut self` receiver (only `&self` and no receiver are allowed) | ||
|
||
note: auto-impl requested here | ||
--> $DIR/mut_self_for_immutable_ref.rs:6:5 | ||
| | ||
6 | fn foo(&mut self); | ||
| ^^ |
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 |
---|---|---|
|
@@ -5,3 +5,6 @@ use auto_impl::auto_impl; | |
trait Foo { | ||
fn foo(&mut self); | ||
} | ||
|
||
|
||
fn main() {} |
Oops, something went wrong.