use std::collections::VecDeque;
use std::fmt;
-use rustc_const_math::ConstInt;
use std::default::Default;
use std::{mem, slice, vec};
use std::iter::{FromIterator, once};
+use rustc_data_structures::sync::Lrc;
use std::rc::Rc;
use std::cell::RefCell;
use std::sync::Arc;
match *self {
Predicate::Trait(ref pred) => pred.clean(cx),
- Predicate::Equate(ref pred) => pred.clean(cx),
Predicate::Subtype(ref pred) => pred.clean(cx),
Predicate::RegionOutlives(ref pred) => pred.clean(cx),
Predicate::TypeOutlives(ref pred) => pred.clean(cx),
}
}
-impl<'tcx> Clean<WherePredicate> for ty::EquatePredicate<'tcx> {
- fn clean(&self, cx: &DocContext) -> WherePredicate {
- let ty::EquatePredicate(ref lhs, ref rhs) = *self;
- WherePredicate::EqPredicate {
- lhs: lhs.clean(cx),
- rhs: rhs.clean(cx)
- }
- }
-}
-
impl<'tcx> Clean<WherePredicate> for ty::SubtypePredicate<'tcx> {
fn clean(&self, _cx: &DocContext) -> WherePredicate {
panic!("subtype predicates are an internal rustc artifact \
ty: cx.tcx.types.usize
})
});
- let n = if let ConstVal::Integral(ConstInt::Usize(n)) = n.val {
- n.to_string()
- } else if let ConstVal::Unevaluated(def_id, _) = n.val {
+ let n = if let ConstVal::Unevaluated(def_id, _) = n.val {
if let Some(node_id) = cx.tcx.hir.as_local_node_id(def_id) {
print_const_expr(cx, cx.tcx.hir.body_owned_by(node_id))
} else {
n = new_n;
}
};
- let n = if let ConstVal::Integral(ConstInt::Usize(n)) = n.val {
- n.to_string()
- } else if let ConstVal::Unevaluated(def_id, _) = n.val {
+ let n = if let ConstVal::Unevaluated(def_id, _) = n.val {
if let Some(node_id) = cx.tcx.hir.as_local_node_id(def_id) {
print_const_expr(cx, cx.tcx.hir.body_owned_by(node_id))
} else {
let primitive = match *target {
ResolvedPath { did, .. } if did.is_local() => continue,
ResolvedPath { did, .. } => {
- ret.extend(inline::build_impls(cx, did, true));
+ // We set the last parameter to false to avoid looking for auto-impls for traits
+ // and therefore avoid an ICE.
+ // The reason behind this is that auto-traits don't propagate through Deref so
+ // we're not supposed to synthesise impls for them.
+ ret.extend(inline::build_impls(cx, did, false));
continue
}
_ => match target.primitive_type() {
None => return None,
};
- for item in mem::replace(&mut items, Rc::new(vec![])).iter() {
+ for item in mem::replace(&mut items, Lrc::new(vec![])).iter() {
if item.ident.name == *segment {
if path_it.peek().is_none() {
return match item.def {