]> git.lizzy.rs Git - rust.git/commitdiff
document `Applicability`
authorAndy Russell <arussell123@gmail.com>
Fri, 25 Jan 2019 19:56:27 +0000 (14:56 -0500)
committerAndy Russell <arussell123@gmail.com>
Sun, 27 Jan 2019 04:06:08 +0000 (23:06 -0500)
src/librustc_errors/lib.rs

index 3e25f98ccd27cfed98de1c8675734e2b1b6480d5..64d5ca0c2a742778de9b70ecf8c4559342da5bf8 100644 (file)
                  Span,
                  NO_EXPANSION};
 
+/// Indicates the confidence in the correctness of a suggestion.
+///
+/// All suggestions are marked with an `Applicability`. Tools use the applicability of a suggestion
+/// to determine whether it should be automatically applied or if the user should be consulted
+/// before applying the suggestion.
 #[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
 pub enum Applicability {
+    /// The suggestion is definitely what the user intended. This suggestion should be
+    /// automatically applied.
     MachineApplicable,
-    HasPlaceholders,
+
+    /// The suggestion may be what the user intended, but it is uncertain. The suggestion should
+    /// result in valid Rust code if it is applied.
     MaybeIncorrect,
-    Unspecified
+
+    /// The suggestion contains placeholders like `(...)` or `{ /* fields */ }`. The suggestion
+    /// cannot be applied automatically because it will not result in valid Rust code. The user
+    /// will need to fill in the placeholders.
+    HasPlaceholders,
+
+    /// The applicability of the suggestion is unknown.
+    Unspecified,
 }
 
 #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]