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(
11481148 unit. pkg. package_id( ) . version( )
11491149 ) )
11501150 } ;
1151+ let unit_capped_warn = |msg : & str | {
1152+ if unit. show_warnings ( bcx. gctx ) {
1153+ warn ( msg)
1154+ } else {
1155+ Ok ( ( ) )
1156+ }
1157+ } ;
11511158
11521159 cmd. arg ( "--crate-name" ) . arg ( & unit. target . crate_name ( ) ) ;
11531160
@@ -1339,7 +1346,7 @@ fn build_base_args(
13391346 None => None ,
13401347 Some ( toml:: Value :: Boolean ( b) ) => Some ( b) ,
13411348 Some ( v) => {
1342- warn ( & format ! (
1349+ unit_capped_warn ( & format ! (
13431350 "ignoring unsupported value type ({}) for 'hints.mostly-unused', which expects a boolean" ,
13441351 v. type_str( )
13451352 ) ) ?;
@@ -1354,11 +1361,12 @@ fn build_base_args(
13541361 cmd. arg ( "-Zhint-mostly-unused" ) ;
13551362 } else {
13561363 if profile_hint_mostly_unused. is_some ( ) {
1364+ // Profiles come from the top-level unit, so we don't use `unit_capped_warn` here.
13571365 warn (
13581366 "ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it" ,
13591367 ) ?;
13601368 } else if pkg_hint_mostly_unused. is_some ( ) {
1361- warn (
1369+ unit_capped_warn (
13621370 "ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it" ,
13631371 ) ?;
13641372 }
Original file line number Diff line number Diff line change @@ -115,7 +115,6 @@ fn hint_unknown_type_warn() {
115115[DOWNLOADING] crates ...
116116[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
117117[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
119118[CHECKING] bar v1.0.0
120119[RUNNING] `rustc --crate-name bar [..]`
121120[CHECKING] foo v0.0.1 ([ROOT]/foo)
@@ -169,7 +168,6 @@ fn hints_mostly_unused_warn_without_gate() {
169168[DOWNLOADING] crates ...
170169[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
171170[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
173171[CHECKING] bar v1.0.0
174172[RUNNING] `rustc --crate-name bar [..]`
175173[CHECKING] foo v0.0.1 ([ROOT]/foo)
You can’t perform that action at this time.
0 commit comments