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
unstable proc_macro tracked::* rename/restructure #87173
base: master
Are you sure you want to change the base?
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
I'm going to transfer this to the libs API team. I'm not sure what the current library conventions are, but seeing >2 segment paths like use tracked::fs::path as track_path;
use tracked::env::var as tracked_env_var;
fn my_proc_macro() {
track_path("my_file.txt"); // returns nothing
let var = tracked_env_var("MY_VAR"); // returns the variable's value
} |
Totally understandable, and I don't have a strong opinion, mostly going off of what was discussed in the referenced #84029 issue. If it is at odds with the current naming and module nesting depth, feel free to close. At the very least though, I think it should be unified to either |
We discussed this in today's @rust-lang/libs-api meeting. We don't want to see an extra level of submodule nesting here; we should just have Also, separate from this issue, several people in the meeting felt that we shouldn't restrict |
@m-ou-se I'll implement the required changes this week, just wasn't entirely sure what your self assignment implied. |
Shouldn't we name the functions |
I'd prefer the one module level variants, which is in line with other macro impls iirc:
|
What's meant by |
Pending access to something that can be cast to a byte slice, the impl currently accepts valid UTF-8 only. I am not sure the error handling is as desired. Either way, I'd like some feedback :) Thanks! @rustbot label -S-waiting-on-author +S-waiting-on-review |
It's not necessary to return a I'm not sure whether proc macro bridge can support passing |
Technically this would be possible, but that would require to access the currently private I added an implementation adding a |
Ping from triage: |
This comment has been minimized.
This comment has been minimized.
Part of the reason why this is stuck, is because there's no tracking issue with an overview of the API, making it hard to quickly see what API we're talking about or what we're actually changing. The existing I believe this is the current state: // proc_macro::tracked_env:
pub fn var<K: AsRef<OsStr> + AsRef<str>>(key: K) -> Result<String, VarError>;
// proc_macro::tracked_path:
pub fn path<P: AsRef<str>>(path: P); And it seems you're proposing to change it to: // proc_macro::tracked:
pub fn env_var<K: AsRef<OsStr> + AsRef<str>>(key: K) -> Result<String, VarError>;
pub fn path<P: AsRef<Path>>(path: P) -> Result<(), ()>; While there's some improvements, such as Considering there still needs to be more design work done before this gets anywhere near stabilization, I'm hesitant to merge this. As previously suggested by petrochenkov, it'd be good to first merge the change that changes Then the discussion on the exact public interface can be had separately. Either on a PR that clearly states the newly proposed API, or as as an API Change Proposal on the libs-team repo. Once we have a new design, we should probably track both |
I've opened #99515 to track this feature and the steps that still need to be done. |
☔ The latest upstream changes (presumably #99058) made this pull request unmergeable. Please resolve the merge conflicts. |
@drahnr any updates on this pr? |
@Dylan-DPC If everything goes well, I can take another look at splitting things up next week~ish according along with #87173 (comment) and drop the remaining changes. I frankly forgot about the issue. |
@drahnr any updates on this? |
Back on it. |
0c57e65
to
a46a7ba
Compare
Some changes occurred in src/tools/rust-analyzer cc @rust-lang/rust-analyzer |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
7b4ac2f
to
fa67588
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #118646) made this pull request unmergeable. Please resolve the merge conflicts. |
Extracted restructure of the unstable
tracked::{fs,env}::*
Originally part of #84029
It's slightly clunky to to have three distinct unstable features, since one cannot use two annotations on one
mod tracked {..}
declaration.The second thing I am unsure is
rust-analyzer
which would need some adaption for the new structure.CC @Xanewok