-
Notifications
You must be signed in to change notification settings - Fork 14k
Make proc_macro::Group take up less space remove redundant field.
#149229
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
base: main
Are you sure you want to change the base?
Conversation
|
rustbot has assigned @petrochenkov. Use |
This comment has been minimized.
This comment has been minimized.
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
This comment has been minimized.
This comment has been minimized.
|
Okay, it looks like for whatever reason -_- locally I am able to execute |
|
There is actually a script to run the CI jobs locally with Docker: https://rustc-dev-guide.rust-lang.org/tests/docker.html#testing-with-docker From what it seems at first glance, the tests are just running |
I wondering if it's because rust analyzer is a separate repo? Is pr-check-2 pulling the source from the repo? |
|
|
Which is what I did, I am just not how or why one check is using the older version not in the PR. I tried looking at the CI directory for those briefly nothing immediately sprung out at me. |
|
Yeah, that's mostly why I recommended trying the docker approach because it will give you a better idea of what's running and thus what's failing. Since you can investigate the containers yourself, it'll tell you what's wrong. |
|
That is weird ... rust-analyzer should be building against the intro library sources ... |
|
cc @jieyouxu any idea what is going on here? It seems like rust-analyzer is not being built against the in-tree |
|
Didn't we remove the in-tree dependency, because T-types asked us to not depend on the in-tree trait solver? |
I guess this isn't the case for |
|
Yeah, for proc-macro rust-analyzer has to use the in-tree version for the rust-analyzer-proc-macro-server shipped with rustc to be ABI compatible with proc-macros built by said rustc. |
|
Right. Yea we definitely do want to built against the in-tree library still. |
|
Why does it make sense to optimize for the size of (In any case, CI is failing.) |
|
Reminder, once the PR becomes ready for a review, use |
Well when using the
That is something odd going on, 2 of the CI tests are using different source files. It even got the eyes of some other people. Some Tangential ThoughtsRelated to the join function having to a bridge call and potential performance. There is also this issue #130856. I feel instead of span being opaque handle. It might make sense to have The old span representation in the compiler was 4 bytes from what I understand. The code fragments that proc_macros process are generally smaller. Therefore something along those lines might be acceptable, and still keep the proc_macro span as 4 bytes. |
src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/token_stream.rs
Outdated
Show resolved
Hide resolved
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
2623a0e to
5785a84
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Okay, the motivation looks convincing enough. |
The field `entire` is redundant. This saves 4 bytes and makes the DelimSpan match up with what the compiler uses. Update tests to not include unused `entire` More instances of the old layout in rust analyzer Move cfg is in expermental posistion and update fmt str. Missed an instance of entire Conditionally, compile with #[cfg(bootstrap)] to break a depency cycle
464dc88 to
8b82c4c
Compare
|
Okay I squashed the commits to a single commit. @rustbot ready |
|
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
|
@bors r+ |
|
@bors r- |
The field
entireis redundant. This saves 4 bytes and makes theproc_macro::DelimSpanmatch up with what the compiler uses. MoreoverGroup::set_span()overwrites all the fields anyways so there not is any chance for entire not to be derived from the open and close. Lastly, the way the compiler constructs the entire field is also be based off the open and close.This takes the size from 20 bytes to 16 bytes which is also a nice power of 2.