|
17 | 17 | //! also check out the `src/bootstrap/README.md` file for more information.
|
18 | 18 |
|
19 | 19 | use std::cell::{Cell, RefCell};
|
20 |
| -use std::collections::{HashMap, HashSet}; |
| 20 | +use std::collections::{BTreeSet, HashMap, HashSet}; |
21 | 21 | use std::fmt::Display;
|
22 | 22 | use std::fs::{self, File};
|
23 | 23 | use std::path::{Path, PathBuf};
|
@@ -661,38 +661,35 @@ impl Build {
|
661 | 661 | &self.config.rust_info
|
662 | 662 | }
|
663 | 663 |
|
664 |
| - /// Gets the space-separated set of activated features for the standard |
665 |
| - /// library. This can be configured with the `std_features` key in config.toml. |
| 664 | + /// Gets the space-separated set of activated features for the standard ibrary. This can be configured with the `std-features` key in config.toml. |
666 | 665 | fn std_features(&self, target: TargetSelection) -> String {
|
667 |
| - let mut features = if let Some(features) = &self.config.rust_std_features { |
668 |
| - features.iter().map(|s| s.as_ref()).collect::<Vec<&str>>() |
| 666 | + let mut features: BTreeSet<&str> = if let Some(features) = &self.config.rust_std_features { |
| 667 | + features.iter().map(|s| s.as_str()).collect() |
669 | 668 | } else {
|
670 |
| - vec![] |
| 669 | + BTreeSet::new() |
671 | 670 | };
|
672 | 671 |
|
673 |
| - if !features.contains(&"panic-unwind") { |
674 |
| - features.push("panic-unwind"); |
675 |
| - } |
| 672 | + features.insert("panic-unwind"); |
676 | 673 |
|
677 | 674 | match self.config.llvm_libunwind(target) {
|
678 |
| - LlvmLibunwind::InTree => features.push("llvm-libunwind"), |
679 |
| - LlvmLibunwind::System => features.push("system-llvm-libunwind"), |
680 |
| - LlvmLibunwind::No => {} |
681 |
| - } |
| 675 | + LlvmLibunwind::InTree => features.insert("llvm-libunwind"), |
| 676 | + LlvmLibunwind::System => features.insert("system-llvm-libunwind"), |
| 677 | + LlvmLibunwind::No => false, |
| 678 | + }; |
| 679 | + |
682 | 680 | if self.config.backtrace {
|
683 |
| - features.push("backtrace"); |
| 681 | + features.insert("backtrace"); |
684 | 682 | }
|
685 | 683 | if self.config.profiler_enabled(target) {
|
686 |
| - features.push("profiler"); |
| 684 | + features.insert("profiler"); |
687 | 685 | }
|
688 | 686 | // Generate memcpy, etc. FIXME: Remove this once compiler-builtins
|
689 | 687 | // automatically detects this target.
|
690 | 688 | if target.contains("zkvm") {
|
691 |
| - features.push("compiler-builtins-mem"); |
| 689 | + features.insert("compiler-builtins-mem"); |
692 | 690 | }
|
693 | 691 |
|
694 |
| - // remove duplicates |
695 |
| - features.into_iter().collect::<HashSet<_>>().into_iter().collect::<Vec<_>>().join(" ") |
| 692 | + features.into_iter().collect::<Vec<_>>().join(" ") |
696 | 693 | }
|
697 | 694 |
|
698 | 695 | /// Gets the space-separated set of activated features for the compiler.
|
|
0 commit comments