mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Pre-intern a symbol for env!("CFG_RELEASE")
This commit is contained in:
parent
5563a9ba3d
commit
ac4fa3f245
@ -26,10 +26,6 @@ pub const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION";
|
||||
|
||||
pub const CURRENT_RUSTC_VERSION: &str = env!("CFG_RELEASE");
|
||||
|
||||
pub fn rust_version_symbol() -> Symbol {
|
||||
Symbol::intern(CURRENT_RUSTC_VERSION)
|
||||
}
|
||||
|
||||
pub fn is_builtin_attr(attr: &Attribute) -> bool {
|
||||
attr.is_doc_comment() || attr.ident().is_some_and(|ident| is_builtin_attr_name(ident.name))
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
//! collect them instead.
|
||||
|
||||
use rustc_ast::Attribute;
|
||||
use rustc_attr::{rust_version_symbol, VERSION_PLACEHOLDER};
|
||||
use rustc_attr::VERSION_PLACEHOLDER;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::middle::lib_features::LibFeatures;
|
||||
@ -59,7 +59,7 @@ impl<'tcx> LibFeatureCollector<'tcx> {
|
||||
if let Some(s) = since
|
||||
&& s.as_str() == VERSION_PLACEHOLDER
|
||||
{
|
||||
since = Some(rust_version_symbol());
|
||||
since = Some(sym::env_CFG_RELEASE);
|
||||
}
|
||||
|
||||
if let Some(feature) = feature {
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
use crate::errors;
|
||||
use rustc_attr::{
|
||||
self as attr, rust_version_symbol, ConstStability, Since, Stability, StabilityLevel, Unstable,
|
||||
UnstableReason, VERSION_PLACEHOLDER,
|
||||
self as attr, ConstStability, Since, Stability, StabilityLevel, Unstable, UnstableReason,
|
||||
VERSION_PLACEHOLDER,
|
||||
};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
|
||||
use rustc_hir as hir;
|
||||
@ -1115,7 +1115,7 @@ fn unnecessary_stable_feature_lint(
|
||||
mut since: Symbol,
|
||||
) {
|
||||
if since.as_str() == VERSION_PLACEHOLDER {
|
||||
since = rust_version_symbol();
|
||||
since = sym::env_CFG_RELEASE;
|
||||
}
|
||||
tcx.emit_spanned_lint(
|
||||
lint::builtin::STABLE_FEATURES,
|
||||
|
@ -713,6 +713,7 @@ symbols! {
|
||||
encode,
|
||||
end,
|
||||
env,
|
||||
env_CFG_RELEASE: env!("CFG_RELEASE"),
|
||||
eprint_macro,
|
||||
eprintln_macro,
|
||||
eq,
|
||||
|
Loading…
Reference in New Issue
Block a user