Skip to content

Commit

Permalink
Delete no_hygiene config for rustc older than 1.45
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 16, 2023
1 parent 467a0b4 commit 56c04ea
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 21 deletions.
4 changes: 0 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ fn main() {
println!("cargo:rustc-cfg=span_locations");
}

if version.minor < 45 {
println!("cargo:rustc-cfg=no_hygiene");
}

if version.minor < 47 {
println!("cargo:rustc-cfg=no_ident_new_raw");
}
Expand Down
1 change: 0 additions & 1 deletion src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ impl Span {
Span { lo: 0, hi: 0 }
}

#[cfg(not(no_hygiene))]
pub fn mixed_site() -> Self {
Span::call_site()
}
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ impl Span {
/// The span located at the invocation of the procedural macro, but with
/// local variables, labels, and `$crate` resolved at the definition site
/// of the macro. This is the same hygiene behavior as `macro_rules`.
///
/// This function requires Rust 1.45 or later.
#[cfg(not(no_hygiene))]
pub fn mixed_site() -> Self {
Span::_new(imp::Span::mixed_site())
}
Expand Down
13 changes: 0 additions & 13 deletions src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ impl Span {
}
}

#[cfg(not(no_hygiene))]
pub fn mixed_site() -> Self {
if inside_proc_macro() {
Span::Compiler(proc_macro::Span::mixed_site())
Expand All @@ -417,27 +416,15 @@ impl Span {

pub fn resolved_at(&self, other: Span) -> Span {
match (self, other) {
#[cfg(not(no_hygiene))]
(Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.resolved_at(b)),

// Name resolution affects semantics, but location is only cosmetic
#[cfg(no_hygiene)]
(Span::Compiler(_), Span::Compiler(_)) => other,

(Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.resolved_at(b)),
_ => mismatch(),
}
}

pub fn located_at(&self, other: Span) -> Span {
match (self, other) {
#[cfg(not(no_hygiene))]
(Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.located_at(b)),

// Name resolution affects semantics, but location is only cosmetic
#[cfg(no_hygiene)]
(Span::Compiler(_), Span::Compiler(_)) => *self,

(Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.located_at(b)),
_ => mismatch(),
}
Expand Down

0 comments on commit 56c04ea

Please sign in to comment.