Uh oh!
There was an error while loading. Please reload this page.
RFC: Rearchitect the attribute-usage lint - #3
Conversation
huonw
commented
Mar 12, 2014
I like this, but being able to modify |
sfackler
commented
Mar 12, 2014
It seems like it'd be a pain to properly link things in the side table. A |
alexcrichton
commented
Mar 12, 2014
This sounds like a great idea to me, but I agree with @huonw that a side table may be the way to go for now (it's what almost everything else uses). Things like unused-unsafe, unused-mut, etc, could also all use |
sfackler
commented
Mar 12, 2014
That seems reasonable to me. I think this will require a bit more infrastructure than |
huonw
commented
Mar 12, 2014
The parallelism was my concern too, although I guess (Doesn't TLD go against parallelism too? I guess the ident interner needs to change for parallelism, anyway.) |
huonw
commented
Mar 12, 2014
Why not? (We can either give attributes nodeids, or have a special attribute id doing a similar thing.)
I don't think it has to be the side table: just each stage has to have access to a side table, and then the lint has to look at all of them (or just merge all the tables before doing any look-ups). |
sfackler
commented
Mar 12, 2014
|
huonw
commented
Mar 12, 2014
Oh, of course. it doesn't have to be task-local at all: the parser can just keep track of it... (Although then we hit the problems that caused us to reassign nodeids like we do now: macro expansion has to be careful reassign everything or things end up with duplicated ids.) |
huonw
commented
Mar 12, 2014
Well... actually maybe that's not so much of a problem for attributes. In fact, maybe duplicated IDs is exactly what we want, so that we don't get "spurious" warnings, where one expansion of a macro legitimately uses some attribute but another doesn't. |
sfackler
commented
Mar 12, 2014
I would want to minimize the amount of anti-"spurious" warning logic because it won't work in all cases. It seems to me that it's a macro's responsibility to mark all the attributes it's okay with as used even if it isn't using them at that point. There are cases I can imagine like "don't use this attribute unless you've already used this attribute on the struct" or something that should still get attribute usage warnings. |
nikomatsakis
commented
Mar 12, 2014
Some thoughts:
|
sfackler
commented
Mar 12, 2014
I'd like to avoid the whitelist approach entirely since it won't be able (I don't think) warn in cases like this, where the attribute is valid but ignored since it's missing the attribute on the Item that actually does the work: #[feature(phase)];#[phase(syntax, link)]externcrate some_orm;// #[ormify]pubstructFoo{#[column(foo_)]#[primary_key]foo:int}I think the Java-style approach would also run into this. How does this sound: pubtypeAttrId = uint;// u32?pubstructAttribute_{id:AttrId,style:AttrStyle,value: @MetaItem,is_sugared_doc:bool,}We can adjust the Do people have preferences on the storage location of the side table? A task-local store would be the most convenient, and allow for the |
sfackler
commented
Mar 13, 2014
I've updated the RFC to describe the side table approach. |
nikomatsakis
commented
Mar 18, 2014
Can we make You are correct that any Java-style scheme is going to be more limited than what we can achieve with custom coding. Talking it over in the meeting I actually kind of came around -- an imperative scheme is more flexible, and we could probably layer a more declarative scheme on top if desired. |
sfackler
commented
Mar 18, 2014
Making |
sfackler
commented
Mar 19, 2014
Updated with |
sfackler
commented
Mar 19, 2014
I do think that a Java-style scheme would be worth thinking about as well, as this proposal won't handle something I've run into recently: #[deriving(Ord(a, c))]pubstructFoo{a:int,b:int,c:int}I thought the We could potentially handle that with this proposal by pushing the IDs out from |
nikomatsakis
commented
Mar 20, 2014
@sfackler isn't that the fault of |
sfackler
commented
Mar 20, 2014
It is, but in the same way that it's also the fault of |
nikomatsakis
commented
Mar 20, 2014
Right. In this case, it's scanning the argument list anyway, I think it's the job of deriving to validate its format. |
alexcrichton
commented
Mar 20, 2014
It sounds like we're all in general agreement that this is the right direction to go in. Details may change along the way, but that's expected from an RFC. I'm going to merge this. |
alexcrichton
commented
Mar 20, 2014
Committed in 1245e64 |
Add Cursor, remove MemWriter/MemReader
Explanations about the buffer contents
include explicit examples of parametric aliases.
Rewrite to include abstract type syntax.
Dump my notes on arbitrary self types
Clarify language on affiliation
No description provided.