-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lib): use precise capturing on 1.82+ (#435)
* feat: add build cfg * feat: test precise capturing * fix: typo * fix: indentation * chore: add documentation about cfg flag * fix: raise MSRV * chore: change msrv for cargo-msrv * fix: add rustfmt component
- Loading branch information
Showing
5 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,10 @@ members = ["logos-cli", "logos-codegen", "logos-derive", "tests", "fuzz"] | |
resolver = "2" | ||
|
||
[workspace.package] | ||
authors = ["Maciej Hirsz <[email protected]>", "Jérome Eertmans (maintainer) <[email protected]>"] | ||
authors = [ | ||
"Maciej Hirsz <[email protected]>", | ||
"Jérome Eertmans (maintainer) <[email protected]>", | ||
] | ||
categories = ["parsing", "text-processing"] | ||
description = "Create ridiculously fast Lexers" | ||
edition = "2021" | ||
|
@@ -12,7 +15,7 @@ keywords = ["lexer", "lexical", "tokenizer", "parser", "no_std"] | |
license = "MIT OR Apache-2.0" | ||
readme = "README.md" | ||
repository = "https://github.com/maciejhirsz/logos" | ||
rust-version = "1.70.0" | ||
rust-version = "1.74.0" | ||
version = "0.14.2" | ||
|
||
[package] | ||
|
@@ -30,7 +33,7 @@ rust-version.workspace = true | |
version.workspace = true | ||
|
||
[package.metadata] | ||
msrv = "1.70.0" # Needed to duplicate, because cargo-msrv does not support workspace | ||
msrv = "1.74.0" # Needed to duplicate, because cargo-msrv does not support workspace | ||
|
||
[package.metadata.release] | ||
pre-release-replacements = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use rustc_version::{version_meta, Version}; | ||
|
||
fn main() { | ||
let version_meta = version_meta().expect("Could not get Rust version"); | ||
|
||
let rustc_version = version_meta.semver; | ||
let trimmed_rustc_version = Version::new( | ||
rustc_version.major, | ||
rustc_version.minor, | ||
rustc_version.patch, | ||
); | ||
|
||
// Add cfg flag for Rust >= 1.82 | ||
// Required for precise capturing in edition 2024 | ||
// Due to changes in lifetime and type capture behavior for impl trait | ||
// see: https://github.com/maciejhirsz/logos/issues/434, https://github.com/rust-lang/rfcs/pull/3498 | ||
println!("cargo:rustc-check-cfg=cfg(rust_1_82)"); | ||
if trimmed_rustc_version >= Version::new(1, 82, 0) { | ||
println!("cargo:rustc-cfg=rust_1_82"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters