Use generic NonZero internally.

This commit is contained in:
Markus Reiter
2024-01-29 23:59:09 +01:00
parent ee9c7c940c
commit 746a58d435
144 changed files with 653 additions and 604 deletions

View File

@@ -21,7 +21,7 @@ use rustc_session::parse::feature_err_issue;
use rustc_session::Session;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use std::num::NonZeroU32;
use std::num::NonZero;
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum StabilityLevel {
@@ -102,7 +102,7 @@ pub fn report_unstable(
sess: &Session,
feature: Symbol,
reason: Option<Symbol>,
issue: Option<NonZeroU32>,
issue: Option<NonZero<u32>>,
suggestion: Option<(Span, String, String, Applicability)>,
is_soft: bool,
span: Span,
@@ -235,7 +235,7 @@ pub enum EvalResult {
Deny {
feature: Symbol,
reason: Option<Symbol>,
issue: Option<NonZeroU32>,
issue: Option<NonZero<u32>>,
suggestion: Option<(Span, String, String, Applicability)>,
is_soft: bool,
},
@@ -433,7 +433,7 @@ impl<'tcx> TyCtxt<'tcx> {
// the `-Z force-unstable-if-unmarked` flag present (we're
// compiling a compiler crate), then let this missing feature
// annotation slide.
if feature == sym::rustc_private && issue == NonZeroU32::new(27812) {
if feature == sym::rustc_private && issue == NonZero::<u32>::new(27812) {
if self.sess.opts.unstable_opts.force_unstable_if_unmarked {
return EvalResult::Allow;
}