From a50224804d7bd8c492ecd83c4f2d81d33145ba88 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 15 Aug 2018 16:56:54 +0100 Subject: [PATCH] Make proc_macro Level #[non_exhaustive] --- src/libproc_macro/diagnostic.rs | 3 +-- src/libproc_macro/lib.rs | 1 + src/libproc_macro/rustc.rs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs index 51e7647f36c..af779016418 100644 --- a/src/libproc_macro/diagnostic.rs +++ b/src/libproc_macro/diagnostic.rs @@ -16,6 +16,7 @@ use syntax_pos::MultiSpan; /// An enum representing a diagnostic level. #[unstable(feature = "proc_macro_diagnostic", issue = "38356")] #[derive(Copy, Clone, Debug)] +#[non_exhaustive] pub enum Level { /// An error. Error, @@ -25,8 +26,6 @@ pub enum Level { Note, /// A help message. Help, - #[doc(hidden)] - __Nonexhaustive, } /// A structure representing a diagnostic message and associated children diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index fec90008c67..97cf4c14c0c 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -36,6 +36,7 @@ #![feature(staged_api)] #![feature(lang_items)] #![feature(optin_builtin_traits)] +#![feature(non_exhaustive)] #![recursion_limit="256"] diff --git a/src/libproc_macro/rustc.rs b/src/libproc_macro/rustc.rs index a54c695f637..21229d3299d 100644 --- a/src/libproc_macro/rustc.rs +++ b/src/libproc_macro/rustc.rs @@ -278,7 +278,6 @@ impl Level { Level::Warning => errors::Level::Warning, Level::Note => errors::Level::Note, Level::Help => errors::Level::Help, - Level::__Nonexhaustive => unreachable!("Level::__Nonexhaustive"), } } }