-
Notifications
You must be signed in to change notification settings - Fork 34
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
Implement unsafe trait support (continued) #155
Changes from 1 commit
570e95f
c86992d
8ec6589
c9534a0
0e5464c
866b4da
f562ada
72062fc
e03258c
4d615b1
53d0e43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
use std::fmt; | ||
|
||
use formality_core::{set, Set, Upcast}; | ||
use formality_macros::term; | ||
use formality_types::grammar::{ | ||
|
@@ -141,13 +143,23 @@ pub struct NegImplDeclBoundData { | |
} | ||
|
||
#[term] | ||
#[customize(debug)] | ||
#[derive(Default)] | ||
pub enum Safety { | ||
#[default] | ||
Safe, | ||
Unsafe, | ||
} | ||
|
||
impl fmt::Debug for Safety { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this the default behavior that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I didn't know this, or test that it would. I'll try, and open a PR to clean this up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've fixed this in #156 |
||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self { | ||
Safety::Safe => write!(f, "safe"), | ||
Safety::Unsafe => write!(f, "unsafe"), | ||
} | ||
} | ||
} | ||
|
||
/// A "trait declaration" declares a trait that exists, its generics, and its where-clauses. | ||
/// It doesn't capture the trait items, which will be transformed into other sorts of rules. | ||
/// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know you could do this, nifty.