Skip to content

Commit b3ac19c

Browse files
authored
Merge pull request #305 from dtolnay/openclose
Enable span_open() and span_close() on Rust 1.55+
2 parents 366c402 + bf7f116 commit b3ac19c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ fn main() {
8888
println!("cargo:rustc-cfg=no_literal_from_str");
8989
}
9090

91+
if version.minor < 55 {
92+
println!("cargo:rustc-cfg=no_group_open_close");
93+
}
94+
9195
if version.minor < 57 {
9296
println!("cargo:rustc-cfg=no_is_available");
9397
}

src/wrapper.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,19 +620,19 @@ impl Group {
620620

621621
pub fn span_open(&self) -> Span {
622622
match self {
623-
#[cfg(proc_macro_span)]
623+
#[cfg(not(no_group_open_close))]
624624
Group::Compiler(g) => Span::Compiler(g.span_open()),
625-
#[cfg(not(proc_macro_span))]
625+
#[cfg(no_group_open_close)]
626626
Group::Compiler(g) => Span::Compiler(g.span()),
627627
Group::Fallback(g) => Span::Fallback(g.span_open()),
628628
}
629629
}
630630

631631
pub fn span_close(&self) -> Span {
632632
match self {
633-
#[cfg(proc_macro_span)]
633+
#[cfg(not(no_group_open_close))]
634634
Group::Compiler(g) => Span::Compiler(g.span_close()),
635-
#[cfg(not(proc_macro_span))]
635+
#[cfg(no_group_open_close)]
636636
Group::Compiler(g) => Span::Compiler(g.span()),
637637
Group::Fallback(g) => Span::Fallback(g.span_close()),
638638
}

0 commit comments

Comments
 (0)