13

Github Ban custom inner attributes in expressions and statements by Aaron1011 ·...

 4 years ago
source link: https://github.com/rust-lang/rust/pull/83488
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Copy link

Member

Aaron1011 commented 8 days ago

Split out from #82608

Custom inner attributes are unstable, so this won't break any stable users.
This allows us to speed up token collection, and avoid a redundant call to collect_tokens_no_attrs when parsing an Expr that has outer attributes.

r? @petrochenkov

Copy link

Contributor

petrochenkov commented 8 days ago

One more question - what happens with inner #![cfg]s and #![cfg_attr]s in expressions?
They are stable and cfg_eval and derive still need to know their token ranges to be able to process them.

Copy link

Member

Author

Aaron1011 commented 8 days ago

@petrochenkov: In PR #82608, I plan to implement your earlier suggestion of re-parsing with extra collection when we expand derive/cfg_eval. By banning custom inner attributes (which need token collection in order to remove the attribute from the token stream), we can bail out early during normal parsing of expressions without outer attributes.

Aaron1011

force-pushed the

Aaron1011:ban-expr-inner-attrs

branch from 0353306 to 7504b9b

8 days ago

Copy link

Member

Author

Aaron1011 commented 8 days ago

@petrochenkov: I've addressed your comments.

Copy link

Contributor

petrochenkov commented 7 days ago

@bors r+

Copy link

Contributor

bors commented 7 days ago

pushpin Commit 7504b9b has been approved by petrochenkov

Copy link

Contributor

bors commented 7 days ago

hourglass Testing commit 7504b9b with merge 5e65467...

Copy link

Contributor

bors commented 7 days ago

sunny Test successful - checks-actions
Approved by: petrochenkov
Pushing 5e65467 to master...

bors

merged commit 5e65467 into rust-lang:master 7 days ago

11 checks passed

rustbot

added this to the 1.53.0 milestone

7 days ago

Copy link

Contributor

klensy commented 7 days ago

edited

This ICE'd in perf: https://perf.rust-lang.org/status.html scroll down to see.

Perf runner don't report ICE's anywhere?
Old syn version from perf pool:

Compiling syn v0.11.11 (/tmp/.tmpnHQAja) ...

thread 'rustc' panicked at 'found unstable fingerprints for evaluate_obligation(e3352ed64d6e2ccd-c82ee1c6b3ce2c20): Ok(EvaluatedToOk)', /rustc/b8719c51e0e44483cff9b6975a830f6e51812a48/compiler/rustc_query_system/src/query/plumbing.rs:593:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (b8719c51e 2021-03-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z self-profile=/tmp/.tmpnHQAja/self-profile-output -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `quote::Tokens: std::marker::Unpin`
#1 [is_unpin_raw] computing whether `quote::Tokens` is `Unpin`
end of query stack
warning: 49 warnings emitted

thread 'main' panicked at 'assertion failed: status.success()', collector/src/rustc-fake.rs:76:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `syn`

Copy link

Member

Author

Aaron1011 commented 7 days ago

It looks like that ICE is actually coming from the current nightly. I thought that #83220 would have fixed that, but it's apparently a different issue (there are no lifetimes involved).

Copy link

Contributor

klensy commented 7 days ago

edited

Wait, perf runner started running this pr again.

Last perf run ICE'd on syn too, so this is not this pr root if problem.

Copy link

Member

Author

Aaron1011 commented 7 days ago

Opened #83538 to track resolving the syn crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects

None yet

Milestone

1.53.0

Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK