-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a fatal_cycle
attribute for queries which indicates that they will cause a fatal error on query cycles
#47906
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
src/librustc/ty/maps/plumbing.rs
Outdated
@@ -193,7 +205,7 @@ macro_rules! define_maps { | |||
|
|||
define_map_struct! { | |||
tcx: $tcx, | |||
input: ($(([$($modifiers)*] [$($attr)*] [$name]))*) | |||
input: ($(([$($attr)*] [$name]))*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to remove this use of $modifiers
otherwise I got this error:
error: no rules expected the token `nocycle`
--> librustc\ty\maps\mod.rs:270:6
|
270 | [nocycle] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
| ^^^^^^^
error: aborting due to previous error
I'm not sure why this happens. define_map_struct
should accept any tokens there. 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment below :)
@nikomatsakis this PR needs your review :) |
I've mentioned on IRC that I prefer calling this |
Sorry for being slow. I meant to leave a comment on this branch -- I guess in the end I don't have strong opinions here, but being able to identify queries that we really don't expect to participate in a cycle seems like a fine thing to me. I'd be tempted to reverse the default, and instead mark those queries that do expect to be in cycles, but @eddyb thinks that will wind up being brittle -- that maybe so. Still, I know there are a lot of queries where I've made no effort to make a nice "debug msg" precisely because I don't expect them to show up in cycle error messages. I guess I could mark all of those as no-cycle. |
@@ -583,7 +595,7 @@ macro_rules! define_maps { | |||
|
|||
macro_rules! define_map_struct { | |||
(tcx: $tcx:tt, | |||
input: ($(([$(modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem was here. This should have been:
$($modifiers:tt)*
note the $
before modifiers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$($())*
I have no opinion about r=me with the name changed. I'm indifferent about whether we remove the |
…ill cause a fatal error on query cycles
@bors r=nikomatsakis |
📌 Commit e236994 has been approved by |
@Zoxc Can you also update the PR title/description? |
nocycle
attribute for queries which indicates that they cannot result in cycle errorsfatal_cycle
attribute for queries which indicates that they will cause a fatal error on query cycles
⌛ Testing commit e236994 with merge dbc75ddfb1e9515b08a941111938dbf570dc5911... |
💔 Test failed - status-travis |
⌛ Testing commit e236994 with merge d5e730fbb979a1923adc034005740d3b8cbcc0d1... |
💔 Test failed - status-appveyor |
@bors retry 3 hour timeout |
⌛ Testing commit e236994 with merge dc971d16ed76f9e9485b642cd90616a24de23640... |
💔 Test failed - status-appveyor |
Add a `fatal_cycle` attribute for queries which indicates that they will cause a fatal error on query cycles This moves us towards the goal of having cycle errors be non-fatal by not relying on the default implementation of `ty::maps::values::Value` which aborts on errors. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
This moves us towards the goal of having cycle errors be non-fatal by not relying on the default implementation of
ty::maps::values::Value
which aborts on errors.r? @nikomatsakis