Skip to content

Commit 312c2fb

Browse files
committed
Fix fulldeps tests.
1 parent 0f31095 commit 312c2fb

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass {
4040
_: intravisit::FnKind<'tcx>,
4141
_: &'tcx hir::FnDecl,
4242
_: &'tcx hir::Body,
43-
span: source_map::Span,
4443
id: hir::HirId,
4544
) {
4645
let item = match cx.tcx.hir().get(id) {
@@ -51,6 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass {
5150
let whitelisted = |attr| pprust::attribute_to_string(attr).contains("whitelisted_attr");
5251
if !item.attrs.iter().any(whitelisted) {
5352
cx.lint(MISSING_WHITELISTED_ATTR, |lint| {
53+
let span = cx.tcx.hir().span(id);
5454
lint.build("Missing 'whitelisted_attr' attribute").set_span(span).emit()
5555
});
5656
}

src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ macro_rules! fake_lint_pass {
3131
$(
3232
if !attr::contains_name(&krate.item.attrs, $attr) {
3333
cx.lint(CRATE_NOT_OKAY, |lint| {
34+
let span = cx.tcx.hir().span(rustc_hir::CRATE_HIR_ID);
3435
let msg = format!("crate is not marked with #![{}]", $attr);
35-
lint.build(&msg).set_span(krate.item.span).emit()
36+
lint.build(&msg).set_span(span).emit()
3637
});
3738
}
3839
)*

src/test/ui-fulldeps/auxiliary/lint-for-crate.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
2929
fn check_crate(&mut self, cx: &LateContext, krate: &rustc_hir::Crate) {
3030
if !attr::contains_name(&krate.item.attrs, Symbol::intern("crate_okay")) {
3131
cx.lint(CRATE_NOT_OKAY, |lint| {
32+
let span = cx.tcx.hir().span(rustc_hir::CRATE_HIR_ID);
3233
lint.build("crate is not marked with #![crate_okay]")
33-
.set_span(krate.item.span)
34+
.set_span(span)
3435
.emit()
3536
});
3637
}

src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]);
2222

2323
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
2424
fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) {
25+
let it_span = cx.tcx.hir().span(it.hir_id);
2526
match &*it.ident.as_str() {
2627
"lintme" => cx.lint(TEST_LINT, |lint| {
27-
lint.build("item is named 'lintme'").set_span(it.span).emit()
28+
lint.build("item is named 'lintme'").set_span(it_span).emit()
2829
}),
2930
"pleaselintme" => cx.lint(PLEASE_LINT, |lint| {
30-
lint.build("item is named 'pleaselintme'").set_span(it.span).emit()
31+
lint.build("item is named 'pleaselintme'").set_span(it_span).emit()
3132
}),
3233
_ => {}
3334
}

0 commit comments

Comments
 (0)