autocfg readme.opensource修改 Created-by: dragonswordy Commit-by: ljy9810 Merged-by: openharmony_ci Description: ### 一、内容说明(相关的Issue) https://gitcode.com/openharmony/third_party_rust_unicode-ident/issues/3 ### 二、建议测试周期和提测地址 建议测试完成时间:xxxx.xx.xx 投产上线时间:xxxx.xx.xx 提测地址:CI环境/压测环境 测试账号: ### 三、变更内容 * 3.1 关联PR列表 * 3.2 数据库和部署说明 1. 常规更新 2. 重启unicorn 3. 重启sidekiq 4. 迁移任务:是否有迁移任务,没有写 "无" 5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无" * 3.4 其他技术优化内容(做了什么,变更了什么) - 重构了 xxxx 代码 - xxxx 算法优化 * 3.5 废弃通知(什么字段、方法弃用?) * 3.6 后向不兼容变更(是否有无法向后兼容的变更?) ### 四、研发自测点(自测哪些?冒烟用例全部自测?) 自测测试结论: ### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方) 检查点: | 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 | |------|------------|----------|---------------| | xxx | 否 | 需要 | 不需要 | | | | | | 接口测试: 性能测试: 并发测试: 其他: See merge request: openharmony/third_party_rust_autocfg!8
autocfg
A Rust library for build scripts to automatically configure code based on
compiler support. Code snippets are dynamically tested to see if the rustc
will accept them, rather than hard-coding specific version support.
Usage
Add this to your Cargo.toml:
[build-dependencies]
autocfg = "1"
Then use it in your build.rs script to detect compiler features. For
example, to test for 128-bit integer support, it might look like:
extern crate autocfg;
fn main() {
let ac = autocfg::new();
ac.emit_has_type("i128");
// (optional) We don't need to rerun for anything external.
autocfg::rerun_path("build.rs");
}
If the type test succeeds, this will write a cargo:rustc-cfg=has_i128 line
for Cargo, which translates to Rust arguments --cfg has_i128. Then in the
rest of your Rust code, you can add #[cfg(has_i128)] conditions on code that
should only be used when the compiler supports it.
Release Notes
-
1.4.0 (2024-09-26)
- Add
emit_possibilityfor Rust 1.80's checked cfgs, and call that automatically for methods that conditionallyemit, by @Techcable.
- Add
-
1.3.0 (2024-05-03)
- Add
probe_rawfor direct control of the code that will be test-compiled. - Use wrappers when querying the
rustcversion information too.
- Add
-
1.2.0 (2024-03-25)
- Add
no_stdandset_no_stdto control the use of#![no_std]in probes. - Use
RUSTC_WRAPPERandRUSTC_WORKSPACE_WRAPPERwhen they are set.
- Add
-
1.1.0 (2022-02-07)
- Use
CARGO_ENCODED_RUSTFLAGSwhen it is set.
- Use
-
1.0.1 (2020-08-20)
- Apply
RUSTFLAGSfor more--targetscenarios, by @adamreichold.
- Apply
-
1.0.0 (2020-01-08)
- 🎉 Release 1.0! 🎉 (no breaking changes)
- Add
probe_expressionandemit_expression_cfgto test arbitrary expressions. - Add
probe_constantandemit_constant_cfgto test arbitrary constant expressions.
-
0.1.7 (2019-10-20)
- Apply
RUSTFLAGSwhen probing$TARGET != $HOST, mainly for sysroot, by @roblabla.
- Apply
-
0.1.6 (2019-08-19)
- Add
probe/emit_sysroot_crate, by @leo60228.
- Add
-
0.1.5 (2019-07-16)
- Mask some warnings from newer rustc.
-
0.1.4 (2019-05-22)
- Relax
std/no_stdprobing to a warning instead of an error. - Improve
rustcbootstrap compatibility.
- Relax
-
0.1.3 (2019-05-21)
- Auto-detects if
#![no_std]is needed for the$TARGET.
- Auto-detects if
-
0.1.2 (2019-01-16)
- Add
rerun_env(ENV)to printcargo:rerun-if-env-changed=ENV. - Add
rerun_path(PATH)to printcargo:rerun-if-changed=PATH.
- Add
Minimum Rust version policy
This crate's minimum supported rustc version is 1.0.0. Compatibility is
its entire reason for existence, so this crate will be extremely conservative
about raising this requirement. If this is ever deemed necessary, it will be
treated as a major breaking change for semver purposes.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.