Skip to content

Commit d667a42

Browse files
committed
Remove "override" terminology
1 parent d03c411 commit d667a42

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

compiler/rustc_middle/src/middle/stability.rs

+13-14
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ use rustc_errors::{Applicability, Diagnostic};
1111
use rustc_feature::GateIssue;
1212
use rustc_hir::def::DefKind;
1313
use rustc_hir::def_id::{DefId, LocalDefId};
14-
use rustc_hir::{self as hir};
15-
use rustc_hir::{self, HirId};
14+
use rustc_hir::{self as hir, HirId};
1615
use rustc_middle::ty::print::with_no_trimmed_paths;
1716
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
1817
use rustc_session::lint::{BuiltinLintDiagnostics, Level, Lint, LintBuffer};
@@ -331,7 +330,7 @@ impl<'tcx> TyCtxt<'tcx> {
331330
span: Span,
332331
method_span: Option<Span>,
333332
) -> EvalResult {
334-
self.eval_stability_override(def_id, id, span, method_span, AllowUnstable::No)
333+
self.eval_stability_allow_unstable(def_id, id, span, method_span, AllowUnstable::No)
335334
}
336335

337336
/// Evaluates the stability of an item.
@@ -344,14 +343,14 @@ impl<'tcx> TyCtxt<'tcx> {
344343
/// deprecated. If the item is indeed deprecated, we will emit a deprecation lint attached to
345344
/// `id`.
346345
///
347-
/// Pass `EvalOverride::AllowUnstable` to `eval_override` to force an unstable item to be allowed. Deprecation warnings will be emitted normally.
348-
pub fn eval_stability_override(
346+
/// Pass `AllowUnstable::Yes` to `allow_unstable` to force an unstable item to be allowed. Deprecation warnings will be emitted normally.
347+
pub fn eval_stability_allow_unstable(
349348
self,
350349
def_id: DefId,
351350
id: Option<HirId>,
352351
span: Span,
353352
method_span: Option<Span>,
354-
eval_override: AllowUnstable,
353+
allow_unstable: AllowUnstable,
355354
) -> EvalResult {
356355
// Deprecated attributes apply in-crate and cross-crate.
357356
if let Some(id) = id {
@@ -449,7 +448,7 @@ impl<'tcx> TyCtxt<'tcx> {
449448
}
450449
}
451450

452-
if matches!(eval_override, AllowUnstable::Yes) {
451+
if matches!(allow_unstable, AllowUnstable::Yes) {
453452
return EvalResult::Allow;
454453
}
455454

@@ -479,7 +478,7 @@ impl<'tcx> TyCtxt<'tcx> {
479478
span: Span,
480479
method_span: Option<Span>,
481480
) {
482-
self.check_stability_override(def_id, id, span, method_span, AllowUnstable::No)
481+
self.check_stability_allow_unstable(def_id, id, span, method_span, AllowUnstable::No)
483482
}
484483

485484
/// Checks if an item is stable or error out.
@@ -490,21 +489,21 @@ impl<'tcx> TyCtxt<'tcx> {
490489
/// This function will also check if the item is deprecated.
491490
/// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted.
492491
///
493-
/// Pass `EvalOverride::AllowUnstable` to `eval_override` to force an unstable item to be allowed. Deprecation warnings will be emitted normally.
494-
pub fn check_stability_override(
492+
/// Pass `AllowUnstable::Yes` to `allow_unstable` to force an unstable item to be allowed. Deprecation warnings will be emitted normally.
493+
pub fn check_stability_allow_unstable(
495494
self,
496495
def_id: DefId,
497496
id: Option<HirId>,
498497
span: Span,
499498
method_span: Option<Span>,
500-
eval_override: AllowUnstable,
499+
allow_unstable: AllowUnstable,
501500
) {
502501
self.check_optional_stability(
503502
def_id,
504503
id,
505504
span,
506505
method_span,
507-
eval_override,
506+
allow_unstable,
508507
|span, def_id| {
509508
// The API could be uncallable for other reasons, for example when a private module
510509
// was referenced.
@@ -523,15 +522,15 @@ impl<'tcx> TyCtxt<'tcx> {
523522
id: Option<HirId>,
524523
span: Span,
525524
method_span: Option<Span>,
526-
eval_override: AllowUnstable,
525+
allow_unstable: AllowUnstable,
527526
unmarked: impl FnOnce(Span, DefId),
528527
) {
529528
let soft_handler = |lint, span, msg: &_| {
530529
self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, |lint| {
531530
lint.build(msg).emit();
532531
})
533532
};
534-
match self.eval_stability_override(def_id, id, span, method_span, eval_override) {
533+
match self.eval_stability_allow_unstable(def_id, id, span, method_span, allow_unstable) {
535534
EvalResult::Allow => {}
536535
EvalResult::Deny { feature, reason, issue, suggestion, is_soft } => report_unstable(
537536
self.sess,

compiler/rustc_passes/src/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
807807
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, id: hir::HirId) {
808808
if let Some(def_id) = path.res.opt_def_id() {
809809
let method_span = path.segments.last().map(|s| s.ident.span);
810-
self.tcx.check_stability_override(
810+
self.tcx.check_stability_allow_unstable(
811811
def_id,
812812
Some(id),
813813
path.span,

src/test/ui/stability-attribute/allow-unstable-reexport.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Allow an unstable re-export without requiring a feature gate.
1+
// Allow an unstable re-export without requiring a feature gate.
22
// #94972
33

44
// aux-build:lint-stability.rs

src/test/ui/stability-attribute/allow-unstable-reexport.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error[E0658]: use of unstable library feature 'unstable_test_feature'
2-
--> $DIR/allow-unstable-reexport.rs:21:9
2+
--> $DIR/allow-unstable-reexport.rs:22:9
33
|
44
LL | pub use lint_stability::unstable as unstable2;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
88

99
error[E0658]: use of unstable library feature 'unstable_test_feature'
10-
--> $DIR/allow-unstable-reexport.rs:27:5
10+
--> $DIR/allow-unstable-reexport.rs:28:5
1111
|
1212
LL | unstable();
1313
| ^^^^^^^^
1414
|
1515
= help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
1616

1717
error[E0658]: use of unstable library feature 'unstable_test_feature': text
18-
--> $DIR/allow-unstable-reexport.rs:28:5
18+
--> $DIR/allow-unstable-reexport.rs:29:5
1919
|
2020
LL | unstable_text();
2121
| ^^^^^^^^^^^^^

0 commit comments

Comments
 (0)