Skip to content

Commit

Permalink
rustc: Comments only - explain the invariant about ty_err and ty_bot …
Browse files Browse the repository at this point in the history
…a little
  • Loading branch information
catamorphism committed Mar 21, 2013
1 parent db00362 commit f36f9fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/librustc/middle/typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,16 @@ pub fn break_here() {
debug!("break here!");
}

/// Invariant:
/// If an expression has any sub-expressions that result in a type error,
/// inspecting that expression's type with `ty::type_is_error` will return
/// true. Likewise, if an expression is known to diverge, inspecting its
/// type with `ty::type_is_bot` will return true (n.b.: since Rust is
/// strict, _|_ can appear in the type of an expression that does not,
/// itself, diverge: for example, fn() -> _|_.)
/// Note that inspecting a type's structure *directly* may expose the fact
/// that there are actually multiple representations for both `ty_err` and
/// `ty_bot`, so avoid that when err and bot need to be handled differently.
pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
expr: @ast::expr,
expected: Option<ty::t>,
Expand Down

5 comments on commit f36f9fc

@bors
Copy link
Contributor

@bors bors commented on f36f9fc Mar 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nikomatsakis
at catamorphism@f36f9fc

@bors
Copy link
Contributor

@bors bors commented on f36f9fc Mar 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging catamorphism/rust/flagless = f36f9fc into auto

@bors
Copy link
Contributor

@bors bors commented on f36f9fc Mar 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catamorphism/rust/flagless = f36f9fc merged ok, testing candidate = 6aa612a

@bors
Copy link
Contributor

@bors bors commented on f36f9fc Mar 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on f36f9fc Mar 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 6aa612a

Please sign in to comment.