Remove now unneeded check_stability argument

This commit is contained in:
Avi Dessauer 2020-06-30 19:05:14 -04:00 committed by Jacob Hughes
parent a1892f1a79
commit 3947591ee8
3 changed files with 9 additions and 17 deletions

View File

@ -293,15 +293,9 @@ impl<'tcx> TyCtxt<'tcx> {
/// If `id` is `Some(_)`, this function will also check if the item at `def_id` has been
/// deprecated. If the item is indeed deprecated, we will emit a deprecation lint attached to
/// `id`.
pub fn eval_stability(
self,
def_id: DefId,
id: Option<HirId>,
span: Span,
check_deprecation: bool,
) -> EvalResult {
pub fn eval_stability(self, def_id: DefId, id: Option<HirId>, span: Span) -> EvalResult {
// Deprecated attributes apply in-crate and cross-crate.
if let (Some(id), true) = (id, check_deprecation) {
if let Some(id) = id {
if let Some(depr_entry) = self.lookup_deprecation_entry(def_id) {
let parent_def_id = self.hir().local_def_id(self.hir().get_parent_item(id));
let skip = self
@ -398,10 +392,10 @@ impl<'tcx> TyCtxt<'tcx> {
/// If the item defined by `def_id` is unstable and the corresponding `#![feature]` does not
/// exist, emits an error.
///
/// Additionally, this function will also check if the item is deprecated. If so, and `id` is
/// not `None`, a deprecated lint attached to `id` will be emitted.
/// This function will also check if the item is deprecated.
/// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted.
pub fn check_stability(self, def_id: DefId, id: Option<HirId>, span: Span) {
self.check_stability_internal(def_id, id, span, true, |span, def_id| {
self.check_stability_internal(def_id, id, span, |span, def_id| {
// The API could be uncallable for other reasons, for example when a private module
// was referenced.
self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id));
@ -413,14 +407,13 @@ impl<'tcx> TyCtxt<'tcx> {
/// If the item defined by `def_id` is unstable and the corresponding `#![feature]` does not
/// exist, emits an error.
///
/// Additionally when `inherit_dep` is `true`, this function will also check if the item is deprecated. If so, and `id` is
/// not `None`, a deprecated lint attached to `id` will be emitted.
/// This function will also check if the item is deprecated.
/// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted.
pub fn check_stability_internal(
self,
def_id: DefId,
id: Option<HirId>,
span: Span,
check_deprecation: bool,
unmarked: impl FnOnce(Span, DefId) -> (),
) {
let soft_handler = |lint, span, msg: &_| {
@ -428,7 +421,7 @@ impl<'tcx> TyCtxt<'tcx> {
lint.build(msg).emit()
})
};
match self.eval_stability(def_id, id, span, check_deprecation) {
match self.eval_stability(def_id, id, span) {
EvalResult::Allow => {}
EvalResult::Deny { feature, reason, issue, is_soft } => {
report_unstable(self.sess, feature, reason, issue, is_soft, span, soft_handler)

View File

@ -366,7 +366,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
param.def_id,
Some(arg.id()),
arg.span(),
false,
|_, _| (),
)
}

View File

@ -1227,7 +1227,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
if let Some(uc) = unstable_candidates {
applicable_candidates.retain(|&(p, _)| {
if let stability::EvalResult::Deny { feature, .. } =
self.tcx.eval_stability(p.item.def_id, None, self.span, true)
self.tcx.eval_stability(p.item.def_id, None, self.span)
{
uc.push((p, feature));
return false;