Struct rustc_typeck::check::coercion::Coerce [−][src]
struct Coerce<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, cause: ObligationCause<'tcx>, use_lub: bool, allow_two_phase: AllowTwoPhase, }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Fields
fcx: &'a FnCtxt<'a, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
cause: ObligationCause<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
use_lub: bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
allow_two_phase: AllowTwoPhase
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Determines whether or not allow_two_phase_borrow is set on any autoref adjustments we create while coercing. We don't want to allow deref coercions to create two-phase borrows, at least initially, but we do need two-phase borrows for function argument reborrows. See #47489 and #48598 See docs on the "AllowTwoPhase" type for a more detailed discussion
Methods
impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx>
[src]
impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx>
fn new(
fcx: &'f FnCtxt<'f, 'gcx, 'tcx>,
cause: ObligationCause<'tcx>,
allow_two_phase: AllowTwoPhase
) -> Self
[src]
fn new(
fcx: &'f FnCtxt<'f, 'gcx, 'tcx>,
cause: ObligationCause<'tcx>,
allow_two_phase: AllowTwoPhase
) -> Self
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>>
[src]
fn unify(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify_and<F>(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>,
f: F
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)> where
F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
[src]
fn unify_and<F>(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>,
f: F
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)> where
F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Unify two types (using sub or lub) and produce a specific coercion.
fn coerce(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn coerce_borrowed_pointer(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>,
r_b: Region<'tcx>,
mt_b: TypeAndMut<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce_borrowed_pointer(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>,
r_b: Region<'tcx>,
mt_b: TypeAndMut<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Reborrows &mut A
to &mut B
and &(mut) A
to &B
.
To match A
with B
, autoderef will be performed,
calling deref
/deref_mut
where necessary.
fn coerce_unsized(
&self,
source: Ty<'tcx>,
target: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce_unsized(
&self,
source: Ty<'tcx>,
target: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn coerce_from_safe_fn<F, G>(
&self,
a: Ty<'tcx>,
fn_ty_a: PolyFnSig<'tcx>,
b: Ty<'tcx>,
to_unsafe: F,
normal: G
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)> where
F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
[src]
fn coerce_from_safe_fn<F, G>(
&self,
a: Ty<'tcx>,
fn_ty_a: PolyFnSig<'tcx>,
b: Ty<'tcx>,
to_unsafe: F,
normal: G
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)> where
F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn coerce_from_fn_pointer(
&self,
a: Ty<'tcx>,
fn_ty_a: PolyFnSig<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce_from_fn_pointer(
&self,
a: Ty<'tcx>,
fn_ty_a: PolyFnSig<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Attempts to coerce from the type of a Rust function item
into a closure or a proc
.
fn coerce_from_fn_item(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce_from_fn_item(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Attempts to coerce from the type of a Rust function item
into a closure or a proc
.
fn coerce_closure_to_fn(
&self,
a: Ty<'tcx>,
def_id_a: DefId,
substs_a: ClosureSubsts<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce_closure_to_fn(
&self,
a: Ty<'tcx>,
def_id_a: DefId,
substs_a: ClosureSubsts<'tcx>,
b: Ty<'tcx>
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Attempts to coerce from the type of a non-capturing closure into a function pointer.
fn coerce_unsafe_ptr(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>,
mutbl_b: Mutability
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
[src]
fn coerce_unsafe_ptr(
&self,
a: Ty<'tcx>,
b: Ty<'tcx>,
mutbl_b: Mutability
) -> InferResult<'tcx, (Vec<Adjustment<'tcx>>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Methods from Deref<Target = FnCtxt<'a, 'gcx, 'tcx>>
ⓘImportant traits for Autoderef<'a, 'gcx, 'tcx>pub fn autoderef(
&'a self,
span: Span,
base_ty: Ty<'tcx>
) -> Autoderef<'a, 'gcx, 'tcx>
[src]
pub fn autoderef(
&'a self,
span: Span,
base_ty: Ty<'tcx>
) -> Autoderef<'a, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn try_overloaded_deref(
&self,
span: Span,
base_ty: Ty<'tcx>,
needs: Needs
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>>
[src]
pub fn try_overloaded_deref(
&self,
span: Span,
base_ty: Ty<'tcx>,
needs: Needs
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_pat_walk(
&self,
pat: &'gcx Pat,
expected: Ty<'tcx>,
def_bm: BindingMode,
is_arg: bool
)
[src]
pub fn check_pat_walk(
&self,
pat: &'gcx Pat,
expected: Ty<'tcx>,
def_bm: BindingMode,
is_arg: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
The is_arg
argument indicates whether this pattern is the
outermost pattern in an argument (e.g., in fn foo(&x: &u32)
, it is true for the &x
pattern but not x
). This is
used to tailor error reporting.
pub fn check_dereferencable(
&self,
span: Span,
expected: Ty<'tcx>,
inner: &Pat
) -> bool
[src]
pub fn check_dereferencable(
&self,
span: Span,
expected: Ty<'tcx>,
inner: &Pat
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_match(
&self,
expr: &'gcx Expr,
discrim: &'gcx Expr,
arms: &'gcx [Arm],
expected: Expectation<'tcx>,
match_src: MatchSource
) -> Ty<'tcx>
[src]
pub fn check_match(
&self,
expr: &'gcx Expr,
discrim: &'gcx Expr,
arms: &'gcx [Arm],
expected: Expectation<'tcx>,
match_src: MatchSource
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_pat_struct(
&self,
pat: &'gcx Pat,
qpath: &QPath,
fields: &'gcx [Spanned<FieldPat>],
etc: bool,
expected: Ty<'tcx>,
def_bm: BindingMode
) -> Ty<'tcx>
[src]
fn check_pat_struct(
&self,
pat: &'gcx Pat,
qpath: &QPath,
fields: &'gcx [Spanned<FieldPat>],
etc: bool,
expected: Ty<'tcx>,
def_bm: BindingMode
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_pat_path(
&self,
pat: &Pat,
qpath: &QPath,
expected: Ty<'tcx>
) -> Ty<'tcx>
[src]
fn check_pat_path(
&self,
pat: &Pat,
qpath: &QPath,
expected: Ty<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_pat_tuple_struct(
&self,
pat: &Pat,
qpath: &QPath,
subpats: &'gcx [P<Pat>],
ddpos: Option<usize>,
expected: Ty<'tcx>,
def_bm: BindingMode
) -> Ty<'tcx>
[src]
fn check_pat_tuple_struct(
&self,
pat: &Pat,
qpath: &QPath,
subpats: &'gcx [P<Pat>],
ddpos: Option<usize>,
expected: Ty<'tcx>,
def_bm: BindingMode
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_struct_pat_fields(
&self,
adt_ty: Ty<'tcx>,
pat_id: NodeId,
span: Span,
variant: &'tcx VariantDef,
fields: &'gcx [Spanned<FieldPat>],
etc: bool,
def_bm: BindingMode
) -> bool
[src]
fn check_struct_pat_fields(
&self,
adt_ty: Ty<'tcx>,
pat_id: NodeId,
span: Span,
variant: &'tcx VariantDef,
fields: &'gcx [Spanned<FieldPat>],
etc: bool,
def_bm: BindingMode
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn resolve_type_vars_in_body(
&self,
body: &'gcx Body
) -> &'gcx TypeckTables<'gcx>
[src]
pub fn resolve_type_vars_in_body(
&self,
body: &'gcx Body
) -> &'gcx TypeckTables<'gcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn regionck_expr(&self, body: &'gcx Body)
[src]
pub fn regionck_expr(&self, body: &'gcx Body)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn regionck_item(&self, item_id: NodeId, span: Span, wf_tys: &[Ty<'tcx>])
[src]
pub fn regionck_item(&self, item_id: NodeId, span: Span, wf_tys: &[Ty<'tcx>])
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Region checking during the WF phase for items. wf_tys
are the
types from which we should derive implied bounds, if any.
pub fn regionck_fn(&self, fn_id: NodeId, body: &'gcx Body)
[src]
pub fn regionck_fn(&self, fn_id: NodeId, body: &'gcx Body)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Region check a function body. Not invoked on closures, but only on the "root" fn item (in which closures may be embedded). Walks the function body and adds various add'l constraints that are needed for region inference. This is separated both to isolate "pure" region constraints from the rest of type check and because sometimes we need type inference to have completed before we can determine which constraints to add.
pub fn try_coerce(
&self,
expr: &Expr,
expr_ty: Ty<'tcx>,
target: Ty<'tcx>,
allow_two_phase: AllowTwoPhase
) -> RelateResult<'tcx, Ty<'tcx>>
[src]
pub fn try_coerce(
&self,
expr: &Expr,
expr_ty: Ty<'tcx>,
target: Ty<'tcx>,
allow_two_phase: AllowTwoPhase
) -> RelateResult<'tcx, Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Attempt to coerce an expression to a type, and return the adjusted type of the expression, if successful. Adjustments are only recorded if the coercion succeeded. The expressions must not have any pre-existing adjustments.
pub fn can_coerce(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> bool
[src]
pub fn can_coerce(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Same as try_coerce()
, but without side-effects.
fn try_find_coercion_lub<E>(
&self,
cause: &ObligationCause<'tcx>,
exprs: &[E],
prev_ty: Ty<'tcx>,
new: &Expr,
new_ty: Ty<'tcx>
) -> RelateResult<'tcx, Ty<'tcx>> where
E: AsCoercionSite,
[src]
fn try_find_coercion_lub<E>(
&self,
cause: &ObligationCause<'tcx>,
exprs: &[E],
prev_ty: Ty<'tcx>,
new: &Expr,
new_ty: Ty<'tcx>
) -> RelateResult<'tcx, Ty<'tcx>> where
E: AsCoercionSite,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given some expressions, their known unified type and another expression, tries to unify the types, potentially inserting coercions on any of the provided expressions and returns their LUB (aka "common supertype").
This is really an internal helper. From outside the coercion
module, you should instantiate a CoerceMany
instance.
pub fn demand_suptype(&self, sp: Span, expected: Ty<'tcx>, actual: Ty<'tcx>)
[src]
pub fn demand_suptype(&self, sp: Span, expected: Ty<'tcx>, actual: Ty<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn demand_suptype_diag(
&self,
sp: Span,
expected: Ty<'tcx>,
actual: Ty<'tcx>
) -> Option<DiagnosticBuilder<'tcx>>
[src]
pub fn demand_suptype_diag(
&self,
sp: Span,
expected: Ty<'tcx>,
actual: Ty<'tcx>
) -> Option<DiagnosticBuilder<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn demand_eqtype(&self, sp: Span, expected: Ty<'tcx>, actual: Ty<'tcx>)
[src]
pub fn demand_eqtype(&self, sp: Span, expected: Ty<'tcx>, actual: Ty<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn demand_eqtype_diag(
&self,
sp: Span,
expected: Ty<'tcx>,
actual: Ty<'tcx>
) -> Option<DiagnosticBuilder<'tcx>>
[src]
pub fn demand_eqtype_diag(
&self,
sp: Span,
expected: Ty<'tcx>,
actual: Ty<'tcx>
) -> Option<DiagnosticBuilder<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn demand_eqtype_with_origin(
&self,
cause: &ObligationCause<'tcx>,
expected: Ty<'tcx>,
actual: Ty<'tcx>
) -> Option<DiagnosticBuilder<'tcx>>
[src]
pub fn demand_eqtype_with_origin(
&self,
cause: &ObligationCause<'tcx>,
expected: Ty<'tcx>,
actual: Ty<'tcx>
) -> Option<DiagnosticBuilder<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn demand_coerce(
&self,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>,
allow_two_phase: AllowTwoPhase
) -> Ty<'tcx>
[src]
pub fn demand_coerce(
&self,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>,
allow_two_phase: AllowTwoPhase
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn demand_coerce_diag(
&self,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>,
allow_two_phase: AllowTwoPhase
) -> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx>>)
[src]
pub fn demand_coerce_diag(
&self,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>,
allow_two_phase: AllowTwoPhase
) -> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx>>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn get_conversion_methods(
&self,
span: Span,
expected: Ty<'tcx>,
checked_ty: Ty<'tcx>
) -> Vec<AssociatedItem>
[src]
pub fn get_conversion_methods(
&self,
span: Span,
expected: Ty<'tcx>,
checked_ty: Ty<'tcx>
) -> Vec<AssociatedItem>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn has_no_input_arg(&self, method: &AssociatedItem) -> bool
[src]
fn has_no_input_arg(&self, method: &AssociatedItem) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn can_use_as_ref(&self, expr: &Expr) -> Option<(Span, &'static str, String)>
[src]
fn can_use_as_ref(&self, expr: &Expr) -> Option<(Span, &'static str, String)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Identify some cases where as_ref()
would be appropriate and suggest it.
Given the following code:
struct Foo; fn takes_ref(_: &Foo) {} let ref opt = Some(Foo); opt.map(|arg| takes_ref(arg));
Suggest using opt.as_ref().map(|arg| takes_ref(arg));
instead.
It only checks for Option
and Result
and won't work with
opt.map(|arg| { takes_ref(arg) });
pub fn check_ref(
&self,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>
) -> Option<(Span, &'static str, String)>
[src]
pub fn check_ref(
&self,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>
) -> Option<(Span, &'static str, String)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
This function is used to determine potential "simple" improvements or users' errors and provide them useful help. For example:
fn some_fn(s: &str) {} let x = "hey!".to_owned(); some_fn(x); // error
No need to find every potential function which could make a coercion to transform a
String
into a &str
since a &
would do the trick!
In addition of this check, it also checks between references mutability state. If the
expected is mutable but the provided isn't, maybe we could just say "Hey, try with
&mut
!".
pub fn check_for_cast(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected_ty: Ty<'tcx>
) -> bool
[src]
pub fn check_for_cast(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expr: &Expr,
checked_ty: Ty<'tcx>,
expected_ty: Ty<'tcx>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn confirm_method(
&self,
span: Span,
self_expr: &'gcx Expr,
call_expr: &'gcx Expr,
unadjusted_self_ty: Ty<'tcx>,
pick: Pick<'tcx>,
segment: &PathSegment
) -> ConfirmResult<'tcx>
[src]
pub fn confirm_method(
&self,
span: Span,
self_expr: &'gcx Expr,
call_expr: &'gcx Expr,
unadjusted_self_ty: Ty<'tcx>,
pick: Pick<'tcx>,
segment: &PathSegment
) -> ConfirmResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn probe_for_return_type(
&self,
span: Span,
mode: Mode,
return_type: Ty<'tcx>,
self_ty: Ty<'tcx>,
scope_expr_id: NodeId
) -> Vec<AssociatedItem>
[src]
pub fn probe_for_return_type(
&self,
span: Span,
mode: Mode,
return_type: Ty<'tcx>,
self_ty: Ty<'tcx>,
scope_expr_id: NodeId
) -> Vec<AssociatedItem>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
This is used to offer suggestions to users. It returns methods that could have been called which have the desired return type. Some effort is made to rule out methods that, if called, would result in an error (basically, the same criteria we would use to decide if a method is a plausible fit for ambiguity purposes).
pub fn probe_for_name(
&self,
span: Span,
mode: Mode,
item_name: Ident,
is_suggestion: IsSuggestion,
self_ty: Ty<'tcx>,
scope_expr_id: NodeId,
scope: ProbeScope
) -> Result<Pick<'tcx>, MethodError<'tcx>>
[src]
pub fn probe_for_name(
&self,
span: Span,
mode: Mode,
item_name: Ident,
is_suggestion: IsSuggestion,
self_ty: Ty<'tcx>,
scope_expr_id: NodeId,
scope: ProbeScope
) -> Result<Pick<'tcx>, MethodError<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn probe_op<OP, R>(
&'a self,
span: Span,
mode: Mode,
method_name: Option<Ident>,
return_type: Option<Ty<'tcx>>,
is_suggestion: IsSuggestion,
self_ty: Ty<'tcx>,
scope_expr_id: NodeId,
scope: ProbeScope,
op: OP
) -> Result<R, MethodError<'tcx>> where
OP: FnOnce(ProbeContext<'a, 'gcx, 'tcx>) -> Result<R, MethodError<'tcx>>,
[src]
fn probe_op<OP, R>(
&'a self,
span: Span,
mode: Mode,
method_name: Option<Ident>,
return_type: Option<Ty<'tcx>>,
is_suggestion: IsSuggestion,
self_ty: Ty<'tcx>,
scope_expr_id: NodeId,
scope: ProbeScope,
op: OP
) -> Result<R, MethodError<'tcx>> where
OP: FnOnce(ProbeContext<'a, 'gcx, 'tcx>) -> Result<R, MethodError<'tcx>>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn create_steps(
&self,
span: Span,
scope_expr_id: NodeId,
self_ty: Ty<'tcx>,
is_suggestion: IsSuggestion
) -> Option<Vec<CandidateStep<'tcx>>>
[src]
fn create_steps(
&self,
span: Span,
scope_expr_id: NodeId,
self_ty: Ty<'tcx>,
is_suggestion: IsSuggestion
) -> Option<Vec<CandidateStep<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_fn_ty(&self, ty: &Ty<'tcx>, span: Span) -> bool
[src]
fn is_fn_ty(&self, ty: &Ty<'tcx>, span: Span) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn report_method_error(
&self,
span: Span,
rcvr_ty: Ty<'tcx>,
item_name: Ident,
rcvr_expr: Option<&Expr>,
error: MethodError<'tcx>,
args: Option<&'gcx [Expr]>
)
[src]
pub fn report_method_error(
&self,
span: Span,
rcvr_ty: Ty<'tcx>,
item_name: Ident,
rcvr_expr: Option<&Expr>,
error: MethodError<'tcx>,
args: Option<&'gcx [Expr]>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn suggest_use_candidates(
&self,
err: &mut DiagnosticBuilder,
msg: String,
candidates: Vec<DefId>
)
[src]
fn suggest_use_candidates(
&self,
err: &mut DiagnosticBuilder,
msg: String,
candidates: Vec<DefId>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn suggest_valid_traits(
&self,
err: &mut DiagnosticBuilder,
valid_out_of_scope_traits: Vec<DefId>
) -> bool
[src]
fn suggest_valid_traits(
&self,
err: &mut DiagnosticBuilder,
valid_out_of_scope_traits: Vec<DefId>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn suggest_traits_to_import(
&self,
err: &mut DiagnosticBuilder,
span: Span,
rcvr_ty: Ty<'tcx>,
item_name: Ident,
rcvr_expr: Option<&Expr>,
valid_out_of_scope_traits: Vec<DefId>
)
[src]
fn suggest_traits_to_import(
&self,
err: &mut DiagnosticBuilder,
span: Span,
rcvr_ty: Ty<'tcx>,
item_name: Ident,
rcvr_expr: Option<&Expr>,
valid_out_of_scope_traits: Vec<DefId>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn type_derefs_to_local(
&self,
span: Span,
rcvr_ty: Ty<'tcx>,
rcvr_expr: Option<&Expr>
) -> bool
[src]
fn type_derefs_to_local(
&self,
span: Span,
rcvr_ty: Ty<'tcx>,
rcvr_expr: Option<&Expr>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Checks whether there is a local type somewhere in the chain of
autoderefs of rcvr_ty
.
pub fn method_exists(
&self,
method_name: Ident,
self_ty: Ty<'tcx>,
call_expr_id: NodeId,
allow_private: bool
) -> bool
[src]
pub fn method_exists(
&self,
method_name: Ident,
self_ty: Ty<'tcx>,
call_expr_id: NodeId,
allow_private: bool
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Determines whether the type self_ty
supports a method name method_name
or not.
pub fn lookup_method(
&self,
self_ty: Ty<'tcx>,
segment: &PathSegment,
span: Span,
call_expr: &'gcx Expr,
self_expr: &'gcx Expr
) -> Result<MethodCallee<'tcx>, MethodError<'tcx>>
[src]
pub fn lookup_method(
&self,
self_ty: Ty<'tcx>,
segment: &PathSegment,
span: Span,
call_expr: &'gcx Expr,
self_expr: &'gcx Expr
) -> Result<MethodCallee<'tcx>, MethodError<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Performs method lookup. If lookup is successful, it will return the callee
and store an appropriate adjustment for the self-expr. In some cases it may
report an error (e.g., invoking the drop
method).
Arguments
Given a method call like foo.bar::<T1,...Tn>(...)
:
fcx
: the surroundingFnCtxt
(!)span
: the span for the method callmethod_name
: the name of the method being called (bar
)self_ty
: the (unadjusted) type of the self expression (foo
)supplied_method_types
: the explicit method type parameters, if any (T1..Tn
)self_expr
: the self expression (foo
)
fn lookup_probe(
&self,
span: Span,
method_name: Ident,
self_ty: Ty<'tcx>,
call_expr: &'gcx Expr,
scope: ProbeScope
) -> Result<Pick<'tcx>, MethodError<'tcx>>
[src]
fn lookup_probe(
&self,
span: Span,
method_name: Ident,
self_ty: Ty<'tcx>,
call_expr: &'gcx Expr,
scope: ProbeScope
) -> Result<Pick<'tcx>, MethodError<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn lookup_method_in_trait(
&self,
span: Span,
m_name: Ident,
trait_def_id: DefId,
self_ty: Ty<'tcx>,
opt_input_types: Option<&[Ty<'tcx>]>
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>>
[src]
pub fn lookup_method_in_trait(
&self,
span: Span,
m_name: Ident,
trait_def_id: DefId,
self_ty: Ty<'tcx>,
opt_input_types: Option<&[Ty<'tcx>]>
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
lookup_method_in_trait
is used for overloaded operators.
It does a very narrow slice of what the normal probe/confirm path does.
In particular, it doesn't really do any probing: it simply constructs
an obligation for a particular trait with the given self-type and checks
whether that trait is implemented.
FIXME(#18741) -- It seems likely that we can consolidate some of this code with the other method-lookup code. In particular, the second half of this method is basically the same as confirmation.
pub fn resolve_ufcs(
&self,
span: Span,
method_name: Ident,
self_ty: Ty<'tcx>,
expr_id: NodeId
) -> Result<Def, MethodError<'tcx>>
[src]
pub fn resolve_ufcs(
&self,
span: Span,
method_name: Ident,
self_ty: Ty<'tcx>,
expr_id: NodeId
) -> Result<Def, MethodError<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn associated_item(
&self,
def_id: DefId,
item_name: Ident,
ns: Namespace
) -> Option<AssociatedItem>
[src]
pub fn associated_item(
&self,
def_id: DefId,
item_name: Ident,
ns: Namespace
) -> Option<AssociatedItem>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Find item with name item_name
defined in impl/trait def_id
and return it, or None
, if no such item was defined there.
pub fn closure_analyze(&self, body: &'gcx Body)
[src]
pub fn closure_analyze(&self, body: &'gcx Body)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn analyze_closure(
&self,
closure_node_id: NodeId,
closure_hir_id: HirId,
span: Span,
body: &Body,
capture_clause: CaptureClause
)
[src]
fn analyze_closure(
&self,
closure_node_id: NodeId,
closure_hir_id: HirId,
span: Span,
body: &Body,
capture_clause: CaptureClause
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Analysis starting point.
fn final_upvar_tys(&self, closure_id: NodeId) -> Vec<Ty<'tcx>>
[src]
fn final_upvar_tys(&self, closure_id: NodeId) -> Vec<Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn non_enum_variant(&self, struct_def: &VariantData) -> AdtVariant<'tcx>
[src]
fn non_enum_variant(&self, struct_def: &VariantData) -> AdtVariant<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn enum_variants(&self, enum_def: &EnumDef) -> Vec<AdtVariant<'tcx>>
[src]
fn enum_variants(&self, enum_def: &EnumDef) -> Vec<AdtVariant<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn impl_implied_bounds(&self, impl_def_id: DefId, span: Span) -> Vec<Ty<'tcx>>
[src]
fn impl_implied_bounds(&self, impl_def_id: DefId, span: Span) -> Vec<Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn pointer_kind(
&self,
t: Ty<'tcx>,
span: Span
) -> Result<Option<PointerKind<'tcx>>, ErrorReported>
[src]
fn pointer_kind(
&self,
t: Ty<'tcx>,
span: Span
) -> Result<Option<PointerKind<'tcx>>, ErrorReported>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns the kind of unsize information of t, or None if t is unknown.
fn type_is_known_to_be_sized(&self, ty: Ty<'tcx>, span: Span) -> bool
[src]
fn type_is_known_to_be_sized(&self, ty: Ty<'tcx>, span: Span) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_expr_closure(
&self,
expr: &Expr,
_capture: CaptureClause,
decl: &'gcx FnDecl,
body_id: BodyId,
gen: Option<GeneratorMovability>,
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
pub fn check_expr_closure(
&self,
expr: &Expr,
_capture: CaptureClause,
decl: &'gcx FnDecl,
body_id: BodyId,
gen: Option<GeneratorMovability>,
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_closure(
&self,
expr: &Expr,
opt_kind: Option<ClosureKind>,
decl: &'gcx FnDecl,
body: &'gcx Body,
gen: Option<GeneratorMovability>,
expected_sig: Option<ExpectedSig<'tcx>>
) -> Ty<'tcx>
[src]
fn check_closure(
&self,
expr: &Expr,
opt_kind: Option<ClosureKind>,
decl: &'gcx FnDecl,
body: &'gcx Body,
gen: Option<GeneratorMovability>,
expected_sig: Option<ExpectedSig<'tcx>>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn deduce_expectations_from_expected_type(
&self,
expected_ty: Ty<'tcx>
) -> (Option<ExpectedSig<'tcx>>, Option<ClosureKind>)
[src]
fn deduce_expectations_from_expected_type(
&self,
expected_ty: Ty<'tcx>
) -> (Option<ExpectedSig<'tcx>>, Option<ClosureKind>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the expected type, figures out what it can about this closure we are about to type check:
fn deduce_expectations_from_obligations(
&self,
expected_vid: TyVid
) -> (Option<ExpectedSig<'tcx>>, Option<ClosureKind>)
[src]
fn deduce_expectations_from_obligations(
&self,
expected_vid: TyVid
) -> (Option<ExpectedSig<'tcx>>, Option<ClosureKind>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn deduce_sig_from_projection(
&self,
cause_span: Option<Span>,
projection: &PolyProjectionPredicate<'tcx>
) -> Option<ExpectedSig<'tcx>>
[src]
fn deduce_sig_from_projection(
&self,
cause_span: Option<Span>,
projection: &PolyProjectionPredicate<'tcx>
) -> Option<ExpectedSig<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given a projection like "<F as Fn(X)>::Result == Y", we can deduce everything we need to know about a closure.
The cause_span
should be the span that caused us to
have this expected signature, or None
if we can't readily
know that.
fn self_type_matches_expected_vid(
&self,
trait_ref: PolyTraitRef<'tcx>,
expected_vid: TyVid
) -> Option<PolyTraitRef<'tcx>>
[src]
fn self_type_matches_expected_vid(
&self,
trait_ref: PolyTraitRef<'tcx>,
expected_vid: TyVid
) -> Option<PolyTraitRef<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn sig_of_closure(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body,
expected_sig: Option<ExpectedSig<'tcx>>
) -> ClosureSignatures<'tcx>
[src]
fn sig_of_closure(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body,
expected_sig: Option<ExpectedSig<'tcx>>
) -> ClosureSignatures<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn sig_of_closure_no_expectation(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body
) -> ClosureSignatures<'tcx>
[src]
fn sig_of_closure_no_expectation(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body
) -> ClosureSignatures<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
If there is no expected signature, then we will convert the types that the user gave into a signature.
fn sig_of_closure_with_expectation(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body,
expected_sig: ExpectedSig<'tcx>
) -> ClosureSignatures<'tcx>
[src]
fn sig_of_closure_with_expectation(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body,
expected_sig: ExpectedSig<'tcx>
) -> ClosureSignatures<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Invoked to compute the signature of a closure expression. This
combines any user-provided type annotations (e.g., |x: u32| -> u32 { .. }
) with the expected signature.
The approach is as follows:
- Let
S
be the (higher-ranked) signature that we derive from the user's annotations. - Let
E
be the (higher-ranked) signature that we derive from the expectations, if any.- If we have no expectation
E
, then the signature of the closure isS
. - Otherwise, the signature of the closure is E. Moreover:
- Skolemize the late-bound regions in
E
, yieldingE'
. - Instantiate all the late-bound regions bound in the closure within
S
with fresh (existential) variables, yieldingS'
- Require that
E' = S'
- We could use some kind of subtyping relationship here, I imagine, but equality is easier and works fine for our purposes.
- Skolemize the late-bound regions in
- If we have no expectation
The key intuition here is that the user's types must be valid from "the inside" of the closure, but the expectation ultimately drives the overall signature.
Examples
fn with_closure<F>(_: F) where F: Fn(&u32) -> &u32 { .. } with_closure(|x: &u32| { ... })
Here:
- E would be
fn(&u32) -> &u32
. - S would be `fn(&u32) ->
- E' is
&'!0 u32 -> &'!0 u32
- S' is
&'?0 u32 -> ?T
S' can be unified with E' with ['?0 = '!0, ?T = &'!10 u32]
.
Arguments
expr_def_id
: the def-id of the closure expressiondecl
: the HIR declaration of the closurebody
: the body of the closureexpected_sig
: the expected signature (if any). Note that this is missing a binder: that is, there may be late-bound regions with depth 1, which are bound then by the closure.
fn sig_of_closure_with_mismatched_number_of_arguments(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body,
expected_sig: ExpectedSig<'tcx>
) -> ClosureSignatures<'tcx>
[src]
fn sig_of_closure_with_mismatched_number_of_arguments(
&self,
expr_def_id: DefId,
decl: &FnDecl,
body: &Body,
expected_sig: ExpectedSig<'tcx>
) -> ClosureSignatures<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_supplied_sig_against_expectation(
&self,
decl: &FnDecl,
expected_sigs: &ClosureSignatures<'tcx>
) -> InferResult<'tcx, ()>
[src]
fn check_supplied_sig_against_expectation(
&self,
decl: &FnDecl,
expected_sigs: &ClosureSignatures<'tcx>
) -> InferResult<'tcx, ()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Enforce the user's types against the expectation. See
sig_of_closure_with_expectation
for details on the overall
strategy.
fn supplied_sig_of_closure(&self, decl: &FnDecl) -> PolyFnSig<'tcx>
[src]
fn supplied_sig_of_closure(&self, decl: &FnDecl) -> PolyFnSig<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
If there is no expected signature, then we will convert the types that the user gave into a signature.
fn error_sig_of_closure(&self, decl: &FnDecl) -> PolyFnSig<'tcx>
[src]
fn error_sig_of_closure(&self, decl: &FnDecl) -> PolyFnSig<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Converts the types that the user supplied, in case that doing
so should yield an error, but returns back a signature where
all parameters are of type TyErr
.
fn closure_sigs(
&self,
expr_def_id: DefId,
body: &Body,
bound_sig: PolyFnSig<'tcx>
) -> ClosureSignatures<'tcx>
[src]
fn closure_sigs(
&self,
expr_def_id: DefId,
body: &Body,
bound_sig: PolyFnSig<'tcx>
) -> ClosureSignatures<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_call(
&self,
call_expr: &'gcx Expr,
callee_expr: &'gcx Expr,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
pub fn check_call(
&self,
call_expr: &'gcx Expr,
callee_expr: &'gcx Expr,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn try_overloaded_call_step(
&self,
call_expr: &'gcx Expr,
callee_expr: &'gcx Expr,
autoderef: &Autoderef<'a, 'gcx, 'tcx>
) -> Option<CallStep<'tcx>>
[src]
fn try_overloaded_call_step(
&self,
call_expr: &'gcx Expr,
callee_expr: &'gcx Expr,
autoderef: &Autoderef<'a, 'gcx, 'tcx>
) -> Option<CallStep<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn try_overloaded_call_traits(
&self,
call_expr: &Expr,
adjusted_ty: Ty<'tcx>
) -> Option<(Option<Adjustment<'tcx>>, MethodCallee<'tcx>)>
[src]
fn try_overloaded_call_traits(
&self,
call_expr: &Expr,
adjusted_ty: Ty<'tcx>
) -> Option<(Option<Adjustment<'tcx>>, MethodCallee<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn confirm_builtin_call(
&self,
call_expr: &Expr,
callee_ty: Ty<'tcx>,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
fn confirm_builtin_call(
&self,
call_expr: &Expr,
callee_ty: Ty<'tcx>,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn confirm_deferred_closure_call(
&self,
call_expr: &Expr,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>,
fn_sig: FnSig<'tcx>
) -> Ty<'tcx>
[src]
fn confirm_deferred_closure_call(
&self,
call_expr: &Expr,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>,
fn_sig: FnSig<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn confirm_overloaded_call(
&self,
call_expr: &Expr,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>,
method_callee: MethodCallee<'tcx>
) -> Ty<'tcx>
[src]
fn confirm_overloaded_call(
&self,
call_expr: &Expr,
arg_exprs: &'gcx [Expr],
expected: Expectation<'tcx>,
method_callee: MethodCallee<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_binop_assign(
&self,
expr: &'gcx Expr,
op: BinOp,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr
) -> Ty<'tcx>
[src]
pub fn check_binop_assign(
&self,
expr: &'gcx Expr,
op: BinOp,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Check a a <op>= b
pub fn check_binop(
&self,
expr: &'gcx Expr,
op: BinOp,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr
) -> Ty<'tcx>
[src]
pub fn check_binop(
&self,
expr: &'gcx Expr,
op: BinOp,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Check a potentially overloaded binary operator.
fn enforce_builtin_binop_types(
&self,
lhs_expr: &'gcx Expr,
lhs_ty: Ty<'tcx>,
rhs_expr: &'gcx Expr,
rhs_ty: Ty<'tcx>,
op: BinOp
) -> Ty<'tcx>
[src]
fn enforce_builtin_binop_types(
&self,
lhs_expr: &'gcx Expr,
lhs_ty: Ty<'tcx>,
rhs_expr: &'gcx Expr,
rhs_ty: Ty<'tcx>,
op: BinOp
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_overloaded_binop(
&self,
expr: &'gcx Expr,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr,
op: BinOp,
is_assign: IsAssign
) -> (Ty<'tcx>, Ty<'tcx>, Ty<'tcx>)
[src]
fn check_overloaded_binop(
&self,
expr: &'gcx Expr,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr,
op: BinOp,
is_assign: IsAssign
) -> (Ty<'tcx>, Ty<'tcx>, Ty<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_str_addition(
&self,
expr: &'gcx Expr,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>,
err: &mut DiagnosticBuilder,
is_assign: bool
) -> bool
[src]
fn check_str_addition(
&self,
expr: &'gcx Expr,
lhs_expr: &'gcx Expr,
rhs_expr: &'gcx Expr,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>,
err: &mut DiagnosticBuilder,
is_assign: bool
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_user_unop(
&self,
ex: &'gcx Expr,
operand_ty: Ty<'tcx>,
op: UnOp
) -> Ty<'tcx>
[src]
pub fn check_user_unop(
&self,
ex: &'gcx Expr,
operand_ty: Ty<'tcx>,
op: UnOp
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn lookup_op_method(
&self,
lhs_ty: Ty<'tcx>,
other_tys: &[Ty<'tcx>],
op: Op
) -> Result<MethodCallee<'tcx>, ()>
[src]
fn lookup_op_method(
&self,
lhs_ty: Ty<'tcx>,
other_tys: &[Ty<'tcx>],
op: Op
) -> Result<MethodCallee<'tcx>, ()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn sess(&self) -> &Session
[src]
pub fn sess(&self) -> &Session
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn err_count_since_creation(&self) -> usize
[src]
pub fn err_count_since_creation(&self) -> usize
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn warn_if_unreachable(&self, id: NodeId, span: Span, kind: &str)
[src]
fn warn_if_unreachable(&self, id: NodeId, span: Span, kind: &str)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Produce warning on the given node, if the current point in the function is unreachable, and there hasn't been another warning.
pub fn cause(
&self,
span: Span,
code: ObligationCauseCode<'tcx>
) -> ObligationCause<'tcx>
[src]
pub fn cause(
&self,
span: Span,
code: ObligationCauseCode<'tcx>
) -> ObligationCause<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn misc(&self, span: Span) -> ObligationCause<'tcx>
[src]
pub fn misc(&self, span: Span) -> ObligationCause<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn resolve_type_vars_with_obligations(&self, ty: Ty<'tcx>) -> Ty<'tcx>
[src]
fn resolve_type_vars_with_obligations(&self, ty: Ty<'tcx>) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Resolves type variables in ty
if possible. Unlike the infcx
version (resolve_type_vars_if_possible), this version will
also select obligations if it seems useful, in an effort
to get more type information.
fn record_deferred_call_resolution(
&self,
closure_def_id: DefId,
r: DeferredCallResolution<'gcx, 'tcx>
)
[src]
fn record_deferred_call_resolution(
&self,
closure_def_id: DefId,
r: DeferredCallResolution<'gcx, 'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn remove_deferred_call_resolutions(
&self,
closure_def_id: DefId
) -> Vec<DeferredCallResolution<'gcx, 'tcx>>
[src]
fn remove_deferred_call_resolutions(
&self,
closure_def_id: DefId
) -> Vec<DeferredCallResolution<'gcx, 'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn tag(&self) -> String
[src]
pub fn tag(&self) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn local_ty(&self, span: Span, nid: NodeId) -> Ty<'tcx>
[src]
pub fn local_ty(&self, span: Span, nid: NodeId) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn write_ty(&self, id: HirId, ty: Ty<'tcx>)
[src]
pub fn write_ty(&self, id: HirId, ty: Ty<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn write_field_index(&self, node_id: NodeId, index: usize)
[src]
pub fn write_field_index(&self, node_id: NodeId, index: usize)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn write_method_call(&self, hir_id: HirId, method: MethodCallee<'tcx>)
[src]
pub fn write_method_call(&self, hir_id: HirId, method: MethodCallee<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn write_substs(&self, node_id: HirId, substs: &'tcx Substs<'tcx>)
[src]
pub fn write_substs(&self, node_id: HirId, substs: &'tcx Substs<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn apply_adjustments(&self, expr: &Expr, adj: Vec<Adjustment<'tcx>>)
[src]
pub fn apply_adjustments(&self, expr: &Expr, adj: Vec<Adjustment<'tcx>>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn instantiate_type_scheme<T>(
&self,
span: Span,
substs: &Substs<'tcx>,
value: &T
) -> T where
T: TypeFoldable<'tcx>,
[src]
fn instantiate_type_scheme<T>(
&self,
span: Span,
substs: &Substs<'tcx>,
value: &T
) -> T where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Basically whenever we are converting from a type scheme into the fn body space, we always want to normalize associated types as well. This function combines the two.
fn instantiate_bounds(
&self,
span: Span,
def_id: DefId,
substs: &Substs<'tcx>
) -> InstantiatedPredicates<'tcx>
[src]
fn instantiate_bounds(
&self,
span: Span,
def_id: DefId,
substs: &Substs<'tcx>
) -> InstantiatedPredicates<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
As instantiate_type_scheme
, but for the bounds found in a
generic type scheme.
fn instantiate_anon_types_from_return_value<T: TypeFoldable<'tcx>>(
&self,
fn_id: NodeId,
value: &T
) -> T
[src]
fn instantiate_anon_types_from_return_value<T: TypeFoldable<'tcx>>(
&self,
fn_id: NodeId,
value: &T
) -> T
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Replace the anonymized types from the return value of the
function with type variables and records the AnonTypeMap
for
later use during writeback. See
InferCtxt::instantiate_anon_types
for more details.
fn normalize_associated_types_in<T>(&self, span: Span, value: &T) -> T where
T: TypeFoldable<'tcx>,
[src]
fn normalize_associated_types_in<T>(&self, span: Span, value: &T) -> T where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn normalize_associated_types_in_as_infer_ok<T>(
&self,
span: Span,
value: &T
) -> InferOk<'tcx, T> where
T: TypeFoldable<'tcx>,
[src]
fn normalize_associated_types_in_as_infer_ok<T>(
&self,
span: Span,
value: &T
) -> InferOk<'tcx, T> where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn require_type_meets(
&self,
ty: Ty<'tcx>,
span: Span,
code: ObligationCauseCode<'tcx>,
def_id: DefId
)
[src]
pub fn require_type_meets(
&self,
ty: Ty<'tcx>,
span: Span,
code: ObligationCauseCode<'tcx>,
def_id: DefId
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn require_type_is_sized(
&self,
ty: Ty<'tcx>,
span: Span,
code: ObligationCauseCode<'tcx>
)
[src]
pub fn require_type_is_sized(
&self,
ty: Ty<'tcx>,
span: Span,
code: ObligationCauseCode<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn register_bound(
&self,
ty: Ty<'tcx>,
def_id: DefId,
cause: ObligationCause<'tcx>
)
[src]
pub fn register_bound(
&self,
ty: Ty<'tcx>,
def_id: DefId,
cause: ObligationCause<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn to_ty(&self, ast_t: &Ty) -> Ty<'tcx>
[src]
pub fn to_ty(&self, ast_t: &Ty) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn node_ty(&self, id: HirId) -> Ty<'tcx>
[src]
pub fn node_ty(&self, id: HirId) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn register_wf_obligation(
&self,
ty: Ty<'tcx>,
span: Span,
code: ObligationCauseCode<'tcx>
)
[src]
pub fn register_wf_obligation(
&self,
ty: Ty<'tcx>,
span: Span,
code: ObligationCauseCode<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Registers an obligation for checking later, during regionck, that the type ty
must
outlive the region r
.
pub fn add_wf_bounds(&self, substs: &Substs<'tcx>, expr: &Expr)
[src]
pub fn add_wf_bounds(&self, substs: &Substs<'tcx>, expr: &Expr)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Registers obligations that all types appearing in substs
are well-formed.
pub fn add_obligations_for_parameters(
&self,
cause: ObligationCause<'tcx>,
predicates: &InstantiatedPredicates<'tcx>
)
[src]
pub fn add_obligations_for_parameters(
&self,
cause: ObligationCause<'tcx>,
predicates: &InstantiatedPredicates<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given a fully substituted set of bounds (generic_bounds
), and the values with which each
type/region parameter was instantiated (substs
), creates and registers suitable
trait/region obligations.
For example, if there is a function:
fn foo<'a,T:'a>(...)
and a reference:
let f = foo;
Then we will create a fresh region variable '$0
and a fresh type variable $1
for 'a
and T
. This routine will add a region obligation $1:'$0
and register it locally.
pub fn field_ty(
&self,
span: Span,
field: &'tcx FieldDef,
substs: &Substs<'tcx>
) -> Ty<'tcx>
[src]
pub fn field_ty(
&self,
span: Span,
field: &'tcx FieldDef,
substs: &Substs<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_casts(&self)
[src]
fn check_casts(&self)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn resolve_generator_interiors(&self, def_id: DefId)
[src]
fn resolve_generator_interiors(&self, def_id: DefId)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn fallback_if_possible(&self, ty: Ty<'tcx>) -> bool
[src]
fn fallback_if_possible(&self, ty: Ty<'tcx>) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn select_all_obligations_or_error(&self)
[src]
fn select_all_obligations_or_error(&self)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn select_obligations_where_possible(&self, fallback_has_occurred: bool)
[src]
fn select_obligations_where_possible(&self, fallback_has_occurred: bool)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Select as many obligations as we can at present.
fn is_place_expr(&self, expr: &Expr) -> bool
[src]
fn is_place_expr(&self, expr: &Expr) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn make_overloaded_place_return_type(
&self,
method: MethodCallee<'tcx>
) -> TypeAndMut<'tcx>
[src]
fn make_overloaded_place_return_type(
&self,
method: MethodCallee<'tcx>
) -> TypeAndMut<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
For the overloaded place expressions (*x
, x[3]
), the trait
returns a type of &T
, but the actual type we assign to the
expression is T
. So this function just peels off the return
type by one layer to yield T
.
fn lookup_indexing(
&self,
expr: &Expr,
base_expr: &'gcx Expr,
base_ty: Ty<'tcx>,
idx_ty: Ty<'tcx>,
needs: Needs
) -> Option<(Ty<'tcx>, Ty<'tcx>)>
[src]
fn lookup_indexing(
&self,
expr: &Expr,
base_expr: &'gcx Expr,
base_ty: Ty<'tcx>,
idx_ty: Ty<'tcx>,
needs: Needs
) -> Option<(Ty<'tcx>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn try_index_step(
&self,
expr: &Expr,
base_expr: &Expr,
autoderef: &Autoderef<'a, 'gcx, 'tcx>,
needs: Needs,
index_ty: Ty<'tcx>
) -> Option<(Ty<'tcx>, Ty<'tcx>)>
[src]
fn try_index_step(
&self,
expr: &Expr,
base_expr: &Expr,
autoderef: &Autoderef<'a, 'gcx, 'tcx>,
needs: Needs,
index_ty: Ty<'tcx>
) -> Option<(Ty<'tcx>, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
To type-check base_expr[index_expr]
, we progressively autoderef
(and otherwise adjust) base_expr
, looking for a type which either
supports builtin indexing or overloaded indexing.
This loop implements one step in that search; the autoderef loop
is implemented by lookup_indexing
.
fn resolve_place_op(&self, op: PlaceOp, is_mut: bool) -> (Option<DefId>, Ident)
[src]
fn resolve_place_op(&self, op: PlaceOp, is_mut: bool) -> (Option<DefId>, Ident)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn try_overloaded_place_op(
&self,
span: Span,
base_ty: Ty<'tcx>,
arg_tys: &[Ty<'tcx>],
needs: Needs,
op: PlaceOp
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>>
[src]
fn try_overloaded_place_op(
&self,
span: Span,
base_ty: Ty<'tcx>,
arg_tys: &[Ty<'tcx>],
needs: Needs,
op: PlaceOp
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_method_argument_types(
&self,
sp: Span,
expr_sp: Span,
method: Result<MethodCallee<'tcx>, ()>,
args_no_rcvr: &'gcx [Expr],
tuple_arguments: TupleArgumentsFlag,
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
fn check_method_argument_types(
&self,
sp: Span,
expr_sp: Span,
method: Result<MethodCallee<'tcx>, ()>,
args_no_rcvr: &'gcx [Expr],
tuple_arguments: TupleArgumentsFlag,
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_argument_types(
&self,
sp: Span,
expr_sp: Span,
fn_inputs: &[Ty<'tcx>],
expected_arg_tys: &[Ty<'tcx>],
args: &'gcx [Expr],
variadic: bool,
tuple_arguments: TupleArgumentsFlag,
def_span: Option<Span>
)
[src]
fn check_argument_types(
&self,
sp: Span,
expr_sp: Span,
fn_inputs: &[Ty<'tcx>],
expected_arg_tys: &[Ty<'tcx>],
args: &'gcx [Expr],
variadic: bool,
tuple_arguments: TupleArgumentsFlag,
def_span: Option<Span>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Generic function that factors out common logic from function calls, method calls and overloaded operators.
fn err_args(&self, len: usize) -> Vec<Ty<'tcx>>
[src]
fn err_args(&self, len: usize) -> Vec<Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_lit(&self, lit: &Lit, expected: Expectation<'tcx>) -> Ty<'tcx>
[src]
fn check_lit(&self, lit: &Lit, expected: Expectation<'tcx>) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_eq_type(&self, expr: &'gcx Expr, expected: Ty<'tcx>)
[src]
fn check_expr_eq_type(&self, expr: &'gcx Expr, expected: Ty<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_expr_has_type_or_error(
&self,
expr: &'gcx Expr,
expected: Ty<'tcx>
) -> Ty<'tcx>
[src]
pub fn check_expr_has_type_or_error(
&self,
expr: &'gcx Expr,
expected: Ty<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_meets_expectation_or_error(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
fn check_expr_meets_expectation_or_error(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_coercable_to_type(
&self,
expr: &'gcx Expr,
expected: Ty<'tcx>
) -> Ty<'tcx>
[src]
fn check_expr_coercable_to_type(
&self,
expr: &'gcx Expr,
expected: Ty<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_with_hint(&self, expr: &'gcx Expr, expected: Ty<'tcx>) -> Ty<'tcx>
[src]
fn check_expr_with_hint(&self, expr: &'gcx Expr, expected: Ty<'tcx>) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_with_expectation(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
fn check_expr_with_expectation(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr(&self, expr: &'gcx Expr) -> Ty<'tcx>
[src]
fn check_expr(&self, expr: &'gcx Expr) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_with_needs(&self, expr: &'gcx Expr, needs: Needs) -> Ty<'tcx>
[src]
fn check_expr_with_needs(&self, expr: &'gcx Expr, needs: Needs) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn impl_self_ty(&self, span: Span, did: DefId) -> TypeAndSubsts<'tcx>
[src]
pub fn impl_self_ty(&self, span: Span, did: DefId) -> TypeAndSubsts<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn expected_inputs_for_expected_output(
&self,
call_span: Span,
expected_ret: Expectation<'tcx>,
formal_ret: Ty<'tcx>,
formal_args: &[Ty<'tcx>]
) -> Vec<Ty<'tcx>>
[src]
fn expected_inputs_for_expected_output(
&self,
call_span: Span,
expected_ret: Expectation<'tcx>,
formal_ret: Ty<'tcx>,
formal_args: &[Ty<'tcx>]
) -> Vec<Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Unifies the output type with the expected type early, for more coercions and forward type information on the input expressions.
fn check_method_call(
&self,
expr: &'gcx Expr,
segment: &PathSegment,
span: Span,
args: &'gcx [Expr],
expected: Expectation<'tcx>,
needs: Needs
) -> Ty<'tcx>
[src]
fn check_method_call(
&self,
expr: &'gcx Expr,
segment: &PathSegment,
span: Span,
args: &'gcx [Expr],
expected: Expectation<'tcx>,
needs: Needs
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_return_expr(&self, return_expr: &'gcx Expr)
[src]
fn check_return_expr(&self, return_expr: &'gcx Expr)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_then_else(
&self,
cond_expr: &'gcx Expr,
then_expr: &'gcx Expr,
opt_else_expr: Option<&'gcx Expr>,
sp: Span,
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
fn check_then_else(
&self,
cond_expr: &'gcx Expr,
then_expr: &'gcx Expr,
opt_else_expr: Option<&'gcx Expr>,
sp: Span,
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_field(
&self,
expr: &'gcx Expr,
needs: Needs,
base: &'gcx Expr,
field: Ident
) -> Ty<'tcx>
[src]
fn check_field(
&self,
expr: &'gcx Expr,
needs: Needs,
base: &'gcx Expr,
field: Ident
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn available_field_names(&self, variant: &'tcx VariantDef) -> Vec<Name>
[src]
fn available_field_names(&self, variant: &'tcx VariantDef) -> Vec<Name>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn name_series_display(&self, names: Vec<Name>) -> String
[src]
fn name_series_display(&self, names: Vec<Name>) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn no_such_field_err<T: Display>(
&self,
span: Span,
field: T,
expr_t: &TyS
) -> DiagnosticBuilder
[src]
fn no_such_field_err<T: Display>(
&self,
span: Span,
field: T,
expr_t: &TyS
) -> DiagnosticBuilder
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn report_unknown_field(
&self,
ty: Ty<'tcx>,
variant: &'tcx VariantDef,
field: &Field,
skip_fields: &[Field],
kind_name: &str
)
[src]
fn report_unknown_field(
&self,
ty: Ty<'tcx>,
variant: &'tcx VariantDef,
field: &Field,
skip_fields: &[Field],
kind_name: &str
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_struct_fields(
&self,
adt_ty: Ty<'tcx>,
expected: Expectation<'tcx>,
expr_id: NodeId,
span: Span,
variant: &'tcx VariantDef,
ast_fields: &'gcx [Field],
check_completeness: bool
) -> bool
[src]
fn check_expr_struct_fields(
&self,
adt_ty: Ty<'tcx>,
expected: Expectation<'tcx>,
expr_id: NodeId,
span: Span,
variant: &'tcx VariantDef,
ast_fields: &'gcx [Field],
check_completeness: bool
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_struct_fields_on_error(
&self,
fields: &'gcx [Field],
base_expr: &'gcx Option<P<Expr>>
)
[src]
fn check_struct_fields_on_error(
&self,
fields: &'gcx [Field],
base_expr: &'gcx Option<P<Expr>>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_struct_path(
&self,
qpath: &QPath,
node_id: NodeId
) -> Option<(&'tcx VariantDef, Ty<'tcx>)>
[src]
pub fn check_struct_path(
&self,
qpath: &QPath,
node_id: NodeId
) -> Option<(&'tcx VariantDef, Ty<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_struct(
&self,
expr: &Expr,
expected: Expectation<'tcx>,
qpath: &QPath,
fields: &'gcx [Field],
base_expr: &'gcx Option<P<Expr>>
) -> Ty<'tcx>
[src]
fn check_expr_struct(
&self,
expr: &Expr,
expected: Expectation<'tcx>,
qpath: &QPath,
fields: &'gcx [Field],
base_expr: &'gcx Option<P<Expr>>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_expr_with_expectation_and_needs(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>,
needs: Needs
) -> Ty<'tcx>
[src]
fn check_expr_with_expectation_and_needs(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>,
needs: Needs
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Invariant:
If an expression has any sub-expressions that result in a type error,
inspecting that expression's type with ty.references_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 TyError
, so avoid
that when err needs to be handled differently.
fn check_expr_kind(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>,
needs: Needs
) -> Ty<'tcx>
[src]
fn check_expr_kind(
&self,
expr: &'gcx Expr,
expected: Expectation<'tcx>,
needs: Needs
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn finish_resolving_struct_path(
&self,
qpath: &QPath,
path_span: Span,
node_id: NodeId
) -> (Def, Ty<'tcx>)
[src]
fn finish_resolving_struct_path(
&self,
qpath: &QPath,
path_span: Span,
node_id: NodeId
) -> (Def, Ty<'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn resolve_ty_and_def_ufcs<'b>(
&self,
qpath: &'b QPath,
node_id: NodeId,
span: Span
) -> (Def, Option<Ty<'tcx>>, &'b [PathSegment])
[src]
pub fn resolve_ty_and_def_ufcs<'b>(
&self,
qpath: &'b QPath,
node_id: NodeId,
span: Span
) -> (Def, Option<Ty<'tcx>>, &'b [PathSegment])
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_decl_initializer(
&self,
local: &'gcx Local,
init: &'gcx Expr
) -> Ty<'tcx>
[src]
pub fn check_decl_initializer(
&self,
local: &'gcx Local,
init: &'gcx Expr
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_decl_local(&self, local: &'gcx Local)
[src]
pub fn check_decl_local(&self, local: &'gcx Local)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_stmt(&self, stmt: &'gcx Stmt)
[src]
pub fn check_stmt(&self, stmt: &'gcx Stmt)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn check_block_no_value(&self, blk: &'gcx Block)
[src]
pub fn check_block_no_value(&self, blk: &'gcx Block)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_block_with_expected(
&self,
blk: &'gcx Block,
expected: Expectation<'tcx>
) -> Ty<'tcx>
[src]
fn check_block_with_expected(
&self,
blk: &'gcx Block,
expected: Expectation<'tcx>
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn get_fn_decl(&self, blk_id: NodeId) -> Option<(FnDecl, bool)>
[src]
pub fn get_fn_decl(&self, blk_id: NodeId) -> Option<(FnDecl, bool)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given a NodeId
, return the FnDecl
of the method it is enclosed by and whether a
suggestion can be made, None
otherwise.
pub fn suggest_mismatched_types_on_tail(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expression: &'gcx Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,
cause_span: Span,
blk_id: NodeId
)
[src]
pub fn suggest_mismatched_types_on_tail(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expression: &'gcx Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,
cause_span: Span,
blk_id: NodeId
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
On implicit return expressions with mismatched types, provide the following suggestions:
- Point out the method's return type as the reason for the expected type
- Possible missing semicolon
- Possible missing return type if the return type is the default, and not
fn main()
pub fn suggest_ref_or_into(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expr: &Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>
)
[src]
pub fn suggest_ref_or_into(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expr: &Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn suggest_missing_semicolon(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expression: &'gcx Expr,
expected: Ty<'tcx>,
cause_span: Span
)
[src]
fn suggest_missing_semicolon(
&self,
err: &mut DiagnosticBuilder<'tcx>,
expression: &'gcx Expr,
expected: Ty<'tcx>,
cause_span: Span
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A common error is to forget to add a semicolon at the end of a block:
fn foo() { bar_that_returns_u32() }
This routine checks if the return expression in a block would make sense on its own as a
statement and the return type has been left as default or has been specified as ()
. If so,
it suggests adding a semicolon.
fn suggest_missing_return_type(
&self,
err: &mut DiagnosticBuilder<'tcx>,
fn_decl: &FnDecl,
expected: Ty<'tcx>,
found: Ty<'tcx>,
can_suggest: bool
)
[src]
fn suggest_missing_return_type(
&self,
err: &mut DiagnosticBuilder<'tcx>,
fn_decl: &FnDecl,
expected: Ty<'tcx>,
found: Ty<'tcx>,
can_suggest: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A possible error is to forget to add a return type that is needed:
fn foo() { bar_that_returns_u32() }
This routine checks if the return type is left as default, the method is not part of an
impl
block and that it isn't the main
method. If so, it suggests setting the return
type.
fn consider_hint_about_removing_semicolon(
&self,
blk: &'gcx Block,
expected_ty: Ty<'tcx>,
err: &mut DiagnosticBuilder
)
[src]
fn consider_hint_about_removing_semicolon(
&self,
blk: &'gcx Block,
expected_ty: Ty<'tcx>,
err: &mut DiagnosticBuilder
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A common error is to add an extra semicolon:
fn foo() -> usize { 22; }
This routine checks if the final statement in a block is an
expression with an explicit semicolon whose type is compatible
with expected_ty
. If so, it suggests removing the semicolon.
pub fn instantiate_value_path(
&self,
segments: &[PathSegment],
opt_self_ty: Option<Ty<'tcx>>,
def: Def,
span: Span,
node_id: NodeId
) -> Ty<'tcx>
[src]
pub fn instantiate_value_path(
&self,
segments: &[PathSegment],
opt_self_ty: Option<Ty<'tcx>>,
def: Def,
span: Span,
node_id: NodeId
) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_rustc_args_require_const(
&self,
def_id: DefId,
node_id: NodeId,
span: Span
)
[src]
fn check_rustc_args_require_const(
&self,
def_id: DefId,
node_id: NodeId,
span: Span
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_generic_arg_count(
&self,
span: Span,
segment: &mut Option<(&PathSegment, &Generics)>,
is_method_call: bool,
supress_mismatch_error: bool
)
[src]
fn check_generic_arg_count(
&self,
span: Span,
segment: &mut Option<(&PathSegment, &Generics)>,
is_method_call: bool,
supress_mismatch_error: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Report errors if the provided parameters are too few or too many.
fn check_impl_trait(
&self,
span: Span,
segment: Option<(&PathSegment, &Generics)>
) -> bool
[src]
fn check_impl_trait(
&self,
span: Span,
segment: Option<(&PathSegment, &Generics)>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Report error if there is an explicit type parameter when using impl Trait
.
pub fn structurally_resolved_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx>
[src]
pub fn structurally_resolved_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn with_breakable_ctxt<F: FnOnce() -> R, R>(
&self,
id: NodeId,
ctxt: BreakableCtxt<'gcx, 'tcx>,
f: F
) -> (BreakableCtxt<'gcx, 'tcx>, R)
[src]
fn with_breakable_ctxt<F: FnOnce() -> R, R>(
&self,
id: NodeId,
ctxt: BreakableCtxt<'gcx, 'tcx>,
f: F
) -> (BreakableCtxt<'gcx, 'tcx>, R)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?