File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1148,6 +1148,13 @@ fn build_base_args(
1148
1148
unit. pkg. package_id( ) . version( )
1149
1149
) )
1150
1150
} ;
1151
+ let unit_capped_warn = |msg : & str | {
1152
+ if unit. show_warnings ( bcx. gctx ) {
1153
+ warn ( msg)
1154
+ } else {
1155
+ Ok ( ( ) )
1156
+ }
1157
+ } ;
1151
1158
1152
1159
cmd. arg ( "--crate-name" ) . arg ( & unit. target . crate_name ( ) ) ;
1153
1160
@@ -1339,7 +1346,7 @@ fn build_base_args(
1339
1346
None => None ,
1340
1347
Some ( toml:: Value :: Boolean ( b) ) => Some ( b) ,
1341
1348
Some ( v) => {
1342
- warn ( & format ! (
1349
+ unit_capped_warn ( & format ! (
1343
1350
"ignoring unsupported value type ({}) for 'hints.mostly-unused', which expects a boolean" ,
1344
1351
v. type_str( )
1345
1352
) ) ?;
@@ -1354,11 +1361,12 @@ fn build_base_args(
1354
1361
cmd. arg ( "-Zhint-mostly-unused" ) ;
1355
1362
} else {
1356
1363
if profile_hint_mostly_unused. is_some ( ) {
1364
+ // Profiles come from the top-level unit, so we don't use `unit_capped_warn` here.
1357
1365
warn (
1358
1366
"ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it" ,
1359
1367
) ?;
1360
1368
} else if pkg_hint_mostly_unused. is_some ( ) {
1361
- warn (
1369
+ unit_capped_warn (
1362
1370
"ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it" ,
1363
1371
) ?;
1364
1372
}
Original file line number Diff line number Diff line change @@ -124,7 +124,6 @@ fn hint_unknown_type_warn() {
124
124
[DOWNLOADING] crates ...
125
125
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
126
126
[WARNING] foo@0.0.1: ignoring unsupported value type (string) for 'hints.mostly-unused', which expects a boolean
127
- [WARNING] bar@1.0.0: ignoring unsupported value type (integer) for 'hints.mostly-unused', which expects a boolean
128
127
[CHECKING] bar v1.0.0
129
128
[RUNNING] `rustc --crate-name bar [..]`
130
129
[CHECKING] foo v0.0.1 ([ROOT]/foo)
@@ -178,7 +177,6 @@ fn hints_mostly_unused_warn_without_gate() {
178
177
[DOWNLOADING] crates ...
179
178
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
180
179
[WARNING] foo@0.0.1: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
181
- [WARNING] bar@1.0.0: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
182
180
[CHECKING] bar v1.0.0
183
181
[RUNNING] `rustc --crate-name bar [..]`
184
182
[CHECKING] foo v0.0.1 ([ROOT]/foo)
You can’t perform that action at this time.
0 commit comments