Skip to content

Commit 82a239c

Browse files
authored
Rollup merge of rust-lang#135747 - ehuss:filename-quote, r=SparrowLii
Rename FileName::QuoteExpansion to CfgSpec I believe this variant name was used incorrectly. The timeline is roughly: * `FileName::cfg_spec_source_code` was added in rust-lang#54517. However, it used `FileName::Quote` instead of `FileName::CfgSpec` which I believe was a mistake. * Quote stuff was removed in rust-lang#51285, but did not remove `FileName::Quote`. * `FileName::CfgSpec` was removed in rust-lang#116474 because it was unused. This restores it so that the `--cfg` variant uses a name that makes more sense with how it is used, and restores what I think is the original intent.
2 parents f3f21ae + cee4563 commit 82a239c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compiler/rustc_session/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ impl Input {
888888
Input::File(file) => Some(file),
889889
Input::Str { name, .. } => match name {
890890
FileName::Real(real) => real.local_path(),
891-
FileName::QuoteExpansion(_) => None,
891+
FileName::CfgSpec(_) => None,
892892
FileName::Anon(_) => None,
893893
FileName::MacroExpansion(_) => None,
894894
FileName::ProcMacroSourceCode(_) => None,

compiler/rustc_span/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ impl RealFileName {
305305
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, Decodable, Encodable)]
306306
pub enum FileName {
307307
Real(RealFileName),
308-
/// Call to `quote!`.
309-
QuoteExpansion(Hash64),
308+
/// Strings provided as `--cfg [cfgspec]`.
309+
CfgSpec(Hash64),
310310
/// Command line.
311311
Anon(Hash64),
312312
/// Hack in `src/librustc_ast/parse.rs`.
@@ -353,7 +353,7 @@ impl fmt::Display for FileNameDisplay<'_> {
353353
Real(ref name) => {
354354
write!(fmt, "{}", name.to_string_lossy(self.display_pref))
355355
}
356-
QuoteExpansion(_) => write!(fmt, "<quote expansion>"),
356+
CfgSpec(_) => write!(fmt, "<cfgspec>"),
357357
MacroExpansion(_) => write!(fmt, "<macro expansion>"),
358358
Anon(_) => write!(fmt, "<anon>"),
359359
ProcMacroSourceCode(_) => write!(fmt, "<proc-macro source code>"),
@@ -384,7 +384,7 @@ impl FileName {
384384
| ProcMacroSourceCode(_)
385385
| CliCrateAttr(_)
386386
| Custom(_)
387-
| QuoteExpansion(_)
387+
| CfgSpec(_)
388388
| DocTest(_, _)
389389
| InlineAsm(_) => false,
390390
}
@@ -425,7 +425,7 @@ impl FileName {
425425
pub fn cfg_spec_source_code(src: &str) -> FileName {
426426
let mut hasher = StableHasher::new();
427427
src.hash(&mut hasher);
428-
FileName::QuoteExpansion(hasher.finish())
428+
FileName::CfgSpec(hasher.finish())
429429
}
430430

431431
pub fn cli_crate_attr_source_code(src: &str) -> FileName {

0 commit comments

Comments
 (0)