-
Notifications
You must be signed in to change notification settings - Fork 13.3k
query for def_span #41593
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
Merged
Merged
query for def_span #41593
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
932d251
query for def_span
hackeryarn 93ac5df
review updateds
hackeryarn ba90718
found the stack overflow culprit
hackeryarn 2f73b17
Merge branch 'master' into def_span
hackeryarn ad1959e
added dep nodes and comment
hackeryarn 00d02cf
chaned dep nodes impl
hackeryarn d3b7af0
removed custom functions and comment
hackeryarn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,6 +285,12 @@ impl<'tcx> QueryDescription for queries::describe_def<'tcx> { | |
} | ||
} | ||
|
||
impl<'tcx> QueryDescription for queries::def_span<'tcx> { | ||
fn describe(_: TyCtxt, _: DefId) -> String { | ||
bug!("def_span") | ||
} | ||
} | ||
|
||
macro_rules! define_maps { | ||
(<$tcx:tt> | ||
$($(#[$attr:meta])* | ||
|
@@ -359,8 +365,8 @@ macro_rules! define_maps { | |
} | ||
|
||
// FIXME(eddyb) Get more valid Span's on queries. | ||
if span == DUMMY_SP { | ||
span = key.default_span(tcx); | ||
if span == DUMMY_SP && stringify!($name) != "def_span" { | ||
span = key.default_span(tcx) | ||
} | ||
|
||
let _task = tcx.dep_graph.in_task(Self::to_dep_node(&key)); | ||
|
@@ -568,7 +574,9 @@ define_maps! { <'tcx> | |
[] def_symbol_name: SymbolName(DefId) -> ty::SymbolName, | ||
[] symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName, | ||
|
||
[] describe_def: meta_data_node(DefId) -> Option<Def> | ||
|
||
[] describe_def: MetaData(DefId) -> Option<Def>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary extra empty line. |
||
[] def_span: MetaData(DefId) -> Span | ||
} | ||
|
||
fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> { | ||
|
@@ -600,7 +608,3 @@ fn typeck_item_bodies_dep_node(_: CrateNum) -> DepNode<DefId> { | |
fn const_eval_dep_node((def_id, _): (DefId, &Substs)) -> DepNode<DefId> { | ||
DepNode::ConstEval(def_id) | ||
} | ||
|
||
fn meta_data_node(def_id: DefId) -> DepNode<DefId> { | ||
DepNode::MetaData(def_id) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 guess this is not too bad of a workaround - could you leave a comment above as to why this is done?