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 upSuggest using Cow on mixture of &'static str + Strings #320
Comments
llogiq
added
E-medium
T-middle
L-lint
labels
Sep 8, 2015
This comment has been minimized.
This comment has been minimized.
|
Revisiting this, it is not clear to me if the ExprUseVisitor really can do the things we need. First, we need to look at the whole crate. We start from a set of every bound value, struct/tuple field or enum variant content that is of type So if we want to use the ExprUseVisitor, I think our delegate needs to have a |
This comment has been minimized.
This comment has been minimized.
|
I also need to implement |
llogiq
added
E-hard
and removed
E-medium
labels
Sep 14, 2015
This comment has been minimized.
This comment has been minimized.
|
I think this is medium to get at all, but hard to get right. @Manishearth am I on the right track? Or is there an easier path? |
This comment has been minimized.
This comment has been minimized.
|
I started a cow branch to get my code online. I think I have the Now I need to implement the |
llogiq
self-assigned this
Sep 15, 2015
This comment has been minimized.
This comment has been minimized.
|
@birkenfeld I seem to have problems getting the lifetimes right. Halp |
This comment has been minimized.
This comment has been minimized.
|
@llogiq how can I help? |
This comment has been minimized.
This comment has been minimized.
|
I posed a question on stackoverflow which luckily got the correct answer. The reason for the problem was that I had a wrong lifetime for the Delegate. |
This comment has been minimized.
This comment has been minimized.
|
This is a lot more complicated than I'd thought. I have to find local variables (similar to shadow), struct fields/enum variant args (I don't have anything similar yet), etc. to bind the "use" to the correct identity. I need a check if a |
llogiq commentedSep 8, 2015
I see a lot of owned strings in many places where a
Cow<'static, str>will do. The latter will likely improve performance.How do we detect this? It's a value of type
Stringwhich are only initialized with otherStrings from elsewhere or&'static str(via.to_owned()/.to_string()). Also we should probably check if the value is part of the public interface (as we did recently withwrong_pub_self_convention).I think this should be possible with the ExprUseVisitor – so I finally have a reason to check it out.😄