1//! A framework that can express both [gen-kill] and generic dataflow problems.
2//!
3//! To use this framework, implement the [`Analysis`] trait. There used to be a `GenKillAnalysis`
4//! alternative trait for gen-kill analyses that would pre-compute the transfer function for each
5//! block. It was intended as an optimization, but it ended up not being any faster than
6//! `Analysis`.
7//!
8//! The `impls` module contains several examples of dataflow analyses.
9//!
10//! Then call `iterate_to_fixpoint` on your type that impls `Analysis` to get a `Results`. From
11//! there, you can use a `ResultsCursor` to inspect the fixpoint solution to your dataflow problem
12//! (good for inspecting a small number of locations), or implement the `ResultsVisitor` interface
13//! and use `visit_results` (good for inspecting many or all locations). The following example uses
14//! the `ResultsCursor` approach.
15//!
16//! ```ignore (cross-crate-imports)
17//! use rustc_const_eval::dataflow::Analysis; // Makes `iterate_to_fixpoint` available.
18//!
19//! fn do_my_analysis(tcx: TyCtxt<'tcx>, body: &mir::Body<'tcx>) {
20//! let analysis = MyAnalysis::new()
21//! .iterate_to_fixpoint(tcx, body, None)
22//! .into_results_cursor(body);
23//!
24//! // Print the dataflow state *after* each statement in the start block.
25//! for (_, statement_index) in body.block_data[START_BLOCK].statements.iter_enumerated() {
26//! cursor.seek_after(Location { block: START_BLOCK, statement_index });
27//! let state = cursor.get();
28//! println!("{:?}", state);
29//! }
30//! }
31//! ```
32//!
33//! [gen-kill]: https://en.wikipedia.org/wiki/Data-flow_analysis#Bit_vector_problems
3435use rustc_index::bit_set::{DenseBitSet, MixedBitSet};
36use rustc_index::{Idx, IndexVec};
37use rustc_middle::bug;
38use rustc_middle::mir::{
39self, BasicBlock, BasicBlockData, CallReturnPlaces, Location, TerminatorEdges,
40};
41use rustc_middle::ty::TyCtxt;
42use tracing::error;
4344use self::graphviz::write_graphviz_results;
45use super::fmt::DebugWithContext;
4647mod cursor;
48mod direction;
49pub mod fmt;
50pub mod graphviz;
51pub mod lattice;
52mod results;
53mod visitor;
5455pub use self::cursor::ResultsCursor;
56pub use self::direction::{Backward, Direction, Forward};
57pub use self::lattice::{JoinSemiLattice, MaybeReachable};
58pub use self::results::{EntryStates, Results};
59pub use self::visitor::{ResultsVisitor, visit_results};
6061/// Analysis domains are all bitsets of various kinds. This trait holds
62/// operations needed by all of them.
63pub trait BitSetExt<T> {
64fn contains(&self, elem: T) -> bool;
65}
6667impl<T: Idx> BitSetExt<T> for DenseBitSet<T> {
68fn contains(&self, elem: T) -> bool {
69self.contains(elem)
70 }
71}
7273impl<T: Idx> BitSetExt<T> for MixedBitSet<T> {
74fn contains(&self, elem: T) -> bool {
75self.contains(elem)
76 }
77}
7879/// A dataflow problem with an arbitrarily complex transfer function.
80///
81/// This trait specifies the lattice on which this analysis operates (the domain), its
82/// initial value at the entry point of each basic block, and various operations.
83///
84/// # Convergence
85///
86/// When implementing this trait it's possible to choose a transfer function such that the analysis
87/// does not reach fixpoint. To guarantee convergence, your transfer functions must maintain the
88/// following invariant:
89///
90/// > If the dataflow state **before** some point in the program changes to be greater
91/// than the prior state **before** that point, the dataflow state **after** that point must
92/// also change to be greater than the prior state **after** that point.
93///
94/// This invariant guarantees that the dataflow state at a given point in the program increases
95/// monotonically until fixpoint is reached. Note that this monotonicity requirement only applies
96/// to the same point in the program at different points in time. The dataflow state at a given
97/// point in the program may or may not be greater than the state at any preceding point.
98pub trait Analysis<'tcx> {
99/// The type that holds the dataflow state at any given point in the program.
100type Domain: Clone + JoinSemiLattice;
101102/// The direction of this analysis. Either `Forward` or `Backward`.
103type Direction: Direction = Forward;
104105/// Auxiliary data used for analyzing `SwitchInt` terminators, if necessary.
106type SwitchIntData = !;
107108/// A descriptive name for this analysis. Used only for debugging.
109 ///
110 /// This name should be brief and contain no spaces, periods or other characters that are not
111 /// suitable as part of a filename.
112const NAME: &'static str;
113114/// Returns the initial value of the dataflow state upon entry to each basic block.
115fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain;
116117/// Mutates the initial value of the dataflow state upon entry to the `START_BLOCK`.
118 ///
119 /// For backward analyses, initial state (besides the bottom value) is not yet supported. Trying
120 /// to mutate the initial state will result in a panic.
121//
122 // FIXME: For backward dataflow analyses, the initial state should be applied to every basic
123 // block where control flow could exit the MIR body (e.g., those terminated with `return` or
124 // `resume`). It's not obvious how to handle `yield` points in coroutines, however.
125fn initialize_start_block(&self, body: &mir::Body<'tcx>, state: &mut Self::Domain);
126127/// Given an `EffectIndex`, calls the appropriate `apply_*` method in the
128 /// {early,primary} x {statement,terminator} space.
129 ///
130 /// Do not override this; instead override one or more of the `apply_*` methods.
131#[inline]
132fn apply_effect<'mir>(
133&self,
134 state: &mut Self::Domain,
135 block: BasicBlock,
136 block_data: &'mir BasicBlockData<'tcx>,
137 idx: EffectIndex,
138 ) {
139let statement_index = idx.statement_index;
140let terminator_index = block_data.statements.len();
141let loc = Location { block, statement_index };
142let is_terminator = statement_index == terminator_index;
143144if !is_terminator {
145let statement = &block_data.statements[statement_index];
146match idx.effect {
147 Effect::Early => self.apply_early_statement_effect(state, statement, loc),
148 Effect::Primary => self.apply_primary_statement_effect(state, statement, loc),
149 }
150 } else {
151let terminator = block_data.terminator();
152match idx.effect {
153 Effect::Early => self.apply_early_terminator_effect(state, terminator, loc),
154 Effect::Primary => {
155self.apply_primary_terminator_effect(state, terminator, loc);
156 }
157 }
158 }
159 }
160161/// Updates the current dataflow state with an "early" effect, i.e. one
162 /// that occurs immediately before the given statement.
163 ///
164 /// This method is useful if the consumer of the results of this analysis only needs to observe
165 /// *part* of the effect of a statement (e.g. for two-phase borrows). As a general rule,
166 /// analyses should not implement this without also implementing
167 /// `apply_primary_statement_effect`.
168fn apply_early_statement_effect(
169&self,
170 _state: &mut Self::Domain,
171 _statement: &mir::Statement<'tcx>,
172 _location: Location,
173 ) {
174 }
175176/// Updates the current dataflow state with the effect of evaluating a statement.
177fn apply_primary_statement_effect(
178&self,
179 state: &mut Self::Domain,
180 statement: &mir::Statement<'tcx>,
181 location: Location,
182 );
183184/// Updates the current dataflow state with an effect that occurs immediately *before* the
185 /// given terminator.
186 ///
187 /// This method is useful if the consumer of the results of this analysis needs only to observe
188 /// *part* of the effect of a terminator (e.g. for two-phase borrows). As a general rule,
189 /// analyses should not implement this without also implementing
190 /// `apply_primary_terminator_effect`.
191fn apply_early_terminator_effect(
192&self,
193 _state: &mut Self::Domain,
194 _terminator: &mir::Terminator<'tcx>,
195 _location: Location,
196 ) {
197 }
198199/// Gets the terminator edges. Used by forward analyses only. Called *before*
200 /// `apply_primary_terminator_effect` is applied; this might seem strange but in practice
201 /// `MaybeInitializedPlaces` needs that ordering and other analyses work with either ordering.
202fn get_terminator_edges<'mir>(
203&self,
204 _state: &Self::Domain,
205 terminator: &'mir mir::Terminator<'tcx>,
206 _location: Location,
207 ) -> TerminatorEdges<'mir, 'tcx> {
208terminator.edges()
209 }
210211/// Updates the current dataflow state with the effect of evaluating a terminator.
212 ///
213 /// The effect of a successful return from a `Call` terminator should **not** be accounted for
214 /// in this function. That should go in `apply_call_return_effect`. For example, in the
215 /// `InitializedPlaces` analyses, the return place for a function call is not marked as
216 /// initialized here.
217fn apply_primary_terminator_effect(
218&self,
219 _state: &mut Self::Domain,
220 _terminator: &mir::Terminator<'tcx>,
221 _location: Location,
222 ) {
223 }
224225/* Edge-specific effects */
226227/// Updates the current dataflow state with the effect of a successful return from a `Call`
228 /// terminator.
229 ///
230 /// This is separate from `apply_primary_terminator_effect` to properly track state across
231 /// unwind edges.
232fn apply_call_return_effect(
233&self,
234 _state: &mut Self::Domain,
235 _block: BasicBlock,
236 _return_places: CallReturnPlaces<'_, 'tcx>,
237 ) {
238 }
239240/// Used to update the current dataflow state with the effect of taking a particular branch in
241 /// a `SwitchInt` terminator.
242 ///
243 /// Unlike the other edge-specific effects, which are allowed to mutate `Self::Domain`
244 /// directly, overriders of this method must return a `Self::SwitchIntData` value (wrapped in
245 /// `Some`). The `apply_switch_int_edge_effect` method will then be called once for each
246 /// outgoing edge and will have access to the dataflow state that will be propagated along that
247 /// edge, and also the `Self::SwitchIntData` value.
248 ///
249 /// This interface is somewhat more complex than the other visitor-like "effect" methods.
250 /// However, it is both more ergonomic—callers don't need to recompute or cache information
251 /// about a given `SwitchInt` terminator for each one of its edges—and more efficient—the
252 /// engine doesn't need to clone the exit state for a block unless
253 /// `get_switch_int_data` is actually called.
254fn get_switch_int_data(
255&self,
256 _block: mir::BasicBlock,
257 _targets: &mir::SwitchTargets,
258 _discr: &mir::Operand<'tcx>,
259 ) -> Option<Self::SwitchIntData> {
260None261 }
262263/// See comments on `get_switch_int_data`.
264fn apply_switch_int_edge_effect(
265&self,
266 _state: &mut Self::Domain,
267 _data: &mut Self::SwitchIntData,
268 _target_idx: SwitchTargetIndex,
269 ) {
270::core::panicking::panic("internal error: entered unreachable code");unreachable!();
271 }
272273/* Extension methods */
274275/// Finds the fixpoint for this dataflow problem.
276 ///
277 /// You shouldn't need to override this. Its purpose is to enable method chaining like so:
278 ///
279 /// ```ignore (cross-crate-imports)
280 /// let results = MyAnalysis::new(tcx, body)
281 /// .iterate_to_fixpoint(tcx, body, None)
282 /// .into_results_cursor(body);
283 /// ```
284 /// You can optionally add a `pass_name` to the graphviz output for this particular run of a
285 /// dataflow analysis. Some analyses are run multiple times in the compilation pipeline.
286 /// Without a `pass_name` to differentiates them, only the results for the latest run will be
287 /// saved.
288fn iterate_to_fixpoint<'mir>(
289self,
290 tcx: TyCtxt<'tcx>,
291 body: &'mir mir::Body<'tcx>,
292 pass_name: Option<&'static str>,
293 ) -> Results<'tcx, Self>
294where
295Self: Sized,
296Self::Domain: DebugWithContext<Self>,
297 {
298let mut entry_states =
299IndexVec::from_fn_n(|_| self.bottom_value(body), body.basic_blocks.len());
300self.initialize_start_block(body, &mut entry_states[mir::START_BLOCK]);
301302if Self::Direction::IS_BACKWARD && entry_states[mir::START_BLOCK] != self.bottom_value(body)
303 {
304::rustc_middle::util::bug::bug_fmt(format_args!("`initialize_start_block` is not yet supported for backward dataflow analyses"));bug!("`initialize_start_block` is not yet supported for backward dataflow analyses");
305 }
306307// Forward analyses use a reverse postorder (`rpo`). Every reachable basic block has a
308 // *rank*: its position within `rpo`. Rank order is dataflow order: for every edge A -> B
309 // that is not a back edge, rank(A) < rank(B). This is independent of basic block numbering
310 // (which depends on the vagaries of CFG construction).
311 //
312 // The CFG traversal uses a "min-rank" algorithm. First, all reachable basic blocks are
313 // marked as dirty. The loop-head invariant is that `curr_rank` always points to the
314 // minimum-rank dirty block in `rpo`. Before processing that block we mark it as clean. If
315 // the processing dirties a block with a rank lower than or equal to `curr_rank` (via a
316 // back edge, which could be an edge-to-self) then `curr_rank` is set to that
317 // lower-or-equal rank. After the block is processed, if `curr_rank` doesn't point to a
318 // dirty block it is moved to the next dirty block, and we iterate again.
319 //
320 // This algorithm ensures each basic block is processed only after all its dirty
321 // predecessors (ignoring back edges). When a back edge dirties an earlier block we return
322 // to that earlier block immediately, which avoids processing later blocks with possibly
323 // soon-to-be-stale information. Loop-free code is processed in a single pass.
324 //
325 // Backward analyses: we want a postorder instead of a reverse postorder, but we also want
326 // to avoid the cost of adding a `postorder` field to `mir::basic_blocks::Cache`. We can
327 // fake a postorder traversal cheaply by using a reverse postorder and flipping the rank
328 // mapping. There is also one wrinkle involving unreachable blocks; see below.
329330impl ::std::fmt::Debug for BasicBlockRank {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("bbr{0}", self.as_u32()))
}
}rustc_index::newtype_index! {
331#[orderable]
332 #[debug_format = "bbr{}"]
333struct BasicBlockRank {}
334 }335336let rpo: &[BasicBlock] = body.basic_blocks.reverse_postorder();
337let last = rpo.len() - 1;
338339let mut ranks: IndexVec<BasicBlock, Option<BasicBlockRank>> =
340IndexVec::from_elem_n(None, body.basic_blocks.len());
341for (i, &bb) in rpo.iter().enumerate() {
342let rank = if Self::Direction::IS_FORWARD { i } else { last - i };
343 ranks[bb] = Some(BasicBlockRank::new(rank));
344 }
345346let mut dirty: DenseBitSet<BasicBlockRank> = DenseBitSet::new_filled(rpo.len());
347let mut curr_rank = BasicBlockRank::ZERO;
348349// `state` is not actually used between iterations; this is just an optimization to avoid
350 // reallocating every iteration.
351let mut state = self.bottom_value(body);
352353loop {
354let i = curr_rank.as_usize();
355let bb = rpo[if Self::Direction::IS_FORWARD { i } else { last - i }];
356if true {
if !dirty.contains(curr_rank) {
::core::panicking::panic("assertion failed: dirty.contains(curr_rank)")
};
};debug_assert!(dirty.contains(curr_rank)); // check invariant
357dirty.remove(curr_rank); // invariant temporarily broken
358359state.clone_from(&entry_states[bb]);
360let prop = |target: BasicBlock, state: &Self::Domain| {
361// A backward analysis may encounter an unreachable block, because a predecessor
362 // of a reachable block may be unreachable. Ignore any such block. (In contrast, in
363 // a forward analysis any successor of a reachable block must be reachable.)
364let target_rank = ranks[target];
365if Self::Direction::IS_BACKWARD && target_rank.is_none() {
366return;
367 }
368let target_rank = target_rank.unwrap();
369370let set_changed = entry_states[target].join(state);
371if set_changed {
372dirty.insert(target_rank);
373curr_rank = curr_rank.min(target_rank);
374 }
375 };
376Self::Direction::apply_effects_in_block(&self, body, &mut state, bb, &body[bb], prop);
377378match dirty.first_set_at_or_after(curr_rank) {
379Some(rank) => curr_rank = rank, // broken invariant re-established
380None => break, // no more dirty blocks; finish
381}
382 }
383384let results = Results { analysis: self, entry_states };
385386if tcx.sess.opts.unstable_opts.dump_mir_dataflow {
387let res = write_graphviz_results(tcx, body, &results, pass_name);
388if let Err(e) = res {
389{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_mir_dataflow/src/framework/mod.rs:389",
"rustc_mir_dataflow::framework", ::tracing::Level::ERROR,
::tracing_core::__macro_support::Option::Some("compiler/rustc_mir_dataflow/src/framework/mod.rs"),
::tracing_core::__macro_support::Option::Some(389u32),
::tracing_core::__macro_support::Option::Some("rustc_mir_dataflow::framework"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::ERROR <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::ERROR <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("Failed to write graphviz dataflow results: {0}",
e) as &dyn ::tracing::field::Value))])
});
} else { ; }
};error!("Failed to write graphviz dataflow results: {}", e);
390 }
391 }
392393results394 }
395}
396397#[derive(#[automatically_derived]
impl ::core::fmt::Debug for SwitchTargetIndex {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
SwitchTargetIndex::Normal(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Normal",
&__self_0),
SwitchTargetIndex::Otherwise =>
::core::fmt::Formatter::write_str(f, "Otherwise"),
}
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for SwitchTargetIndex {
#[inline]
fn clone(&self) -> SwitchTargetIndex {
let _: ::core::clone::AssertParamIsClone<usize>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for SwitchTargetIndex { }Copy)]
398pub enum SwitchTargetIndex {
399// Index of a normal switch target.
400Normal(usize),
401// The final "otherwise" fallback target.
402Otherwise,
403}
404405/// The legal operations for a transfer function in a gen/kill problem.
406pub trait GenKill<T> {
407/// Inserts `elem` into the state vector.
408fn gen_(&mut self, elem: T);
409410/// Removes `elem` from the state vector.
411fn kill(&mut self, elem: T);
412413/// Calls `gen` for each element in `elems`.
414fn gen_all(&mut self, elems: impl IntoIterator<Item = T>) {
415for elem in elems {
416self.gen_(elem);
417 }
418 }
419420/// Calls `kill` for each element in `elems`.
421fn kill_all(&mut self, elems: impl IntoIterator<Item = T>) {
422for elem in elems {
423self.kill(elem);
424 }
425 }
426}
427428impl<T: Idx> GenKill<T> for DenseBitSet<T> {
429fn gen_(&mut self, elem: T) {
430self.insert(elem);
431 }
432433fn kill(&mut self, elem: T) {
434self.remove(elem);
435 }
436}
437438impl<T: Idx> GenKill<T> for MixedBitSet<T> {
439fn gen_(&mut self, elem: T) {
440self.insert(elem);
441 }
442443fn kill(&mut self, elem: T) {
444self.remove(elem);
445 }
446}
447448impl<T, S: GenKill<T>> GenKill<T> for MaybeReachable<S> {
449fn gen_(&mut self, elem: T) {
450match self {
451// If the state is not reachable, adding an element does nothing.
452MaybeReachable::Unreachable => {}
453 MaybeReachable::Reachable(set) => set.gen_(elem),
454 }
455 }
456457fn kill(&mut self, elem: T) {
458match self {
459// If the state is not reachable, killing an element does nothing.
460MaybeReachable::Unreachable => {}
461 MaybeReachable::Reachable(set) => set.kill(elem),
462 }
463 }
464}
465466// NOTE: DO NOT CHANGE VARIANT ORDER. The derived `Ord` impls rely on the current order.
467#[derive(#[automatically_derived]
impl ::core::clone::Clone for Effect {
#[inline]
fn clone(&self) -> Effect { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Effect { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for Effect {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
Effect::Early => "Early",
Effect::Primary => "Primary",
})
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for Effect {
#[inline]
fn eq(&self, other: &Effect) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Effect {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Effect {
#[inline]
fn partial_cmp(&self, other: &Effect)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for Effect {
#[inline]
fn cmp(&self, other: &Effect) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord)]
468enum Effect {
469/// The "early" effect (e.g., `apply_early_statement_effect`) for a statement/terminator.
470Early,
471472/// The "primary" effect (e.g., `apply_primary_statement_effect`) for a statement/terminator.
473Primary,
474}
475476impl Effect {
477const fn at_index(self, statement_index: usize) -> EffectIndex {
478EffectIndex { effect: self, statement_index }
479 }
480}
481482#[derive(#[automatically_derived]
impl ::core::clone::Clone for EffectIndex {
#[inline]
fn clone(&self) -> EffectIndex {
let _: ::core::clone::AssertParamIsClone<usize>;
let _: ::core::clone::AssertParamIsClone<Effect>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for EffectIndex { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for EffectIndex {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "EffectIndex",
"statement_index", &self.statement_index, "effect", &&self.effect)
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for EffectIndex {
#[inline]
fn eq(&self, other: &EffectIndex) -> bool {
self.statement_index == other.statement_index &&
self.effect == other.effect
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for EffectIndex {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<usize>;
let _: ::core::cmp::AssertParamIsEq<Effect>;
}
}Eq)]
483pub struct EffectIndex {
484 statement_index: usize,
485 effect: Effect,
486}
487488#[cfg(test)]
489mod tests;