Skip to main content

collect_used_errors

Function collect_used_errors 

Source
fn collect_used_errors(gcx: Gcx<'_>) -> HashSet<ErrorId>
Expand description

Collects every [hir::ErrorId] referenced by an expression anywhere in the unit.

Resolved identifiers cover almost every use: the lowering resolves the full path of revert Lib.Err(...) into a single Ident, and require(cond, Err(...)) or Err.selector reference the error through a resolved Ident as well. The one exception is a qualified member access such as Lib.Err.selector: the inner Err segment carries no resolution in the HIR, so it is resolved against the scope its base designates: the items of a contract, or, for a module alias, Solar’s resolved source scope, which binds exactly the names the file declares and imports (aliases included) rather than the raw items of the transitively imported files.