1
- use crate :: core:: compiler:: { CompileKind , CompileMode , CompileTarget , Unit } ;
1
+ use crate :: core:: compiler:: { CompileKind , CompileTarget , Unit } ;
2
2
use crate :: core:: dependency:: Artifact ;
3
3
use crate :: core:: resolver:: features:: FeaturesFor ;
4
- use crate :: core:: { Feature , PackageId , PackageIdSpec , Resolve , Shell , Target , Workspace } ;
4
+ use crate :: core:: { PackageId , PackageIdSpec , Resolve , Shell , Target , Workspace } ;
5
5
use crate :: util:: interning:: InternedString ;
6
6
use crate :: util:: toml:: { ProfilePackageSpec , StringOrBool , TomlProfile , TomlProfiles , U32OrBool } ;
7
7
use crate :: util:: { closest_msg, config, CargoResult , Config } ;
@@ -26,8 +26,6 @@ pub struct Profiles {
26
26
/// This is here to assist with error reporting, as the `ProfileMaker`
27
27
/// values have the inherits chains all merged together.
28
28
original_profiles : BTreeMap < InternedString , TomlProfile > ,
29
- /// Whether or not unstable "named" profiles are enabled.
30
- named_profiles_enabled : bool ,
31
29
/// The profile the user requested to use.
32
30
requested_profile : InternedString ,
33
31
/// The host target for rustc being used by this `Profiles`.
@@ -44,64 +42,8 @@ impl Profiles {
44
42
let mut profiles = merge_config_profiles ( ws, requested_profile) ?;
45
43
let rustc_host = ws. config ( ) . load_global_rustc ( Some ( ws) ) ?. host ;
46
44
47
- if !ws. unstable_features ( ) . is_enabled ( Feature :: named_profiles ( ) ) {
48
- let mut profile_makers = Profiles {
49
- incremental,
50
- named_profiles_enabled : false ,
51
- dir_names : Self :: predefined_dir_names ( ) ,
52
- by_name : HashMap :: new ( ) ,
53
- original_profiles : profiles. clone ( ) ,
54
- requested_profile,
55
- rustc_host,
56
- } ;
57
-
58
- profile_makers. by_name . insert (
59
- InternedString :: new ( "dev" ) ,
60
- ProfileMaker :: new ( Profile :: default_dev ( ) , profiles. remove ( "dev" ) ) ,
61
- ) ;
62
- profile_makers
63
- . dir_names
64
- . insert ( InternedString :: new ( "dev" ) , InternedString :: new ( "debug" ) ) ;
65
-
66
- profile_makers. by_name . insert (
67
- InternedString :: new ( "release" ) ,
68
- ProfileMaker :: new ( Profile :: default_release ( ) , profiles. remove ( "release" ) ) ,
69
- ) ;
70
- profile_makers. dir_names . insert (
71
- InternedString :: new ( "release" ) ,
72
- InternedString :: new ( "release" ) ,
73
- ) ;
74
-
75
- profile_makers. by_name . insert (
76
- InternedString :: new ( "test" ) ,
77
- ProfileMaker :: new ( Profile :: default_test ( ) , profiles. remove ( "test" ) ) ,
78
- ) ;
79
- profile_makers
80
- . dir_names
81
- . insert ( InternedString :: new ( "test" ) , InternedString :: new ( "debug" ) ) ;
82
-
83
- profile_makers. by_name . insert (
84
- InternedString :: new ( "bench" ) ,
85
- ProfileMaker :: new ( Profile :: default_bench ( ) , profiles. remove ( "bench" ) ) ,
86
- ) ;
87
- profile_makers
88
- . dir_names
89
- . insert ( InternedString :: new ( "bench" ) , InternedString :: new ( "release" ) ) ;
90
-
91
- profile_makers. by_name . insert (
92
- InternedString :: new ( "doc" ) ,
93
- ProfileMaker :: new ( Profile :: default_doc ( ) , profiles. remove ( "doc" ) ) ,
94
- ) ;
95
- profile_makers
96
- . dir_names
97
- . insert ( InternedString :: new ( "doc" ) , InternedString :: new ( "debug" ) ) ;
98
-
99
- return Ok ( profile_makers) ;
100
- }
101
-
102
45
let mut profile_makers = Profiles {
103
46
incremental,
104
- named_profiles_enabled : true ,
105
47
dir_names : Self :: predefined_dir_names ( ) ,
106
48
by_name : HashMap :: new ( ) ,
107
49
original_profiles : profiles. clone ( ) ,
@@ -290,48 +232,9 @@ impl Profiles {
290
232
is_member : bool ,
291
233
is_local : bool ,
292
234
unit_for : UnitFor ,
293
- mode : CompileMode ,
294
235
kind : CompileKind ,
295
236
) -> Profile {
296
- let ( profile_name, inherits) = if !self . named_profiles_enabled {
297
- // With the feature disabled, we degrade `--profile` back to the
298
- // `--release` and `--debug` predicates, and convert back from
299
- // ProfileKind::Custom instantiation.
300
-
301
- let release = matches ! ( self . requested_profile. as_str( ) , "release" | "bench" ) ;
302
-
303
- match mode {
304
- CompileMode :: Test | CompileMode :: Bench | CompileMode :: Doctest => {
305
- if release {
306
- (
307
- InternedString :: new ( "bench" ) ,
308
- Some ( InternedString :: new ( "release" ) ) ,
309
- )
310
- } else {
311
- (
312
- InternedString :: new ( "test" ) ,
313
- Some ( InternedString :: new ( "dev" ) ) ,
314
- )
315
- }
316
- }
317
- CompileMode :: Build | CompileMode :: Check { .. } | CompileMode :: RunCustomBuild => {
318
- // Note: `RunCustomBuild` doesn't normally use this code path.
319
- // `build_unit_profiles` normally ensures that it selects the
320
- // ancestor's profile. However, `cargo clean -p` can hit this
321
- // path.
322
- if release {
323
- ( InternedString :: new ( "release" ) , None )
324
- } else {
325
- ( InternedString :: new ( "dev" ) , None )
326
- }
327
- }
328
- CompileMode :: Doc { .. } | CompileMode :: Docscrape => {
329
- ( InternedString :: new ( "doc" ) , None )
330
- }
331
- }
332
- } else {
333
- ( self . requested_profile , None )
334
- } ;
237
+ let ( profile_name, inherits) = ( self . requested_profile , None ) ;
335
238
let maker = self . get_profile_maker ( profile_name) . unwrap ( ) ;
336
239
let mut profile = maker. get_profile ( Some ( pkg_id) , is_member, unit_for. is_for_host ( ) ) ;
337
240
@@ -404,15 +307,7 @@ impl Profiles {
404
307
/// `[Finished]` line. It is not entirely accurate, since it doesn't
405
308
/// select for the package that was actually built.
406
309
pub fn base_profile ( & self ) -> Profile {
407
- let profile_name = if !self . named_profiles_enabled {
408
- match self . requested_profile . as_str ( ) {
409
- "release" | "bench" => self . requested_profile ,
410
- _ => InternedString :: new ( "dev" ) ,
411
- }
412
- } else {
413
- self . requested_profile
414
- } ;
415
-
310
+ let profile_name = self . requested_profile ;
416
311
let maker = self . get_profile_maker ( profile_name) . unwrap ( ) ;
417
312
maker. get_profile ( None , /*is_member*/ true , /*is_for_host*/ false )
418
313
}
@@ -772,29 +667,6 @@ impl Profile {
772
667
}
773
668
}
774
669
775
- // NOTE: Remove the following three once `named_profiles` is default:
776
-
777
- fn default_test ( ) -> Profile {
778
- Profile {
779
- name : InternedString :: new ( "test" ) ,
780
- ..Profile :: default_dev ( )
781
- }
782
- }
783
-
784
- fn default_bench ( ) -> Profile {
785
- Profile {
786
- name : InternedString :: new ( "bench" ) ,
787
- ..Profile :: default_release ( )
788
- }
789
- }
790
-
791
- fn default_doc ( ) -> Profile {
792
- Profile {
793
- name : InternedString :: new ( "doc" ) ,
794
- ..Profile :: default_dev ( )
795
- }
796
- }
797
-
798
670
/// Compares all fields except `name`, which doesn't affect compilation.
799
671
/// This is necessary for `Unit` deduplication for things like "test" and
800
672
/// "dev" which are essentially the same.
0 commit comments