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