diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-06-04 16:24:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 16:24:12 +0200 |
| commit | a06160d9a8b0b695b871b444e10016de033fa5ed (patch) | |
| tree | 7241f3c32c7c18c9931f6198c32cc509e4f5c987 /compiler/rustc_ast/src | |
| parent | 820971581ac7e8b6fe66526e8f593a3c7be64a2e (diff) | |
| parent | ed300d8ad881acc54f56a965e9c8f8a9e75a06d8 (diff) | |
| download | rust-a06160d9a8b0b695b871b444e10016de033fa5ed.tar.gz rust-a06160d9a8b0b695b871b444e10016de033fa5ed.zip | |
Rollup merge of #142007 - nnethercote:visitor-comments, r=chenyukang
Improve some `Visitor` comments. For AST/HIR/THIR visitors, explain the use of deconstruction. r? ``@BoxyUwU``
Diffstat (limited to 'compiler/rustc_ast/src')
| -rw-r--r-- | compiler/rustc_ast/src/visit.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 908d9fd4bda..1f7c97380dc 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -121,6 +121,10 @@ pub enum LifetimeCtxt { /// explicitly, you need to override each method. (And you also need /// to monitor future changes to `Visitor` in case a new method with a /// new default implementation gets introduced.) +/// +/// Every `walk_*` method uses deconstruction to access fields of structs and +/// enums. This will result in a compile error if a field is added, which makes +/// it more likely the appropriate visit call will be added for it. pub trait Visitor<'ast>: Sized { /// The result type of the `visit_*` methods. Can be either `()`, /// or `ControlFlow<T>`. |
