-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect nightly in icu_capi_freertos, bump to 1.2.1 (#3394)
* Fix freertos on modern nightlies * Bump to 1.2.1 * fix
- Loading branch information
1 parent
a3f79c5
commit 7017c3e
Showing
5 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,41 @@ | ||
// This file is part of ICU4X. For terms of use, please see the file | ||
// called LICENSE at the top level of the ICU4X source tree | ||
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). | ||
|
||
use std::env; | ||
|
||
/// Returns whether the Rust compiler needs an `#[alloc_error_handler]` | ||
/// set. Returns None for cases where we cannot determine the nightly version of the | ||
/// compiler. | ||
fn needs_alloc_error_handler() -> Option<bool> { | ||
use rustc_version::Channel; | ||
let version = rustc_version::version_meta().ok()?; | ||
if version.channel != Channel::Nightly { | ||
// Ignore custom/dev toolchains, commit date | ||
// may not be meaningful | ||
return None; | ||
} | ||
let commit_date = version.commit_date?; | ||
|
||
let year = commit_date.split('-').next()?.parse::<u32>().ok()?; | ||
|
||
// alloc_error_handler became defaulted to the panic handler | ||
// in December 2022. Since it still works until April 2023, | ||
// we can be fuzzy with our dates and just set the boundary at | ||
// 2022/2023 | ||
Some(year <= 2022) | ||
} | ||
|
||
fn main() { | ||
match env::var("CARGO_CFG_TARGET_OS") { | ||
Ok(v) if v == "none" => (), | ||
// Only on target_os = none | ||
_ => return, | ||
}; | ||
|
||
if let Some(true) = needs_alloc_error_handler() { | ||
println!("cargo:rustc-cfg=needs_alloc_error_handler"); | ||
} | ||
|
||
// For unknown compilers, assume that the nightly is recent. | ||
} |
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