Skip to content

Remove Spans from HIR -- 3/N -- hir::Item #73095

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

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3603d31
Remove useless Clone bound in IndexVec.
cjgillot May 19, 2020
76a36df
Introduce HirIdVec.
cjgillot May 19, 2020
c6acd0f
Collect spans during HIR indexing.
cjgillot May 1, 2020
71b5666
Introduce a query for HIR spans.
cjgillot May 8, 2020
5b5bc8d
Collect spans during lowering.
cjgillot May 1, 2020
6a1537c
Collect spans directly into an IndexVec.
cjgillot May 18, 2020
3640fb3
Directly use span map for indexing.
cjgillot May 1, 2020
1b9ccbf
Don't pass spans in hir::map::blocks.
cjgillot May 2, 2020
9f00730
Add comment.
cjgillot Jun 6, 2020
ff32863
Stop passing the Span in HIR visiting.
cjgillot May 2, 2020
61402a5
Pass HirId in save_analysis.
cjgillot Jun 7, 2020
a1b12d8
Remove span from hir::Param.
cjgillot May 1, 2020
dad5ec0
Remove span from hir::Variant.
cjgillot May 1, 2020
0bf0ea2
Remove span from hir::StructField.
cjgillot May 1, 2020
76f16ed
Remove span from hir::Stmt.
cjgillot May 1, 2020
8197821
Remove span from hir::Block.
cjgillot May 1, 2020
deec340
Remove span from hir::MacroDef.
cjgillot May 2, 2020
7584102
Remove span from hir::GenericParam.
cjgillot May 2, 2020
71c2c92
Remove span from hir::Arm.
cjgillot May 2, 2020
f94dac7
Remove span from hir::FieldPat.
cjgillot May 2, 2020
1f05c3d
Remove span from hir::Local.
cjgillot May 2, 2020
61504ae
Remove span from hir::Pat.
cjgillot May 2, 2020
44a58d4
Remove span from hir::Field.
cjgillot May 2, 2020
415ad17
Remove GenericArg::span.
cjgillot May 3, 2020
ed0b627
Remove Span from hir::TypeBinding.
cjgillot May 8, 2020
56ee3f9
Remove Span from hir::ConstArg.
cjgillot Jun 1, 2020
00ce893
Remove Span from hir::TraitItemRef.
cjgillot Jun 1, 2020
0f31095
Remove Span from hir::ImplItemRef.
cjgillot Jun 1, 2020
312c2fb
Fix fulldeps tests.
cjgillot May 9, 2020
d3a1ecd
Pass HirId in librustc_typeck::check.
cjgillot May 2, 2020
63db483
Pass HirId in librustc_lint.
cjgillot May 2, 2020
066195c
Pass HirId in librustc_passes::stability.
cjgillot May 2, 2020
edbbd56
Remove span from hir::Item.
cjgillot May 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove Span from hir::TraitItemRef.
  • Loading branch information
cjgillot committed Jun 23, 2020
commit 00ce8933b173f6639802dd27984e5870e775d97b
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
};
let id = hir::TraitItemId { hir_id: self.lower_node_id(i.id, i.span) };
let defaultness = hir::Defaultness::Default { has_value: has_default };
hir::TraitItemRef { id, ident: i.ident, span: i.span, defaultness, kind }
hir::TraitItemRef { id, ident: i.ident, defaultness, kind }
}

/// Construct `ExprKind::Err` for the given `span`.
Expand Down
1 change: 0 additions & 1 deletion src/librustc_hir/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2564,7 +2564,6 @@ pub struct TraitItemRef {
#[stable_hasher(project(name))]
pub ident: Ident,
pub kind: AssocItemKind,
pub span: Span,
pub defaultness: Defaultness,
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai

pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: &'v TraitItemRef) {
// N.B., deliberately force a compilation error if/when new fields are added.
let TraitItemRef { id, ident, ref kind, span: _, ref defaultness } = *trait_item_ref;
let TraitItemRef { id, ident, ref kind, ref defaultness } = *trait_item_ref;
visitor.visit_nested_trait_item(id);
visitor.visit_ident(ident);
visitor.visit_associated_item_kind(kind);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
fn visit_trait_item_ref(&mut self, ii: &'hir TraitItemRef) {
// Do not visit the duplicate information in TraitItemRef. We want to
// map the actual nodes, not the duplicate ones in the *Ref.
let TraitItemRef { id, ident: _, kind: _, span: _, defaultness: _ } = *ii;
let TraitItemRef { id, ident: _, kind: _, defaultness: _ } = *ii;

self.visit_nested_trait_item(id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ fn foo(&self) -> Self::T { String::new() }
{
if self.type_of(self.hir().local_def_id(item.id.hir_id)) == found {
db.span_label(
item.span,
self.hir().span(item.id.hir_id),
"associated type defaults can't be assumed inside the \
trait defining them",
);
Expand Down