Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add attributes to allow specializing on traits
- Loading branch information
1 parent
a62dd0e
commit c24b4bf
Showing
13 changed files
with
116 additions
and
3 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 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
6 changes: 6 additions & 0 deletions
6
src/test/ui/specialization/min_specialization/auxiliary/specialization-trait.rs
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,6 @@ | ||
#![feature(rustc_attrs)] | ||
|
||
#[rustc_specialization_trait] | ||
pub trait SpecTrait { | ||
fn method(&self); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/specialization/min_specialization/impl_specialization_trait.rs
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,16 @@ | ||
// Check that specialization traits can't be implemented without a feature. | ||
|
||
// gate-test-min_specialization | ||
|
||
// aux-build:specialization-trait.rs | ||
|
||
extern crate specialization_trait; | ||
|
||
struct A {} | ||
|
||
impl specialization_trait::SpecTrait for A { | ||
//~^ ERROR implementing `rustc_specialization_trait` traits is unstable | ||
fn method(&self) {} | ||
} | ||
|
||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/specialization/min_specialization/impl_specialization_trait.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,10 @@ | ||
error: implementing `rustc_specialization_trait` traits is unstable | ||
--> $DIR/impl_specialization_trait.rs:11:1 | ||
| | ||
LL | impl specialization_trait::SpecTrait for A { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add `#![feature(min_specialization)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|