about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfinalchild <finalchild2@gmail.com>2022-08-18 16:57:25 +0900
committerfinalchild <finalchild2@gmail.com>2022-08-22 00:57:21 +0900
commit8d042f4483b60ceaa98a6bb2a778fa5ac4226bbe (patch)
tree7e3f006ced04fd9a9df87a27fcb81855e4bfaadb
parente3d4c4039a3b041c7610735c641e5688c25af8b2 (diff)
downloadrust-8d042f4483b60ceaa98a6bb2a778fa5ac4226bbe.tar.gz
rust-8d042f4483b60ceaa98a6bb2a778fa5ac4226bbe.zip
Migrate trait_fn_const
-rw-r--r--compiler/rustc_ast_passes/src/errors.rs8
-rw-r--r--compiler/rustc_error_messages/locales/en-US/ast_passes.ftl4
2 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs
index ed44beafff2..7a7073b5a51 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/errors.rs
@@ -82,3 +82,11 @@ pub struct TraitFnAsync {
     #[label]
     pub span: Span,
 }
+
+#[derive(SessionDiagnostic)]
+#[error(ast_passes::trait_fn_const, code = "E0379")]
+pub struct TraitFnConst {
+    #[primary_span]
+    #[label]
+    pub span: Span,
+}
diff --git a/compiler/rustc_error_messages/locales/en-US/ast_passes.ftl b/compiler/rustc_error_messages/locales/en-US/ast_passes.ftl
index ab2313fd86c..fa6a02493f3 100644
--- a/compiler/rustc_error_messages/locales/en-US/ast_passes.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/ast_passes.ftl
@@ -27,3 +27,7 @@ ast_passes_trait_fn_async =
     .label = `async` because of this
     .note = `async` trait functions are not currently supported
     .note2 = consider using the `async-trait` crate: https://crates.io/crates/async-trait
+
+ast_passes_trait_fn_const =
+    functions in traits cannot be declared const
+    .label = functions in traits cannot be const