Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upsupport overlap for marker traits #62
Comments
nikomatsakis
added
the
good first bug
label
Oct 22, 2017
This comment has been minimized.
This comment has been minimized.
|
cc @mikeyhew cc @withoutboats -- do you think further changes are needd in coherence? |
This comment has been minimized.
This comment has been minimized.
|
I'd like to try this if that's ok :) @nikomatsakis to add the keyword to the parser, should we ensure Should we also add the btw I quickly prototyped the steps in the issue, and indeed nothing more seems to be needed to solve the problem. EDIT: In the meantime I've opened #64 as WIP with those questions |
lqd
referenced this issue
Oct 22, 2017
Merged
Allow overlapping impls for marker traits in the coherence rules #64
This comment has been minimized.
This comment has been minimized.
|
@lqd I was going to take this on, but I'm already busy with an issue from rust-lang/rust, and you seem to have a good idea of what needs to be done here, so go for it :) When I'm finished with the compiler issue, I'm sure @nikomatsakis will have more issues to work on for chalk.
|
nikomatsakis commentedOct 22, 2017
The current coherence rules do not have any special cases for "marker traits" -- that is, traits with zero items. As discussed in #8, at least for now it'd be nice to have "marker-ness" be declared explicitly with
#[marker].Here are some steps to do this:
We want to model this on the support for
#[auto]trait declarations. This means we would:auto)TraitDatumBoundstruct, again, likeautovisit_specializationsfunction, we can basically just ignore marker traits, I believeIt might be nice, rather than just adding another boolean field, to introduce some sort of
TraitFlagstype (e.g.,struct TraitFlags { auto: bool, marker: bool }) into the AST and copy that over intoir::TraitDatumBound? Or at least I don't love having a bunch of random boolean variables floating around.