1
Fork 0

rustc_error: make ErrorReported impossible to construct

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
This commit is contained in:
mark 2022-01-22 18:49:12 -06:00
parent 461e807801
commit bb8d4307eb
104 changed files with 705 additions and 550 deletions

View file

@ -169,7 +169,7 @@ impl CheckAttrVisitor<'_> {
}
ast::AttrStyle::Inner => "crate-level attribute should be in the root module",
};
lint.build(msg).emit()
lint.build(msg).emit();
});
}
}
@ -236,7 +236,7 @@ impl CheckAttrVisitor<'_> {
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => true,
Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => {
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
lint.build("`#[inline]` is ignored on function prototypes").emit()
lint.build("`#[inline]` is ignored on function prototypes").emit();
});
true
}

View file

@ -1588,7 +1588,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
shorthands,
Applicability::MachineApplicable,
);
err.emit()
err.emit();
},
);
} else {
@ -1611,7 +1611,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
non_shorthands,
Applicability::MachineApplicable,
);
err.emit()
err.emit();
},
);
}

View file

@ -128,7 +128,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
String::new(),
rustc_errors::Applicability::MachineApplicable,
)
.emit()
.emit();
});
}
@ -728,10 +728,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
item.hir_id(),
span,
|lint| lint
|lint| {lint
.build("an `#[unstable]` annotation here has no effect")
.note("see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information")
.emit()
.emit();}
);
}
}