mirror of
https://gitee.com/openharmony/third_party_rust_proc-macro2
synced 2024-11-27 01:20:48 +00:00
Backport LexError's Display to rust <1.44
This commit is contained in:
parent
7221690e7e
commit
0093bbb16d
4
build.rs
4
build.rs
@ -69,6 +69,10 @@ fn main() {
|
||||
println!("cargo:rustc-cfg=no_bind_by_move_pattern_guard");
|
||||
}
|
||||
|
||||
if version.minor >= 44 {
|
||||
println!("cargo:rustc-cfg=lexerror_display");
|
||||
}
|
||||
|
||||
if version.minor >= 45 {
|
||||
println!("cargo:rustc-cfg=hygiene");
|
||||
}
|
||||
|
@ -267,7 +267,10 @@ impl Debug for LexError {
|
||||
impl Display for LexError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
#[cfg(lexerror_display)]
|
||||
LexError::Compiler(e) => Display::fmt(e, f),
|
||||
#[cfg(not(lexerror_display))]
|
||||
LexError::Compiler(_e) => Display::fmt(&fallback::LexError, f),
|
||||
LexError::Fallback(e) => Display::fmt(e, f),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user