about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-03 12:08:55 +0100
committerGitHub <noreply@github.com>2024-11-03 12:08:55 +0100
commit13cdfae599cd0e6b84e8aab34bd5d4286032b7ca (patch)
treeea8bd2c2767c12f8135e2abfa11ae0b90d608274 /compiler
parent7d7f2b5e2f79473d6f972fceae0f51fa55468d29 (diff)
parent16394e9776e1be1abc61a9b26baf73070aa7c37b (diff)
downloadrust-13cdfae599cd0e6b84e8aab34bd5d4286032b7ca.tar.gz
rust-13cdfae599cd0e6b84e8aab34bd5d4286032b7ca.zip
Rollup merge of #132540 - compiler-errors:gc, r=calebcartwright
Do not format generic consts

We introduced **nightly support** for generic const items in #113522, but formatting of consts was not modified. Making them format *correctly* is hard, so let's just bail formatting them so we don't accidentally strip their generics and where clauses. This is essentially no-op formatting for generic const items.

r? `````@calebcartwright````` or `````@ytmimi`````
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast/src/ast.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index ec6ca70ae0a..997c44cffff 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -414,6 +414,12 @@ pub struct WhereClause {
     pub span: Span,
 }
 
+impl WhereClause {
+    pub fn is_empty(&self) -> bool {
+        !self.has_where_token && self.predicates.is_empty()
+    }
+}
+
 impl Default for WhereClause {
     fn default() -> WhereClause {
         WhereClause { has_where_token: false, predicates: ThinVec::new(), span: DUMMY_SP }