]> git.lizzy.rs Git - rust.git/blobdiff - crates/syntax/src/ast.rs
Merge #11294
[rust.git] / crates / syntax / src / ast.rs
index 38e0b04efbef90bc8d9afd456b415d5ba2e3ce60..5c1aed3cd4809fd0c39ce7a46dae2df5cebd5524 100644 (file)
@@ -5,6 +5,7 @@
 mod token_ext;
 mod node_ext;
 mod expr_ext;
+mod operators;
 pub mod edit;
 pub mod edit_in_place;
 pub mod make;
 };
 
 pub use self::{
-    expr_ext::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp},
+    expr_ext::{ArrayExprKind, BlockModifier, CallableExpr, ElseBranch, LiteralKind},
     generated::{nodes::*, tokens::*},
     node_ext::{
         AttrKind, FieldKind, Macro, NameLike, NameOrNameRef, PathSegmentKind, SelfParamKind,
         SlicePatComponents, StructKind, TypeBoundKind, VisibilityKind,
     },
-    token_ext::*,
-    traits::*,
+    operators::{ArithOp, BinaryOp, CmpOp, LogicOp, Ordering, RangeOp, UnaryOp},
+    token_ext::{CommentKind, CommentPlacement, CommentShape, IsString, QuoteOffsets, Radix},
+    traits::{
+        DocCommentIter, HasArgList, HasAttrs, HasDocComments, HasGenericParams, HasLoopBody,
+        HasModuleItem, HasName, HasTypeBounds, HasVisibility,
+    },
 };
 
 /// The main trait to go from untyped `SyntaxNode`  to a typed ast. The
@@ -47,6 +52,12 @@ fn clone_for_update(&self) -> Self
     {
         Self::cast(self.syntax().clone_for_update()).unwrap()
     }
+    fn clone_subtree(&self) -> Self
+    where
+        Self: Sized,
+    {
+        Self::cast(self.syntax().clone_subtree()).unwrap()
+    }
 }
 
 /// Like `AstNode`, but wraps tokens rather than interior nodes.
@@ -104,7 +115,7 @@ pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken
 
 #[test]
 fn assert_ast_is_object_safe() {
-    fn _f(_: &dyn AstNode, _: &dyn NameOwner) {}
+    fn _f(_: &dyn AstNode, _: &dyn HasName) {}
 }
 
 #[test]