Skip to content

Commit 76d7af0

Browse files
committed
Expose a non-Symbol way to access current rustc version string
1 parent f4f5b05 commit 76d7af0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_utils/src/qualify_min_const_fn.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use crate::msrvs::Msrv;
77
use hir::LangItem;
8-
use rustc_attr::{rust_version_symbol, Since};
8+
use rustc_attr::{Since, CURRENT_RUSTC_VERSION};
99
use rustc_const_eval::transform::check_consts::ConstCx;
1010
use rustc_hir as hir;
1111
use rustc_hir::def_id::DefId;
@@ -380,10 +380,9 @@ fn is_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool {
380380
Since::Current => {
381381
// HACK(nilstrieb): CURRENT_RUSTC_VERSION can return versions like 1.66.0-dev.
382382
// `rustc-semver` doesn't accept the `-dev` version number so we have to strip it off.
383-
let current_rustc_version = rust_version_symbol();
384-
let short_version = current_rustc_version.as_str().split('-').next().unwrap();
383+
let short_version = CURRENT_RUSTC_VERSION.split('-').next().unwrap();
385384
RustcVersion::parse(short_version).unwrap_or_else(|err| {
386-
panic!("`rustc_attr::StabilityLevel::Stable::since` is ill-formatted: `{current_rustc_version}`, {err:?}")
385+
panic!("`rustc_attr::StabilityLevel::Stable::since` is ill-formatted: `{CURRENT_RUSTC_VERSION}`, {err:?}")
387386
})
388387
},
389388
Since::Err => return false,

0 commit comments

Comments
 (0)