10 * @param {stringdex.Hooks} hooks
11 */
12▶const initSearch = async function(Stringdex, RoaringBitmap, hooks) {
13
14// polyfill
· · ·
15// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced
16if (!Array.prototype.toSpliced) {
17▶ // Can't use arrow functions, because we want `this`
18 Array.prototype.toSpliced = function() {
19 const me = this.slice();
· · ·
18▶ Array.prototype.toSpliced = function() {
19 const me = this.slice();
20 // @ts-expect-error
· · ·
28 * @template T
29 * @param {Iterable<T>} arr
30▶ * @param {function(T): Promise<any>} func
31 * @param {function(T): void} funcBtwn
32 */
· · ·
31▶ * @param {function(T): void} funcBtwn
32 */
33async function onEachBtwnAsync(arr, func, funcBtwn) {
+ 277 more matches in this file
30// Assist: inline_into_callers
31//
32▶// Inline a function or method body into all of its callers where possible, creating a `let` statement per parameter
33// unless the parameter can be inlined. The parameter will be inlined either if it the supplied argument is a simple local
34// or if the parameter is only accessed inside the function body once.
· · ·
34▶// or if the parameter is only accessed inside the function body once.
35// If all calls can be inlined the function will be removed.
36//
· · ·
35▶// If all calls can be inlined the function will be removed.
36//
37// ```
· · ·
70 let vfs_def_file = ctx.vfs_file_id();
71 let name = ctx.find_node_at_offset::<ast::Name>()?;
72▶ let ast_func = name.syntax().parent().and_then(ast::Fn::cast)?;
73 let func_body = ast_func.body()?;
74 let param_list = ast_func.param_list()?;
· · ·
73▶ let func_body = ast_func.body()?;
74 let param_list = ast_func.param_list()?;
75
+ 94 more matches in this file
196 // traits are equal, then the associated type bounds (`dyn Trait<Assoc=T>`)
197 // are also equal, which is ensured by the fact that normalization is
198▶ // a function and we do not allow overlapping impls.
199 return old_info;
200 }
· · ·
399) {
400 // this is an info! to allow collecting monomorphization statistics
401▶ // and to allow finding the last function before LLVM aborts from
402 // release builds.
403 info!("codegen_instance({})", instance);
· · ·
457 expr.span,
458 ),
459▶ _ => span_bug!(*op_sp, "asm sym is not a function"),
460 };
461
· · ·
497}
498
499▶/// Creates the `main` function which will initialize the rust runtime and call
500/// users main function.
501pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
· · ·
500▶/// users main function.
501pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
502 cx: &'a Bx::CodegenCx,
+ 45 more matches in this file
29use rustc_span::{FileName, InnerSpan, Span, SpanData};
30use rustc_structures::CrateType;
31▶use rustc_target::spec::{MergeFunctions, SanitizerSet};
32use tracing::debug;
33
· · ·
105 pub vectorize_loop: bool,
106 pub vectorize_slp: bool,
107▶ pub merge_functions: bool,
108 pub emit_lifetime_markers: bool,
109 pub llvm_plugins: Vec<String>,
· · ·
236
237 // Some targets (namely, NVPTX) interact badly with the
238▶ // MergeFunctions pass. This is because MergeFunctions can generate
239 // new function calls which may interfere with the target calling
240 // convention; e.g. for the NVPTX target, PTX kernels should not
· · ·
239▶ // new function calls which may interfere with the target calling
240 // convention; e.g. for the NVPTX target, PTX kernels should not
241 // call other PTX kernels. MergeFunctions can also be configured to
· · ·
241▶ // call other PTX kernels. MergeFunctions can also be configured to
242 // generate aliases instead, but aliases are not supported by some
243 // backends (again, NVPTX). Therefore, allow targets to opt out of
+ 95 more matches in this file
4//! This module is responsible for discovering all items that will contribute
5//! to code generation of the crate. The important part here is that it not only
6▶//! needs to find syntax-level items (functions, structs, etc) but also all
7//! their monomorphized instantiations. Every non-generic, non-const function
8//! maps to one LLVM artifact. Every generic function can produce
· · ·
7▶//! their monomorphized instantiations. Every non-generic, non-const function
8//! maps to one LLVM artifact. Every generic function can produce
9//! from zero to N artifacts, depending on the sets of type arguments it
· · ·
8▶//! maps to one LLVM artifact. Every generic function can produce
9//! from zero to N artifacts, depending on the sets of type arguments it
10//! is instantiated with.
· · ·
15//! The following kinds of "mono items" are handled here:
16//!
17▶//! - Functions
18//! - Methods
19//! - Closures
· · ·
29//! - Object Shims
30//!
31▶//! The main entry point is `collect_crate_mono_items`, at the bottom of this file.
32//!
33//! General Algorithm
+ 50 more matches in this file
116 postfix_snippet("dbg", "dbg!(expr)", format!("dbg!({receiver_text})")).add_to(acc, ctx.db); // fixme
117 postfix_snippet("dbgr", "dbg!(&expr)", format!("dbg!(&{receiver_text})")).add_to(acc, ctx.db);
118▶ postfix_snippet("call", "function(expr)", format!("${{1}}({receiver_text})"))
119 .add_to(acc, ctx.db);
120
· · ·
124 let is_valid_new = expected_ty
125 .iterate_assoc_items(ctx.db, |item| {
126▶ if let hir::AssocItem::Function(func) = item
127 && func.name(ctx.db) == hir::sym::new
128 && !func.has_self_param(ctx.db)
· · ·
127▶ && func.name(ctx.db) == hir::sym::new
128 && !func.has_self_param(ctx.db)
129 {
· · ·
128▶ && !func.has_self_param(ctx.db)
129 {
130 let params = func.params_without_self(ctx.db);
· · ·
130▶ let params = func.params_without_self(ctx.db);
131 if params.len() == 1 {
132 return Some(());
+ 139 more matches in this file
44 AddressOfTemporaryTaken, BaseExpressionDoubleDot, BaseExpressionDoubleDotAddExpr,
45 BaseExpressionDoubleDotRemove, CantDereference, ExprParenthesesNeeded,
46▶ FieldMultiplySpecifiedInInitializer, FunctionalRecordUpdateOnNonStruct, HelpUseLatestEdition,
47 NakedAsmOutsideNakedFn, NoFieldOnVariant, ReturnLikeStatementKind, ReturnStmtOutsideOfFnBody,
48 StructExprNonExhaustive, TypeMismatchFruTypo, YieldExprOutsideOfCoroutine,
· · ·
231 let mut lines = lint_str.lines();
232 if let Some(line0) = lines.next() {
233▶ let remaining_lines = lines.count();
234 debug!("expr text: {line0}");
235 debug!("expr text: ...(and {remaining_lines} more lines)");
· · ·
235▶ debug!("expr text: ...(and {remaining_lines} more lines)");
236 }
237 }
· · ·
260
261 if self.is_whole_body.replace(false) {
262▶ // If this expression is the whole body and the function diverges because of its
263 // arguments, we check this here to ensure the body is considered to diverge.
264 self.diverges.set(self.function_diverges_because_of_empty_arguments.get())
· · ·
264▶ self.diverges.set(self.function_diverges_because_of_empty_arguments.get())
265 };
266
+ 52 more matches in this file
3
4pub(crate) mod const_;
5▶pub(crate) mod function;
6pub(crate) mod literal;
7pub(crate) mod macro_;
· · ·
29 item::{Builder, CompletionRelevanceTypeMatch},
30 render::{
31▶ function::render_fn,
32 literal::render_variant_lit,
33 macro_::{render_macro, render_macro_pat},
· · ·
100 ///
101 /// In order to be able to check for the latter, we'd ideally want to `try_as_dyn<_, dyn AsAssocItem>(def)`
102▶ /// (see [`try_as_dyn`][]), but that function is currently unstable. Therefore, we employ a hack instead:
103 /// if `def` can be an assoc item, it should be passed to this method as follows:
104 /// ```ignore
· · ·
169 let mut builder = TextEdit::builder();
170 // Using TextEdit, insert '(' before the struct name and ')' before the
171▶ // dot access, then comes the field name and optionally insert function
172 // call parens.
173
· · ·
381) -> Option<hir::Name> {
382 Some(match resolution {
383▶ ScopeDef::ModuleDef(hir::ModuleDef::Function(f)) => f.name(ctx.completion.db),
384 ScopeDef::ModuleDef(hir::ModuleDef::Const(c)) => c.name(ctx.completion.db)?,
385 ScopeDef::ModuleDef(hir::ModuleDef::TypeAlias(t)) => t.name(ctx.completion.db),
+ 182 more matches in this file
141 it.declaration_source_range(db).map(|src| src.file_id)
142 }
143▶ Definition::Function(it) => it.source(db).map(|src| src.file_id),
144 _ => None,
145 };
· · ·
155 let runnable = match def {
156 Definition::Module(it) => runnable_mod(&sema, it),
157▶ Definition::Function(it) => runnable_fn(&sema, it),
158 Definition::SelfType(impl_) => runnable_impl(&sema, &impl_),
159 _ => None,
· · ·
163 impl_.items(db).into_iter().for_each(|assoc| {
164 let runnable = match assoc {
165▶ hir::AssocItem::Function(it) => {
166 runnable_fn(&sema, it).or_else(|| module_def_doctest(&sema, it.into()))
167 }
· · ·
295fn as_test_runnable(sema: &Semantics<'_, RootDatabase>, fn_def: &ast::Fn) -> Option<Runnable> {
296 if test_related_attribute_syn(fn_def).is_some() {
297▶ let function = sema.to_def(fn_def)?;
298 runnable_fn(sema, function)
299 } else {
· · ·
298▶ runnable_fn(sema, function)
299 } else {
300 None
+ 78 more matches in this file
1▶//! Renaming functionality.
2//!
3//! This is mostly front-end for [`ide_db::rename`], but it also includes the
· · ·
4//! tests. This module also implements a couple of magic tricks, like renaming
5▶//! `self` and to `self` (to switch between associated function and method).
6
7use hir::{AsAssocItem, FindPathConfig, HasContainer, HirDisplay, InFile, Name, Semantics, sym};
· · ·
71}
72
73▶/// Prepares a rename. The sole job of this function is to return the TextRange of the thing that is
74/// being targeted for a rename.
75pub(crate) fn prepare_rename(
· · ·
130// and rust-analyzer will automatically add the new lifetime to the list of generic parameters.
131// - **`self` renames**. You can rename parameters to/from `self`. Renaming `self` into another name will update
132▶// all callers using method syntax to call the function like an associated function. Renaming to `self` is only
133// supported for the first parameter inside an `impl` and when the `Self` type matches the type of the parameter,
134// and will update callers to use method call syntax.
· · ·
412 sema: &Semantics<'_, RootDatabase>,
413 source_change: &mut SourceChange,
414▶ f: hir::Function,
415) {
416 let calls = Definition::Function(f).usages(sema).all();
+ 74 more matches in this file
16use rustc_resolve::rustdoc::pulldown_cmark::{BrokenLink, CodeBlockKind, CowStr, Options, TagEnd};
17use rustc_resolve::rustdoc::{
18▶ DocFragment, add_doc_fragment, attrs_to_doc_fragments, main_body_opts, pulldown_cmark,
19 source_span_for_markdown_range, span_of_fragments,
20};
· · ·
32mod markdown;
33mod missing_headers;
34▶mod needless_doctest_main;
35mod suspicious_doc_comments;
36mod test_attr_in_doctest;
· · ·
77 /// The two replacement dots (`··`) in this example represent a double space.
78 /// ```no_run
79▶ /// /// This function adds two numbers and returns the result··
80 /// /// Overflow can occur when the max value is exceeded.
81 /// fn add(l: i32, r: i32) -> i32 {
· · ·
86 /// Use instead:
87 /// ```no_run
88▶ /// /// This function adds two numbers and returns the result\
89 /// /// Overflow can occur when the max value is exceeded.
90 /// fn add(l: i32, r: i32) -> i32 {
· · ·
263 /// /// [`SmallVec<[T; INLINE_CAPACITY]>`][SmallVec].
264 /// /// [SmallVec]: SmallVec
265▶ /// fn main() {}
266 /// ```
267 #[clippy::version = "pre 1.29.0"]
+ 33 more matches in this file
1//! Logic for transforming the raw code given by the user into something actually
2▶//! runnable, e.g. by adding a `main` function if it doesn't already exist.
3
4use std::fmt::{self, Write as _};
· · ·
27#[derive(Default)]
28struct ParseSourceInfo {
29▶ has_main_fn: bool,
30 already_has_extern_crate: bool,
31 supports_color: bool,
· · ·
139
140 let Ok(Ok(ParseSourceInfo {
141▶ has_main_fn,
142 already_has_extern_crate,
143 supports_color,
· · ·
188 DocTestBuilder {
189 supports_color,
190▶ has_main_fn,
191 global_crate_attrs,
192 crate_attrs,
· · ·
207 pub(crate) supports_color: bool,
208 pub(crate) already_has_extern_crate: bool,
209▶ pub(crate) has_main_fn: bool,
210 pub(crate) global_crate_attrs: Vec<String>,
211 pub(crate) crate_attrs: String,
+ 29 more matches in this file
1▶//! This module provides primitives for showing type and function parameter information when editing
2//! a call or use-site.
3
· · ·
173 let mut fn_params = None;
174 match callable.kind() {
175▶ hir::CallableKind::Function(func) => {
176 res.doc = func.docs(db).map(Documentation::into_owned);
177 if func.is_const(db) {
· · ·
176▶ res.doc = func.docs(db).map(Documentation::into_owned);
177 if func.is_const(db) {
178 format_to!(res.signature, "const ");
· · ·
177▶ if func.is_const(db) {
178 format_to!(res.signature, "const ");
179 }
· · ·
180▶ if func.is_async(db) {
181 format_to!(res.signature, "async ");
182 }
+ 80 more matches in this file
181 sema: &Semantics<'_, RootDatabase>,
182 node: &SyntaxNode,
183▶) -> Option<hir::Function> {
184 let node = ast::TryExpr::cast(node.clone())?;
185 let try_expr_ty = sema.type_of_expr(&node.expr()?)?.adjusted();
· · ·
207
208 let from_trait = fd.core_convert_From()?;
209▶ let from_fn = from_trait.function(sema.db, sym::from)?;
210 sema.resolve_trait_impl_method(
211 returned_err_ty.clone(),
· · ·
223 let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?;
224 let callable = sema.resolve_method_call_as_callable(&method_call)?;
225▶ let CallableKind::Function(f) = callable.kind() else { return None };
226 let assoc = f.as_assoc_item(sema.db)?;
227
· · ·
235 {
236 let t = fd.core_convert_FromStr()?;
237▶ let t_f = t.function(sema.db, &sym::from_str)?;
238 return sema
239 .resolve_trait_impl_method(
· · ·
251 let f = if fn_name == sym::into && fd.core_convert_Into() == Some(t) {
252 let dual = fd.core_convert_From()?;
253▶ let dual_f = dual.function(sema.db, &sym::from)?;
254 sema.resolve_trait_impl_method(
255 return_type.clone(),
+ 81 more matches in this file
128/// with the `rustc_private` feature. This is intended for use when
129/// compiling library and `rustc_*` crates themselves so we can leverage crates.io
130▶/// while maintaining the invariant that all sysroot crates are unstable
131/// by default and are unable to be used.
132const FORCE_UNSTABLE: Stability = Stability {
· · ·
238 {
239 const_stab = Some(ConstStability {
240▶ // We subject these implicitly-const functions to recursive const stability.
241 const_stable_indirect: true,
242 promotable: false,
· · ·
383 }
384
385▶ // If the current node is a function with const stability attributes (directly given or
386 // implied), check if the function/method is const or the parent impl block is const.
387 let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
· · ·
386▶ // implied), check if the function/method is const or the parent impl block is const.
387 let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
388 if let Some(fn_sig) = fn_sig
· · ·
929
930 fn visit_ty(&mut self, t: &'tcx Ty<'tcx, AmbigArg>) {
931▶ if let TyKind::FnPtr(function) = t.kind {
932 if extern_abi_stability(function.abi).is_err() {
933 self.fully_stable = false;
+ 32 more matches in this file
303 or some other example.
304
305▶ * Struct/enum/const/static/impl definitions nested in a function do not mention the function name.
306 See #18771.
307
· · ·
398 SymbolInformationKind::EnumMember => ScipKind::EnumMember,
399 SymbolInformationKind::Field => ScipKind::Field,
400▶ SymbolInformationKind::Function => ScipKind::Function,
401 SymbolInformationKind::Macro => ScipKind::Macro,
402 SymbolInformationKind::Method => ScipKind::Method,
· · ·
592 check_symbol(
593 r#"
594▶//- /workspace/lib.rs crate:main deps:foo
595use foo::example_mod::func;
596fn main() {
· · ·
595▶use foo::example_mod::func;
596fn main() {
597 func$0();
· · ·
596▶fn main() {
597 func$0();
598}
+ 63 more matches in this file
3//! This module contains basic methods to manipulate the contents of the local
4//! filesystem. All methods in this module represent cross-platform filesystem
5▶//! operations. Extra platform-specific functionality can be found in the
6//! extension traits of `std::os::$platform`.
7//!
· · ·
72/// use std::io::prelude::*;
73///
74▶/// fn main() -> std::io::Result<()> {
75/// let mut file = File::create("foo.txt")?;
76/// file.write_all(b"Hello, world!")?;
· · ·
85/// use std::io::prelude::*;
86///
87▶/// fn main() -> std::io::Result<()> {
88/// let mut file = File::open("foo.txt")?;
89/// let mut contents = String::new();
· · ·
101/// use std::io::prelude::*;
102///
103▶/// fn main() -> std::io::Result<()> {
104/// let file = File::open("foo.txt")?;
105/// let mut buf_reader = BufReader::new(file);
· · ·
160/// # Platform-specific behavior
161///
162▶/// On supported systems (including Windows and some UNIX-based OSes), this function acquires a
163/// handle/file descriptor for the directory. This allows functions like [`Dir::open_file`] to
164/// avoid [TOCTOU] errors when the directory itself is being moved.
+ 247 more matches in this file
29
30 let (callable, arg_list) = get_callable(sema, &expr)?;
31▶ let unary_function = callable.n_params() == 1;
32 let function_name = match callable.kind() {
33 hir::CallableKind::Function(function) => Some(function.name(sema.db)),
· · ·
32▶ let function_name = match callable.kind() {
33 hir::CallableKind::Function(function) => Some(function.name(sema.db)),
34 _ => None,
· · ·
33▶ hir::CallableKind::Function(function) => Some(function.name(sema.db)),
34 _ => None,
35 };
· · ·
36▶ let function_name = function_name.as_ref().map(|it| it.as_str());
37 let hints = callable
38 .params()
· · ·
52 !should_hide_param_name_hint(
53 sema,
54▶ unary_function,
55 function_name,
56 param_name.as_str(),
+ 39 more matches in this file
425
426 // We should handle `return` separately, because when it is used in a `try` block,
427▶ // it will exit the outside function instead of the block itself.
428 WalkExpandedExprCtx::new(sema)
429 .with_check_ctx(&WalkExpandedExprCtx::is_async_const_block_or_closure)
· · ·
875 r#"
876fn foo() {
877▶ unsafe fn this_is_unsafe_function() {}
878
879 unsa$0fe {
· · ·
887 //^^^^^^^^
888
889▶ this_is_unsafe_function();
890 //^^^^^^^^^^^^^^^^^^^^^^^^^
891 }
· · ·
941 check(
942 r#"
943▶//- /main.rs crate:main deps:lib
944use lib$0;
945 //^^^ import
· · ·
1644struct Struct { field: u32 }
1645 //^^^^^
1646▶fn function(field: u32) {
1647 //^^^^^
1648 Struct { field$0 }
+ 32 more matches in this file
45/// Signals whether parsing a type should recover `->`.
46///
47▶/// More specifically, when parsing a function like:
48/// ```compile_fail
49/// fn foo() => u8 { 0 }
· · ·
137 }
138
139▶ /// Parse a type suitable for a function or function pointer parameter.
140 /// The difference from `parse_ty` is that this version allows `...`
141 /// (`CVarArgs`) at the top level of the type.
· · ·
177 ///
178 /// Example 1: `&'a TYPE`
179▶ /// `+` is prohibited to maintain operator priority (P(+) < P(&)).
180 /// Example 2: `value1 as TYPE + value2`
181 /// `+` is prohibited to avoid interactions with expression grammar.
· · ·
228 }
229
230▶ /// Parses an optional return type `[ -> TY ]` in a function declaration.
231 pub(super) fn parse_ret_ty(
232 &mut self,
· · ·
331 TyKind::Infer
332 } else if self.check_fn_front_matter(false, Case::Sensitive) {
333▶ // Function pointer type
334 self.parse_ty_fn_ptr(lo, ThinVec::new(), None, recover_return_sign)?
335 } else if self.check_keyword(exp!(For)) {
+ 17 more matches in this file
72//
73// Shows all references of the item at the cursor location. This includes:
74▶// - Direct references to variables, functions, types, etc.
75// - Constructor/initialization references when cursor is on struct/enum definition tokens
76// - References in patterns and type contexts
· · ·
419
420/// Checks if a path ends with the given name reference.
421▶/// Helper function for checking constructor usage patterns.
422fn path_ends_with(path: Option<ast::Path>, name_ref: &ast::NameRef) -> bool {
423 path.and_then(|path| path.segment())
· · ·
493 check_with_filters(
494 r#"
495▶fn test_func() {}
496
497fn func() {
· · ·
497▶fn func() {
498 test_func$0();
499}
· · ·
498▶ test_func$0();
499}
500
+ 126 more matches in this file
274/// All path separators recognized on the current platform, represented as [`char`]s; for example,
275/// this is `&['/'][..]` on Unix and `&['\\', '/'][..]` on Windows. The [primary
276▶/// separator](MAIN_SEPARATOR) is always element 0 of the slice.
277#[unstable(feature = "const_path_separators", issue = "153106")]
278pub const SEPARATORS: &[char] = crate::sys::path::SEPARATORS;
· · ·
280/// All path separators recognized on the current platform, represented as [`&str`]s; for example,
281/// this is `&["/"][..]` on Unix and `&["\\", "/"][..]` on Windows. The [primary
282▶/// separator](MAIN_SEPARATOR_STR) is always element 0 of the slice.
283#[unstable(feature = "const_path_separators", issue = "153106")]
284pub const SEPARATORS_STR: &[&str] = crate::sys::path::SEPARATORS_STR;
· · ·
287/// for example, this is `'/'` on Unix and `'\\'` on Windows.
288#[stable(feature = "rust1", since = "1.0.0")]
289▶#[cfg_attr(not(test), rustc_diagnostic_item = "path_main_separator")]
290pub const MAIN_SEPARATOR: char = SEPARATORS[0];
291
· · ·
290▶pub const MAIN_SEPARATOR: char = SEPARATORS[0];
291
292/// The primary separator of path components for the current platform, represented as a [`&str`];
· · ·
293/// for example, this is `"/"` on Unix and `"\\"` on Windows.
294▶#[stable(feature = "main_separator_str", since = "1.68.0")]
295pub const MAIN_SEPARATOR_STR: &str = SEPARATORS_STR[0];
296
+ 41 more matches in this file
1//! Lookup hir elements using positions in the source code. This is a lossy
2//! transformation: in general, a single source might correspond to several
3▶//! modules, functions, etc, due to macros, cfgs and `#[path=]` attributes on
4//! modules.
5//!
· · ·
14use hir_def::{
15 AdtId, AssocItemId, CallableDefId, ConstId, DefWithBodyId, ExpressionStoreOwnerId, FieldId,
16▶ FunctionId, GenericDefId, HasModule, LocalFieldId, LoweringMode, ModuleDefId, StructId,
17 VariantId,
18 expr_store::{
· · ·
64
65use crate::{
66▶ Adt, AnyFunctionId, AssocItem, BindingMode, BuiltinAttr, BuiltinType, Callable, Const,
67 DeriveHelper, EnumVariant, Field, Function, GenericSubstitution, Local, Macro, ModuleDef,
68 PredicateEvaluationResult, SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type,
· · ·
67▶ DeriveHelper, EnumVariant, Field, Function, GenericSubstitution, Local, Macro, ModuleDef,
68 PredicateEvaluationResult, SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type,
69 TypeAlias, TypeOwnerId,
· · ·
636 ) -> Option<Callable<'db>> {
637 let expr_id = self.expr_id(call.clone().into())?.as_expr()?;
638▶ let (func, args) = self.infer()?.method_resolution(expr_id)?;
639 let interner = DbInterner::new_no_crate(db);
640 let ty = db.value_ty(func.into())?.instantiate(interner, args).skip_norm_wip();
+ 44 more matches in this file
5//! check_* methods in [`rustc_hir_typeck/check.rs`] are a good entry point) and
6//! IntelliJ-Rust (org.rust.lang.core.types.infer). Our entry point for
7▶//! inference here is the `infer` function, which infers the types of all
8//! expressions in a given function.
9//!
· · ·
8▶//! expressions in a given function.
9//!
10//! During inference, types (i.e. the `Ty` struct) can contain type 'variables'
· · ·
43use either::Either;
44use hir_def::{
45▶ AdtId, AssocItemId, AttrDefId, DefWithBodyId, ExpressionStoreOwnerId, FieldId, FunctionId,
46 GenericDefId, GenericParamId, HasModule, LocalFieldId, Lookup, TraitId, TupleFieldId, TupleId,
47 VariantId,
· · ·
150
151 match def {
152▶ DefWithBodyId::FunctionId(f) => {
153 ctx.collect_fn(f, body.self_param.map(|param| param.formal), &body.params)
154 }
· · ·
356 field_with_same_name: Option<StoredTy>,
357 #[type_visitable(ignore)]
358▶ assoc_func_with_same_name: Option<FunctionId>,
359 },
360 UnresolvedAssocItem {
+ 33 more matches in this file
115 self.resolve_vars_if_possible(bound_predicate.rebind(trait_predicate));
116
117▶ // Let's use the root obligation as the main message, when we care about the
118 // most general case ("X doesn't implement Pattern<'_>") over the case that
119 // happened to fail ("char doesn't implement Fn(&mut char)").
· · ·
121 // We rely on a few heuristics to identify cases where this root
122 // obligation is more important than the leaf obligation:
123▶ let (main_trait_predicate, main_obligation) =
124 if let ty::PredicateKind::Clause(
125 ty::ClauseKind::Trait(root_pred)
· · ·
146 )
147 // The leaf trait and the root trait are different, so as to avoid
148▶ // talking about `&mut T: Trait` and instead remain talking about
149 // `T: Trait` instead
150 && leaf_trait_predicate.def_id() != root_pred.def_id()
· · ·
191 let CustomDiagnostic { message, label, notes, parent_label } = self
192 .on_unimplemented_note(
193▶ main_trait_predicate,
194 main_obligation,
195 &mut long_ty_file,
· · ·
194▶ main_obligation,
195 &mut long_ty_file,
196 );
+ 41 more matches in this file