/// Determine the type of the range.
///
/// This determines the type of the range's bounds and applies any necessary
/// implicit casts to make them be of the same type.
Determine the type of the range.
This determines the type of the range's bounds and applies any necessary
implicit casts to make them be of the same type.
Determine the type of the range . This determines the type of the range ' s bounds and applies any necessary implicit casts to make them be of the same type .
pub fn bound_type<C>(&self, ctx: C) -> Result<&'t Type>
    where
        C: ExprContext<'t> + Copy,
    {
        match *self {
            Range2::Immediate(span, _, l, r) => {
                let lt = l.typeval(None, &ctx);
                let rt = r.typeval(None, &ctx);
                let (lt, rt) = (lt?, rt?);
                if lt == rt {
                    Ok(lt)
                } else if lt.is_implicitly_castable(rt) {
                    Ok(rt)
                } else if rt.is_implicitly_castable(lt) {
                    Ok(lt)
                } else {
                    ctx.emit(
                        DiagBuilder2::error(format!(
                            "range bounds `{}` and `{}` have incompatible types",
                            l.span().extract(),
                            r.span().extract()
                        ))
                        .span(span)
                        .add_note(format!(" left bound type: {}", lt))
                        .add_note(format!("right bound type: {}", rt)),
                    );
                    Err(())
                }
            }
        }
    }
pub fn bound_type < C > ( & self , ctx : C ) -> Result < & ' t Type > where C : ExprContext < ' t > + Copy , { match * self { Range2 :: Immediate ( span , _ , l , r ) => { let lt = l . typeval ( None , & ctx ) ; let rt = r . typeval ( None , & ctx ) ; let ( lt , rt ) = ( lt ? , rt ? ) ; if lt == rt { Ok ( lt ) } else if lt . is_implicitly_castable ( rt ) { Ok ( rt ) } else if rt . is_implicitly_castable ( lt ) { Ok ( lt ) } else { ctx . emit ( DiagBuilder2 :: error ( format ! ( " " l span ( ) extract ( ) r span ( ) extract ( ) ) ) . span ( span ) . add_note ( format ! ( " " lt ) ) . add_note ( format ! ( " " rt ) ) , ) ; Err ( ( ) ) } } } }
Determine the type of the range.
Determine the type of the range .
&self
ctx
C