about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-04-24 11:57:07 +0800
committerGitHub <noreply@github.com>2018-04-24 11:57:07 +0800
commit7c552a299db51ba35f7a47d0dabd24d6b7ee241b (patch)
treee3e3bf87847c1ecfd84fb25f83e0bb982fb99c65 /src/libsyntax
parent6b1ed8e4af5df157f21e8525f9d547535ddee397 (diff)
parente77110e1f61e42c0f0e9e3288edb0d663eb39bba (diff)
downloadrust-7c552a299db51ba35f7a47d0dabd24d6b7ee241b.tar.gz
rust-7c552a299db51ba35f7a47d0dabd24d6b7ee241b.zip
Rollup merge of #49985 - zackmdavis:0, r=estebank
don't see issue #0

The unstable-feature attribute requires an issue (neglecting it is
E0547), which gets used in the error messages. Unfortunately, there are
some cases where "0" is apparently used a placeholder where no issue
exists, directing the user to see the (nonexistent) issue #0. (It would
have been better to either let `issue` be optional—compare to how issue
is an `Option<u32>` in the feature-gate declarations in
libsyntax/feature-gate.rs—or actually require that an issue be created.)
Rather than endeavoring to change how `#[unstable]` works at this time
(given competing contributor and reviewer priorities), this simple patch
proposes the less-ambitious solution of just not adding the "(see
issue)" note when the number is zero.

Resolves #49983.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index d20e94b018b..120dff2dbb9 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -1242,10 +1242,9 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue
         GateIssue::Library(lib) => lib,
     };
 
-    let explanation = if let Some(n) = issue {
-        format!("{} (see issue #{})", explain, n)
-    } else {
-        explain.to_owned()
+    let explanation = match issue {
+        None | Some(0) => explain.to_owned(),
+        Some(n) => format!("{} (see issue #{})", explain, n)
     };
 
     let mut err = match level {