about summary refs log tree commit diff
path: root/compiler/rustc_session/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-07-08 18:25:50 +0530
committerGitHub <noreply@github.com>2022-07-08 18:25:50 +0530
commitdbae8309a0656e0cacf1f4a47524d0d62e5ffe0f (patch)
tree1d2fb378d9e2f349ea1fa387219a398ee079948c /compiler/rustc_session/src
parentfe87923b546b84dffd46c95ccecadafa57ab01dc (diff)
parent20583337800524516ab814e1cff080c0ca9f200b (diff)
downloadrust-dbae8309a0656e0cacf1f4a47524d0d62e5ffe0f.tar.gz
rust-dbae8309a0656e0cacf1f4a47524d0d62e5ffe0f.zip
Rollup merge of #98657 - compiler-errors:rustc-const-eval-session-diagnostic-1, r=davidtwco
Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic`

I'm still trying to get the hang of this, so it doesn't migrate _all_ of `rustc_const_eval`. Working on that later.

r? `@davidtwco`
Diffstat (limited to 'compiler/rustc_session/src')
-rw-r--r--compiler/rustc_session/src/session.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 52b9ee94718..1eee0c3163d 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -2,7 +2,7 @@ use crate::cgu_reuse_tracker::CguReuseTracker;
 use crate::code_stats::CodeStats;
 pub use crate::code_stats::{DataTypeKind, FieldInfo, SizeKind, VariantInfo};
 use crate::config::{self, CrateType, OutputType, SwitchWithOptPath};
-use crate::parse::ParseSess;
+use crate::parse::{add_feature_diagnostics, ParseSess};
 use crate::search_paths::{PathKind, SearchPath};
 use crate::{filesearch, lint};
 
@@ -458,6 +458,15 @@ impl Session {
     ) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
         self.parse_sess.create_err(err)
     }
+    pub fn create_feature_err<'a>(
+        &'a self,
+        err: impl SessionDiagnostic<'a>,
+        feature: Symbol,
+    ) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
+        let mut err = self.parse_sess.create_err(err);
+        add_feature_diagnostics(&mut err, &self.parse_sess, feature);
+        err
+    }
     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
         self.parse_sess.emit_err(err)
     }