You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Example use of the library that will safely work.
1188
+
1189
+
fn main() {
1190
+
updated_crate::foo(); // Warning: use of deprecated function
1191
+
}
1192
+
```
1193
+
1194
+
Beware that it may be possible for this to technically cause a project to fail if they have explicitly denied the warning, and the updated crate is a direct dependency.
1195
+
Denying warnings should be done with care and the understanding that new lints may be introduced over time.
1196
+
However, library authors should be cautious about introducing new warnings and may want to consider the potential impact on their users.
1197
+
1198
+
The following lints are examples of those that may be introduced when updating a dependency:
1199
+
1200
+
*[`deprecated`][deprecated-lint] — Introduced when a dependency adds the [`#[deprecated]` attribute][deprecated] to an item you are using.
1201
+
*[`unused_must_use`] — Introduced when a dependency adds the [`#[must_use]` attribute][must-use-attr] to an item where you are not consuming the result.
1202
+
*[`unused_unsafe`] — Introduced when a dependency *removes* the `unsafe` qualifier from a function, and that is the only unsafe function called in an unsafe block.
1203
+
1204
+
Additionally, updating `rustc` to a new version may introduce new lints.
1205
+
1206
+
Transitive dependencies which introduce new lints should not usually cause a failure because Cargo uses [`--cap-lints`](../../rustc/lints/levels.html#capping-lints) to suppress all lints in dependencies.
1207
+
1208
+
Mitigating strategies:
1209
+
* Options for dealing with denying warnings:
1210
+
* Understand you may need to deal with resolving new warnings whenever you update your dependencies.
1211
+
* Place `deny(warnings)` behind a [feature][Cargo features], for example `#![cfg_attr(feature = "deny-warnings", deny(warnings))]`.
1212
+
Set up your automated CI to check your crate with the feature enabled, possibly as an allowed failure with a notification.
1213
+
* Introduce deprecations behind a [feature][Cargo features].
1214
+
For example `#[cfg_attr(feature = "deprecated", deprecated="use bar instead")]`.
1215
+
Then, when you plan to remove an item in a future SemVer breaking change, you can communicate with your users that they should enable the `deprecated` feature *before* updating to remove the use of the deprecated items.
0 commit comments