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 @@ -115,7 +115,6 @@ fn hint_unknown_type_warn() {
115
115
[DOWNLOADING] crates ...
116
116
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
117
117
[WARNING] foo@0.0.1: ignoring unsupported value type (string) for 'hints.mostly-unused', which expects a boolean
118
- [WARNING] bar@1.0.0: ignoring unsupported value type (integer) for 'hints.mostly-unused', which expects a boolean
119
118
[CHECKING] bar v1.0.0
120
119
[RUNNING] `rustc --crate-name bar [..]`
121
120
[CHECKING] foo v0.0.1 ([ROOT]/foo)
@@ -169,7 +168,6 @@ fn hints_mostly_unused_warn_without_gate() {
169
168
[DOWNLOADING] crates ...
170
169
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
171
170
[WARNING] foo@0.0.1: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
172
- [WARNING] bar@1.0.0: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
173
171
[CHECKING] bar v1.0.0
174
172
[RUNNING] `rustc --crate-name bar [..]`
175
173
[CHECKING] foo v0.0.1 ([ROOT]/foo)
You can’t perform that action at this time.
0 commit comments