Skip to content

Commit 65aae31

Browse files
authored
Merge pull request #30593 from petrosagg/analysis-wip
transform: some typos and redundant return values
2 parents d29f043 + ae324e2 commit 65aae31

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/transform/src/analysis.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub use unique_keys::UniqueKeys;
2828
pub trait Analysis: 'static {
2929
/// The type of value this analysis associates with an expression.
3030
type Value: std::fmt::Debug;
31-
/// Announce any depencies this analysis has on other analyses.
31+
/// Announce any dependencies this analysis has on other analyses.
3232
///
3333
/// The method should invoke `builder.require::<Foo>()` for each other
3434
/// analysis `Foo` this analysis depends upon.
@@ -48,7 +48,7 @@ pub trait Analysis: 'static {
4848
/// The `index` indicates the post-order index for the expression, for use in finding
4949
/// the corresponding information in `results` and `depends`.
5050
///
51-
/// The return result will be associated with this expression for this analysis,
51+
/// The returned result will be associated with this expression for this analysis,
5252
/// and the analyses will continue.
5353
fn derive(
5454
&self,
@@ -287,8 +287,7 @@ pub mod common {
287287
// If we have not sequenced `type_id` but have a bundle, it means
288288
// we are in the process of fulfilling its requirements: a cycle.
289289
if self.result.analyses.contains_key(&type_id) {
290-
// TODO: Find a better way to identify `A`.
291-
panic!("Cyclic dependency detected: {:?}", type_id);
290+
panic!("Cyclic dependency detected: {}", std::any::type_name::<A>());
292291
}
293292
// Insert the analysis bundle first, so that we can detect cycles.
294293
self.result.analyses.insert(
@@ -419,6 +418,7 @@ pub mod common {
419418
/// Analysis that starts optimistically but is only correct at a fixed point.
420419
///
421420
/// Will fail out to `analyse_pessimistic` if the lattice is missing, or `self.fuel` is exhausted.
421+
/// When successful, the result indicates whether new information was produced for `exprs.last()`.
422422
fn analyse_optimistic(
423423
&mut self,
424424
exprs: &[&MirRelationExpr],
@@ -458,6 +458,8 @@ pub mod common {
458458
}
459459

460460
/// Analysis that starts conservatively and can be stopped at any point.
461+
///
462+
/// Result indicates whether new information was produced for `exprs.last()`.
461463
fn analyse_pessimistic(&mut self, exprs: &[&MirRelationExpr], depends: &Derived) -> bool {
462464
// TODO: consider making iterative, from some `bottom()` up using `join_assign()`.
463465
self.results.clear();

0 commit comments

Comments
 (0)