]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_expand/src/mbe/transcribe.rs
Replace some `_ == _ || _ == _`s with `matches!(_, _ | _)`s
[rust.git] / compiler / rustc_expand / src / mbe / transcribe.rs
1 use crate::base::ExtCtxt;
2 use crate::errors::{
3     CountRepetitionMisplaced, MetaVarExprUnrecognizedVar, MetaVarsDifSeqMatchers, MustRepeatOnce,
4     NoSyntaxVarsExprRepeat, VarStillRepeating,
5 };
6 use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq, MatchedTokenTree, NamedMatch};
7 use crate::mbe::{self, MetaVarExpr};
8 use rustc_ast::mut_visit::{self, MutVisitor};
9 use rustc_ast::token::{self, Delimiter, Token, TokenKind};
10 use rustc_ast::tokenstream::{DelimSpan, Spacing, TokenStream, TokenTree};
11 use rustc_data_structures::fx::FxHashMap;
12 use rustc_errors::{pluralize, PResult};
13 use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed};
14 use rustc_span::hygiene::{LocalExpnId, Transparency};
15 use rustc_span::symbol::{sym, Ident, MacroRulesNormalizedIdent};
16 use rustc_span::Span;
17
18 use smallvec::{smallvec, SmallVec};
19 use std::mem;
20
21 // A Marker adds the given mark to the syntax context.
22 struct Marker(LocalExpnId, Transparency);
23
24 impl MutVisitor for Marker {
25     const VISIT_TOKENS: bool = true;
26
27     fn visit_span(&mut self, span: &mut Span) {
28         *span = span.apply_mark(self.0.to_expn_id(), self.1)
29     }
30 }
31
32 /// An iterator over the token trees in a delimited token tree (`{ ... }`) or a sequence (`$(...)`).
33 enum Frame<'a> {
34     Delimited { tts: &'a [mbe::TokenTree], idx: usize, delim: Delimiter, span: DelimSpan },
35     Sequence { tts: &'a [mbe::TokenTree], idx: usize, sep: Option<Token> },
36 }
37
38 impl<'a> Frame<'a> {
39     /// Construct a new frame around the delimited set of tokens.
40     fn new(src: &'a mbe::Delimited, span: DelimSpan) -> Frame<'a> {
41         Frame::Delimited { tts: &src.tts, idx: 0, delim: src.delim, span }
42     }
43 }
44
45 impl<'a> Iterator for Frame<'a> {
46     type Item = &'a mbe::TokenTree;
47
48     fn next(&mut self) -> Option<&'a mbe::TokenTree> {
49         match self {
50             Frame::Delimited { tts, idx, .. } | Frame::Sequence { tts, idx, .. } => {
51                 let res = tts.get(*idx);
52                 *idx += 1;
53                 res
54             }
55         }
56     }
57 }
58
59 /// This can do Macro-By-Example transcription.
60 /// - `interp` is a map of meta-variables to the tokens (non-terminals) they matched in the
61 ///   invocation. We are assuming we already know there is a match.
62 /// - `src` is the RHS of the MBE, that is, the "example" we are filling in.
63 ///
64 /// For example,
65 ///
66 /// ```rust
67 /// macro_rules! foo {
68 ///     ($id:ident) => { println!("{}", stringify!($id)); }
69 /// }
70 ///
71 /// foo!(bar);
72 /// ```
73 ///
74 /// `interp` would contain `$id => bar` and `src` would contain `println!("{}", stringify!($id));`.
75 ///
76 /// `transcribe` would return a `TokenStream` containing `println!("{}", stringify!(bar));`.
77 ///
78 /// Along the way, we do some additional error checking.
79 pub(super) fn transcribe<'a>(
80     cx: &ExtCtxt<'a>,
81     interp: &FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
82     src: &mbe::Delimited,
83     src_span: DelimSpan,
84     transparency: Transparency,
85 ) -> PResult<'a, TokenStream> {
86     // Nothing for us to transcribe...
87     if src.tts.is_empty() {
88         return Ok(TokenStream::default());
89     }
90
91     // We descend into the RHS (`src`), expanding things as we go. This stack contains the things
92     // we have yet to expand/are still expanding. We start the stack off with the whole RHS.
93     let mut stack: SmallVec<[Frame<'_>; 1]> = smallvec![Frame::new(&src, src_span)];
94
95     // As we descend in the RHS, we will need to be able to match nested sequences of matchers.
96     // `repeats` keeps track of where we are in matching at each level, with the last element being
97     // the most deeply nested sequence. This is used as a stack.
98     let mut repeats = Vec::new();
99
100     // `result` contains resulting token stream from the TokenTree we just finished processing. At
101     // the end, this will contain the full result of transcription, but at arbitrary points during
102     // `transcribe`, `result` will contain subsets of the final result.
103     //
104     // Specifically, as we descend into each TokenTree, we will push the existing results onto the
105     // `result_stack` and clear `results`. We will then produce the results of transcribing the
106     // TokenTree into `results`. Then, as we unwind back out of the `TokenTree`, we will pop the
107     // `result_stack` and append `results` too it to produce the new `results` up to that point.
108     //
109     // Thus, if we try to pop the `result_stack` and it is empty, we have reached the top-level
110     // again, and we are done transcribing.
111     let mut result: Vec<TokenTree> = Vec::new();
112     let mut result_stack = Vec::new();
113     let mut marker = Marker(cx.current_expansion.id, transparency);
114
115     loop {
116         // Look at the last frame on the stack.
117         // If it still has a TokenTree we have not looked at yet, use that tree.
118         let Some(tree) = stack.last_mut().unwrap().next() else {
119             // This else-case never produces a value for `tree` (it `continue`s or `return`s).
120
121             // Otherwise, if we have just reached the end of a sequence and we can keep repeating,
122             // go back to the beginning of the sequence.
123             if let Frame::Sequence { idx, sep, .. } = stack.last_mut().unwrap() {
124                 let (repeat_idx, repeat_len) = repeats.last_mut().unwrap();
125                 *repeat_idx += 1;
126                 if repeat_idx < repeat_len {
127                     *idx = 0;
128                     if let Some(sep) = sep {
129                         result.push(TokenTree::Token(sep.clone(), Spacing::Alone));
130                     }
131                     continue;
132                 }
133             }
134
135             // We are done with the top of the stack. Pop it. Depending on what it was, we do
136             // different things. Note that the outermost item must be the delimited, wrapped RHS
137             // that was passed in originally to `transcribe`.
138             match stack.pop().unwrap() {
139                 // Done with a sequence. Pop from repeats.
140                 Frame::Sequence { .. } => {
141                     repeats.pop();
142                 }
143
144                 // We are done processing a Delimited. If this is the top-level delimited, we are
145                 // done. Otherwise, we unwind the result_stack to append what we have produced to
146                 // any previous results.
147                 Frame::Delimited { delim, span, .. } => {
148                     if result_stack.is_empty() {
149                         // No results left to compute! We are back at the top-level.
150                         return Ok(TokenStream::new(result));
151                     }
152
153                     // Step back into the parent Delimited.
154                     let tree = TokenTree::Delimited(span, delim, TokenStream::new(result));
155                     result = result_stack.pop().unwrap();
156                     result.push(tree);
157                 }
158             }
159             continue;
160         };
161
162         // At this point, we know we are in the middle of a TokenTree (the last one on `stack`).
163         // `tree` contains the next `TokenTree` to be processed.
164         match tree {
165             // We are descending into a sequence. We first make sure that the matchers in the RHS
166             // and the matches in `interp` have the same shape. Otherwise, either the caller or the
167             // macro writer has made a mistake.
168             seq @ mbe::TokenTree::Sequence(_, delimited) => {
169                 match lockstep_iter_size(&seq, interp, &repeats) {
170                     LockstepIterSize::Unconstrained => {
171                         return Err(cx.create_err(NoSyntaxVarsExprRepeat { span: seq.span() }));
172                     }
173
174                     LockstepIterSize::Contradiction(msg) => {
175                         // FIXME: this really ought to be caught at macro definition time... It
176                         // happens when two meta-variables are used in the same repetition in a
177                         // sequence, but they come from different sequence matchers and repeat
178                         // different amounts.
179                         return Err(cx.create_err(MetaVarsDifSeqMatchers { span: seq.span(), msg }));
180                     }
181
182                     LockstepIterSize::Constraint(len, _) => {
183                         // We do this to avoid an extra clone above. We know that this is a
184                         // sequence already.
185                         let mbe::TokenTree::Sequence(sp, seq) = seq else {
186                             unreachable!()
187                         };
188
189                         // Is the repetition empty?
190                         if len == 0 {
191                             if seq.kleene.op == mbe::KleeneOp::OneOrMore {
192                                 // FIXME: this really ought to be caught at macro definition
193                                 // time... It happens when the Kleene operator in the matcher and
194                                 // the body for the same meta-variable do not match.
195                                 return Err(cx.create_err(MustRepeatOnce { span: sp.entire() }));
196                             }
197                         } else {
198                             // 0 is the initial counter (we have done 0 repetitions so far). `len`
199                             // is the total number of repetitions we should generate.
200                             repeats.push((0, len));
201
202                             // The first time we encounter the sequence we push it to the stack. It
203                             // then gets reused (see the beginning of the loop) until we are done
204                             // repeating.
205                             stack.push(Frame::Sequence {
206                                 idx: 0,
207                                 sep: seq.separator.clone(),
208                                 tts: &delimited.tts,
209                             });
210                         }
211                     }
212                 }
213             }
214
215             // Replace the meta-var with the matched token tree from the invocation.
216             mbe::TokenTree::MetaVar(mut sp, mut original_ident) => {
217                 // Find the matched nonterminal from the macro invocation, and use it to replace
218                 // the meta-var.
219                 let ident = MacroRulesNormalizedIdent::new(original_ident);
220                 if let Some(cur_matched) = lookup_cur_matched(ident, interp, &repeats) {
221                     match cur_matched {
222                         MatchedTokenTree(tt) => {
223                             // `tt`s are emitted into the output stream directly as "raw tokens",
224                             // without wrapping them into groups.
225                             let token = tt.clone();
226                             result.push(token);
227                         }
228                         MatchedNonterminal(nt) => {
229                             // Other variables are emitted into the output stream as groups with
230                             // `Delimiter::Invisible` to maintain parsing priorities.
231                             // `Interpolated` is currently used for such groups in rustc parser.
232                             marker.visit_span(&mut sp);
233                             let token = TokenTree::token_alone(token::Interpolated(nt.clone()), sp);
234                             result.push(token);
235                         }
236                         MatchedSeq(..) => {
237                             // We were unable to descend far enough. This is an error.
238                             return Err(cx.create_err(VarStillRepeating { span: sp, ident }));
239                         }
240                     }
241                 } else {
242                     // If we aren't able to match the meta-var, we push it back into the result but
243                     // with modified syntax context. (I believe this supports nested macros).
244                     marker.visit_span(&mut sp);
245                     marker.visit_ident(&mut original_ident);
246                     result.push(TokenTree::token_alone(token::Dollar, sp));
247                     result.push(TokenTree::Token(
248                         Token::from_ast_ident(original_ident),
249                         Spacing::Alone,
250                     ));
251                 }
252             }
253
254             // Replace meta-variable expressions with the result of their expansion.
255             mbe::TokenTree::MetaVarExpr(sp, expr) => {
256                 transcribe_metavar_expr(cx, expr, interp, &mut marker, &repeats, &mut result, &sp)?;
257             }
258
259             // If we are entering a new delimiter, we push its contents to the `stack` to be
260             // processed, and we push all of the currently produced results to the `result_stack`.
261             // We will produce all of the results of the inside of the `Delimited` and then we will
262             // jump back out of the Delimited, pop the result_stack and add the new results back to
263             // the previous results (from outside the Delimited).
264             mbe::TokenTree::Delimited(mut span, delimited) => {
265                 mut_visit::visit_delim_span(&mut span, &mut marker);
266                 stack.push(Frame::Delimited {
267                     tts: &delimited.tts,
268                     delim: delimited.delim,
269                     idx: 0,
270                     span,
271                 });
272                 result_stack.push(mem::take(&mut result));
273             }
274
275             // Nothing much to do here. Just push the token to the result, being careful to
276             // preserve syntax context.
277             mbe::TokenTree::Token(token) => {
278                 let mut token = token.clone();
279                 mut_visit::visit_token(&mut token, &mut marker);
280                 let tt = TokenTree::Token(token, Spacing::Alone);
281                 result.push(tt);
282             }
283
284             // There should be no meta-var declarations in the invocation of a macro.
285             mbe::TokenTree::MetaVarDecl(..) => panic!("unexpected `TokenTree::MetaVarDecl"),
286         }
287     }
288 }
289
290 /// Lookup the meta-var named `ident` and return the matched token tree from the invocation using
291 /// the set of matches `interpolations`.
292 ///
293 /// See the definition of `repeats` in the `transcribe` function. `repeats` is used to descend
294 /// into the right place in nested matchers. If we attempt to descend too far, the macro writer has
295 /// made a mistake, and we return `None`.
296 fn lookup_cur_matched<'a>(
297     ident: MacroRulesNormalizedIdent,
298     interpolations: &'a FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
299     repeats: &[(usize, usize)],
300 ) -> Option<&'a NamedMatch> {
301     interpolations.get(&ident).map(|mut matched| {
302         for &(idx, _) in repeats {
303             match matched {
304                 MatchedTokenTree(_) | MatchedNonterminal(_) => break,
305                 MatchedSeq(ads) => matched = ads.get(idx).unwrap(),
306             }
307         }
308
309         matched
310     })
311 }
312
313 /// An accumulator over a TokenTree to be used with `fold`. During transcription, we need to make
314 /// sure that the size of each sequence and all of its nested sequences are the same as the sizes
315 /// of all the matched (nested) sequences in the macro invocation. If they don't match, somebody
316 /// has made a mistake (either the macro writer or caller).
317 #[derive(Clone)]
318 enum LockstepIterSize {
319     /// No constraints on length of matcher. This is true for any TokenTree variants except a
320     /// `MetaVar` with an actual `MatchedSeq` (as opposed to a `MatchedNonterminal`).
321     Unconstrained,
322
323     /// A `MetaVar` with an actual `MatchedSeq`. The length of the match and the name of the
324     /// meta-var are returned.
325     Constraint(usize, MacroRulesNormalizedIdent),
326
327     /// Two `Constraint`s on the same sequence had different lengths. This is an error.
328     Contradiction(String),
329 }
330
331 impl LockstepIterSize {
332     /// Find incompatibilities in matcher/invocation sizes.
333     /// - `Unconstrained` is compatible with everything.
334     /// - `Contradiction` is incompatible with everything.
335     /// - `Constraint(len)` is only compatible with other constraints of the same length.
336     fn with(self, other: LockstepIterSize) -> LockstepIterSize {
337         match self {
338             LockstepIterSize::Unconstrained => other,
339             LockstepIterSize::Contradiction(_) => self,
340             LockstepIterSize::Constraint(l_len, l_id) => match other {
341                 LockstepIterSize::Unconstrained => self,
342                 LockstepIterSize::Contradiction(_) => other,
343                 LockstepIterSize::Constraint(r_len, _) if l_len == r_len => self,
344                 LockstepIterSize::Constraint(r_len, r_id) => {
345                     let msg = format!(
346                         "meta-variable `{}` repeats {} time{}, but `{}` repeats {} time{}",
347                         l_id,
348                         l_len,
349                         pluralize!(l_len),
350                         r_id,
351                         r_len,
352                         pluralize!(r_len),
353                     );
354                     LockstepIterSize::Contradiction(msg)
355                 }
356             },
357         }
358     }
359 }
360
361 /// Given a `tree`, make sure that all sequences have the same length as the matches for the
362 /// appropriate meta-vars in `interpolations`.
363 ///
364 /// Note that if `repeats` does not match the exact correct depth of a meta-var,
365 /// `lookup_cur_matched` will return `None`, which is why this still works even in the presence of
366 /// multiple nested matcher sequences.
367 ///
368 /// Example: `$($($x $y)+*);+` -- we need to make sure that `x` and `y` repeat the same amount as
369 /// each other at the given depth when the macro was invoked. If they don't it might mean they were
370 /// declared at unequal depths or there was a compile bug. For example, if we have 3 repetitions of
371 /// the outer sequence and 4 repetitions of the inner sequence for `x`, we should have the same for
372 /// `y`; otherwise, we can't transcribe them both at the given depth.
373 fn lockstep_iter_size(
374     tree: &mbe::TokenTree,
375     interpolations: &FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
376     repeats: &[(usize, usize)],
377 ) -> LockstepIterSize {
378     use mbe::TokenTree;
379     match tree {
380         TokenTree::Delimited(_, delimited) => {
381             delimited.tts.iter().fold(LockstepIterSize::Unconstrained, |size, tt| {
382                 size.with(lockstep_iter_size(tt, interpolations, repeats))
383             })
384         }
385         TokenTree::Sequence(_, seq) => {
386             seq.tts.iter().fold(LockstepIterSize::Unconstrained, |size, tt| {
387                 size.with(lockstep_iter_size(tt, interpolations, repeats))
388             })
389         }
390         TokenTree::MetaVar(_, name) | TokenTree::MetaVarDecl(_, name, _) => {
391             let name = MacroRulesNormalizedIdent::new(*name);
392             match lookup_cur_matched(name, interpolations, repeats) {
393                 Some(matched) => match matched {
394                     MatchedTokenTree(_) | MatchedNonterminal(_) => LockstepIterSize::Unconstrained,
395                     MatchedSeq(ads) => LockstepIterSize::Constraint(ads.len(), name),
396                 },
397                 _ => LockstepIterSize::Unconstrained,
398             }
399         }
400         TokenTree::MetaVarExpr(_, expr) => {
401             let default_rslt = LockstepIterSize::Unconstrained;
402             let Some(ident) = expr.ident() else { return default_rslt; };
403             let name = MacroRulesNormalizedIdent::new(ident);
404             match lookup_cur_matched(name, interpolations, repeats) {
405                 Some(MatchedSeq(ads)) => {
406                     default_rslt.with(LockstepIterSize::Constraint(ads.len(), name))
407                 }
408                 _ => default_rslt,
409             }
410         }
411         TokenTree::Token(..) => LockstepIterSize::Unconstrained,
412     }
413 }
414
415 /// Used solely by the `count` meta-variable expression, counts the outer-most repetitions at a
416 /// given optional nested depth.
417 ///
418 /// For example, a macro parameter of `$( { $( $foo:ident ),* } )*` called with `{ a, b } { c }`:
419 ///
420 /// * `[ $( ${count(foo)} ),* ]` will return [2, 1] with a, b = 2 and c = 1
421 /// * `[ $( ${count(foo, 0)} ),* ]` will be the same as `[ $( ${count(foo)} ),* ]`
422 /// * `[ $( ${count(foo, 1)} ),* ]` will return an error because `${count(foo, 1)}` is
423 ///   declared inside a single repetition and the index `1` implies two nested repetitions.
424 fn count_repetitions<'a>(
425     cx: &ExtCtxt<'a>,
426     depth_opt: Option<usize>,
427     mut matched: &NamedMatch,
428     repeats: &[(usize, usize)],
429     sp: &DelimSpan,
430 ) -> PResult<'a, usize> {
431     // Recursively count the number of matches in `matched` at given depth
432     // (or at the top-level of `matched` if no depth is given).
433     fn count<'a>(
434         cx: &ExtCtxt<'a>,
435         declared_lhs_depth: usize,
436         depth_opt: Option<usize>,
437         matched: &NamedMatch,
438         sp: &DelimSpan,
439     ) -> PResult<'a, usize> {
440         match matched {
441             MatchedTokenTree(_) | MatchedNonterminal(_) => {
442                 if declared_lhs_depth == 0 {
443                     return Err(cx.create_err(CountRepetitionMisplaced { span: sp.entire() }));
444                 }
445                 match depth_opt {
446                     None => Ok(1),
447                     Some(_) => Err(out_of_bounds_err(cx, declared_lhs_depth, sp.entire(), "count")),
448                 }
449             }
450             MatchedSeq(named_matches) => {
451                 let new_declared_lhs_depth = declared_lhs_depth + 1;
452                 match depth_opt {
453                     None => named_matches
454                         .iter()
455                         .map(|elem| count(cx, new_declared_lhs_depth, None, elem, sp))
456                         .sum(),
457                     Some(0) => Ok(named_matches.len()),
458                     Some(depth) => named_matches
459                         .iter()
460                         .map(|elem| count(cx, new_declared_lhs_depth, Some(depth - 1), elem, sp))
461                         .sum(),
462                 }
463             }
464         }
465     }
466     // `repeats` records all of the nested levels at which we are currently
467     // matching meta-variables. The meta-var-expr `count($x)` only counts
468     // matches that occur in this "subtree" of the `NamedMatch` where we
469     // are currently transcribing, so we need to descend to that subtree
470     // before we start counting. `matched` contains the various levels of the
471     // tree as we descend, and its final value is the subtree we are currently at.
472     for &(idx, _) in repeats {
473         if let MatchedSeq(ads) = matched {
474             matched = &ads[idx];
475         }
476     }
477     count(cx, 0, depth_opt, matched, sp)
478 }
479
480 /// Returns a `NamedMatch` item declared on the LHS given an arbitrary [Ident]
481 fn matched_from_ident<'ctx, 'interp, 'rslt>(
482     cx: &ExtCtxt<'ctx>,
483     ident: Ident,
484     interp: &'interp FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
485 ) -> PResult<'ctx, &'rslt NamedMatch>
486 where
487     'interp: 'rslt,
488 {
489     let span = ident.span;
490     let key = MacroRulesNormalizedIdent::new(ident);
491     interp.get(&key).ok_or_else(|| cx.create_err(MetaVarExprUnrecognizedVar { span, key }))
492 }
493
494 /// Used by meta-variable expressions when an user input is out of the actual declared bounds. For
495 /// example, index(999999) in an repetition of only three elements.
496 fn out_of_bounds_err<'a>(
497     cx: &ExtCtxt<'a>,
498     max: usize,
499     span: Span,
500     ty: &str,
501 ) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
502     let msg = if max == 0 {
503         format!(
504             "meta-variable expression `{ty}` with depth parameter \
505              must be called inside of a macro repetition"
506         )
507     } else {
508         format!(
509             "depth parameter on meta-variable expression `{ty}` \
510              must be less than {max}"
511         )
512     };
513     cx.struct_span_err(span, &msg)
514 }
515
516 fn transcribe_metavar_expr<'a>(
517     cx: &ExtCtxt<'a>,
518     expr: &MetaVarExpr,
519     interp: &FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
520     marker: &mut Marker,
521     repeats: &[(usize, usize)],
522     result: &mut Vec<TokenTree>,
523     sp: &DelimSpan,
524 ) -> PResult<'a, ()> {
525     let mut visited_span = || {
526         let mut span = sp.entire();
527         marker.visit_span(&mut span);
528         span
529     };
530     match *expr {
531         MetaVarExpr::Count(original_ident, depth_opt) => {
532             let matched = matched_from_ident(cx, original_ident, interp)?;
533             let count = count_repetitions(cx, depth_opt, matched, &repeats, sp)?;
534             let tt = TokenTree::token_alone(
535                 TokenKind::lit(token::Integer, sym::integer(count), None),
536                 visited_span(),
537             );
538             result.push(tt);
539         }
540         MetaVarExpr::Ignore(original_ident) => {
541             // Used to ensure that `original_ident` is present in the LHS
542             let _ = matched_from_ident(cx, original_ident, interp)?;
543         }
544         MetaVarExpr::Index(depth) => match repeats.iter().nth_back(depth) {
545             Some((index, _)) => {
546                 result.push(TokenTree::token_alone(
547                     TokenKind::lit(token::Integer, sym::integer(*index), None),
548                     visited_span(),
549                 ));
550             }
551             None => return Err(out_of_bounds_err(cx, repeats.len(), sp.entire(), "index")),
552         },
553         MetaVarExpr::Length(depth) => match repeats.iter().nth_back(depth) {
554             Some((_, length)) => {
555                 result.push(TokenTree::token_alone(
556                     TokenKind::lit(token::Integer, sym::integer(*length), None),
557                     visited_span(),
558                 ));
559             }
560             None => return Err(out_of_bounds_err(cx, repeats.len(), sp.entire(), "length")),
561         },
562     }
563     Ok(())
564 }