Skip to content

Commit

Permalink
Remove now unneeded check_stability argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Avi-D-coder authored and Jacob Hughes committed Sep 23, 2020
1 parent a1892f1 commit 3947591
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
23 changes: 8 additions & 15 deletions compiler/rustc_middle/src/middle/stability.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand All @@ -413,22 +407,21 @@ 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: &_| {
self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, |lint| {
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)
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_typeck/src/astconv/mod.rs
Expand Up @@ -366,7 +366,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
param.def_id,
Some(arg.id()),
arg.span(),
false,
|_, _| (),
)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/method/probe.rs
Expand Up @@ -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;
Expand Down

0 comments on commit 3947591

Please sign in to comment.