

Github Ban custom inner attributes in expressions and statements by Aaron1011 ·...
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.

Conversation
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.
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.
@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.
@petrochenkov: I've addressed your comments.
@bors r+
Commit 7504b9b has been approved by
petrochenkov
Test successful - checks-actions
Approved by: petrochenkov
Pushing 5e65467 to master...
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`
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).
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.
Opened #83538 to track resolving the syn
crash
None yet
Successfully merging this pull request may close these issues.
None yet
Recommend
-
8
How @dynamicMemberLookup Works Internally in Swift (+ Creating Custom Swift Attributes) How @dynamicMemberLookup Works Internally in Swift (+ Creating Custom Swift Attributes) December 6, 2018 Th...
-
13
A second variation of the shopping cart DTOs using custom attributes. · GitHub Instantly share code, notes, and snippets. A second variation of the s...
-
4
New issue Support attributes on lambda expressions #984
-
8
Copy link Contributor Author petrochenko...
-
17
Custom security attributes in Azure AD part 3: working with custom security attributes After
-
11
Custom security attributes in Azure AD part 4: compare with older methods In previous articles of these series, we first looked at the various methods we could use to extend the Azure AD directory schema. Aft...
-
7
Custom security attributes in Azure AD part 1: a trip down memory lane While Azure AD has never been positioned as a direct replacement for Active Directory, many customers have expectations that functionalities t...
-
4
-
10
Christian Ilmberger May 19, 2022 5 minute...
-
7
IntroductionSo, a few years ago, I was teaching web development at a local coding bootcamp, and a stu...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK