Skip to main content

Module op

Module op 

Source
Expand description

Code related to processing overloaded binary and unary operators.

Re-exportsยง

use rustc_ast as ast; ๐Ÿ”’
use rustc_ast::AssignOp; ๐Ÿ”’
use rustc_ast::BinOp; ๐Ÿ”’
use rustc_data_structures::packed::Pu128; ๐Ÿ”’
use rustc_data_structures::thin_vec::ThinVec; ๐Ÿ”’
use rustc_data_structures::thin_vec::thin_vec; ๐Ÿ”’
use rustc_errors::Applicability; ๐Ÿ”’
use rustc_errors::Diag; ๐Ÿ”’
use rustc_errors::struct_span_code_err; ๐Ÿ”’
use rustc_hir::def_id::DefId; ๐Ÿ”’
use rustc_hir as hir; ๐Ÿ”’
use rustc_hir::AssignOpKind; ๐Ÿ”’
use rustc_hir::BinOpKind; ๐Ÿ”’
use rustc_hir::Expr; ๐Ÿ”’
use rustc_hir::ExprKind; ๐Ÿ”’
use rustc_infer::traits::ObligationCauseCode; ๐Ÿ”’
use rustc_middle::ty::adjustment::Adjust; ๐Ÿ”’
use rustc_middle::ty::adjustment::Adjustment; ๐Ÿ”’
use rustc_middle::ty::adjustment::AllowTwoPhase; ๐Ÿ”’
use rustc_middle::ty::adjustment::AutoBorrow; ๐Ÿ”’
use rustc_middle::ty::adjustment::AutoBorrowMutability; ๐Ÿ”’
use rustc_middle::ty::print::with_no_trimmed_paths; ๐Ÿ”’
use rustc_middle::ty::print::with_no_trimmed_paths; ๐Ÿ”’
use rustc_middle::ty; ๐Ÿ”’
use rustc_middle::ty::IsSuggestable; ๐Ÿ”’
use rustc_middle::ty::Ty; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_middle::ty::TypeVisitableExt; ๐Ÿ”’
use rustc_span::Span; ๐Ÿ”’
use rustc_span::Spanned; ๐Ÿ”’
use rustc_span::Symbol; ๐Ÿ”’
use rustc_span::bug; ๐Ÿ”’
use rustc_span::sym; ๐Ÿ”’
use rustc_trait_selection::infer::InferCtxtExt; ๐Ÿ”’
use rustc_trait_selection::traits::FulfillmentError; ๐Ÿ”’
use rustc_trait_selection::traits::Obligation; ๐Ÿ”’
use rustc_trait_selection::traits::ObligationCtxt; ๐Ÿ”’
use tracing::debug; ๐Ÿ”’
use super::FnCtxt; ๐Ÿ”’
use super::method::MethodCallee; ๐Ÿ”’
use crate::diagnostics::ExprParenthesesNeeded; ๐Ÿ”’
use crate::method::TreatNotYetDefinedOpaques; ๐Ÿ”’
use crate::Expectation; ๐Ÿ”’
use crate::diagnostics; ๐Ÿ”’
use rustc_errors::codes::*; ๐Ÿ”’

Enumsยง

BinOpCategory ๐Ÿ”’
Op ๐Ÿ”’
An assignment op (e.g. a += b), or a binary op (e.g. a + b).

Functionsยง

contains_let_in_chain ๐Ÿ”’
Check if expr contains a let or &&, indicating presence of a let-chain
deref_ty_if_possible ๐Ÿ”’
Dereferences a single level of immutable referencing.
is_builtin_binop ๐Ÿ”’
Returns true if this is a built-in arithmetic operation (e.g., u32 + u32) and false if these types would have to be overloaded to be legal. The reason that we distinguish builtin operations from overloaded ones (vs trying to drive everything uniformly through the trait system and intrinsics or something like that) is that builtin operations can trivially be evaluated in constants on stable, but the traits and their impls for these primitive types.
lang_item_for_binop ๐Ÿ”’
lang_item_for_unop ๐Ÿ”’