Skip to main content

Module simplify

Module simplify 

Source
Expand description

Simplification of where-clauses and parameter bounds into a prettier and more canonical form.

Currently all cross-crate-inlined function use rustc_middle::ty to reconstruct the AST (e.g., see all of clean::inline), but this is not always a non-lossy transformation. The current format of storage for where-clauses for functions and such is simply a list of predicates. One example of this is that the AST predicate of: where T: Trait<Foo = Bar> is encoded as: where T: Trait, <T as Trait>::Foo = Bar.

This module attempts to reconstruct the original where and/or parameter bounds by special casing scenarios such as these. Fun!

Re-exportsยง

use rustc_attr_ir::lang_items::LangItem; ๐Ÿ”’
use rustc_data_structures::fx::FxIndexMap; ๐Ÿ”’
use rustc_data_structures::thin_vec::ThinVec; ๐Ÿ”’
use rustc_hir as hir; ๐Ÿ”’
use rustc_hir::def_id::DefId; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_middle::ty::Unnormalized; ๐Ÿ”’
use crate::clean; ๐Ÿ”’
use crate::clean::GenericArgs as PP; ๐Ÿ”’
use crate::clean::WherePredicate as WP; ๐Ÿ”’
use crate::core::DocContext; ๐Ÿ”’

Functionsยง

merge_bounds ๐Ÿ”’
move_bounds_to_generic_parameters ๐Ÿ”’
Move bounds that are (likely) directly attached to generic parameters from the where-clause to the respective parameter.
sizedness_bounds ๐Ÿ”’
Reconstruct all sizedness bounds on non-Self type parameters as they appear in the surface language given generics that were cleaned from the middle::ty IR.
trait_is_same_or_supertrait ๐Ÿ”’
where_clauses ๐Ÿ”’