18,625 matches across 25 files for func main lang:Rust
snippet_mode: auto · sorted by relevance
compiler/rustc_hir_typeck/src/expr.rs RUST 56 matches · showing 5 view 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
+ 51 more matches in this file
library/core/src/slice/iter.rs RUST 49 matches · showing 5 view file →
373#[doc(hidden)]
374pub(super) trait SplitIter: DoubleEndedIterator {
375 /// Marks the underlying iterator as complete, extracting the remaining
376 /// portion of the slice.
377 fn finish(&mut self) -> Option<Self::Item>;
· · ·
379
380/// An iterator over subslices separated by elements that match a predicate
381/// function.
382///
383/// This struct is created by the [`split`] method on [slices].
· · ·
534
535/// An iterator over subslices separated by elements that match a predicate
536/// function. Unlike `Split`, it contains the matched part as a terminator
537/// of the subslice.
538///
· · ·
644 // by the last iteration, so we start searching a new match
645 // one index to the left.
646 let remainder = if self.v.is_empty() { &[] } else { &self.v[..(self.v.len() - 1)] };
647 let idx = remainder.iter().rposition(|x| (self.pred)(x)).map(|idx| idx + 1).unwrap_or(0);
648 if idx == 0 {
· · ·
647 let idx = remainder.iter().rposition(|x| (self.pred)(x)).map(|idx| idx + 1).unwrap_or(0);
648 if idx == 0 {
649 self.finished = true;
+ 44 more matches in this file
compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs RUST 45 matches · showing 5 view 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 );
+ 40 more matches in this file
compiler/rustc_codegen_ssa/src/back/write.rs RUST 100 matches · showing 5 view file →
30use rustc_span::{FileName, InnerSpan, Span, SpanData};
31use rustc_structures::CrateType;
32use rustc_target::spec::{MergeFunctions, SanitizerSet};
33use tracing::debug;
34
· · ·
106 pub vectorize_loop: bool,
107 pub vectorize_slp: bool,
108 pub merge_functions: bool,
109 pub emit_lifetime_markers: bool,
110 pub llvm_plugins: Vec<String>,
· · ·
237
238 // Some targets (namely, NVPTX) interact badly with the
239 // MergeFunctions pass. This is because MergeFunctions can generate
240 // new function calls which may interfere with the target calling
241 // convention; e.g. for the NVPTX target, PTX kernels should not
· · ·
240 // new function calls which may interfere with the target calling
241 // convention; e.g. for the NVPTX target, PTX kernels should not
242 // call other PTX kernels. MergeFunctions can also be configured to
· · ·
242 // call other PTX kernels. MergeFunctions can also be configured to
243 // generate aliases instead, but aliases are not supported by some
244 // backends (again, NVPTX). Therefore, allow targets to opt out of
+ 95 more matches in this file
compiler/rustc_monomorphize/src/collector.rs RUST 55 matches · showing 5 view 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
library/std/src/path.rs RUST 46 matches · showing 5 view 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
· · ·
290pub 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
compiler/rustc_parse/src/parser/ty.rs RUST 22 matches · showing 5 view 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
compiler/rustc_codegen_ssa/src/base.rs RUST 50 matches · showing 5 view 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
library/core/src/slice/mod.rs RUST 131 matches · showing 5 view file →
80/// Calculates the direction and split point of a one-sided range.
81///
82/// This is a helper function for `split_off` and `split_off_mut` that returns
83/// the direction of the split (front or back) as well as the index at
84/// which to split. Returns `None` if the split index would overflow.
· · ·
366 }
367
368 /// Returns an array reference to the first `N` items in the slice and the remaining slice.
369 ///
370 /// If the slice is not at least `N` in length, this will return `None`.
· · ·
393 }
394
395 /// Returns a mutable array reference to the first `N` items in the slice and the remaining
396 /// slice.
397 ///
· · ·
426 }
427
428 /// Returns an array reference to the last `N` items in the slice and the remaining slice.
429 ///
430 /// If the slice is not at least `N` in length, this will return `None`.
· · ·
454 }
455
456 /// Returns a mutable array reference to the last `N` items in the slice and the remaining
457 /// slice.
458 ///
+ 126 more matches in this file
compiler/rustc_middle/src/mir/pretty.rs RUST 26 matches · showing 5 view file →
141 /// ```
142 ///
143 /// Output from this function is controlled by passing `-Z dump-mir=<filter>`,
144 /// where `<filter>` takes the following forms:
145 ///
· · ·
375 }
376
377 /// Write out a human-readable textual representation for the given function.
378 pub fn write_mir_fn(&self, body: &Body<'tcx>, w: &mut dyn io::Write) -> io::Result<()> {
379 write_mir_intro(self.tcx, body, w, self.options)?;
· · ·
627 write_coverage_info_hi(coverage_info_hi, w)?;
628 }
629 if let Some(function_coverage_info) = &body.function_coverage_info {
630 write_function_coverage_info(function_coverage_info, w)?;
631 }
· · ·
630 write_function_coverage_info(function_coverage_info, w)?;
631 }
632
· · ·
658}
659
660fn write_function_coverage_info(
661 function_coverage_info: &coverage::FunctionCoverageInfo,
662 w: &mut dyn io::Write,
+ 21 more matches in this file
src/tools/clippy/clippy_utils/src/lib.rs RUST 77 matches · showing 5 view file →
215///
216/// The current context is determined based on the current body which is set before calling a lint's
217/// entry point (any function on `LateLintPass`). If you need to check in a different context use
218/// `tcx.hir_is_inside_const_context(_)`.
219///
· · ·
395}
396
397/// Checks if the `def_id` belongs to a function that is part of a trait impl.
398pub fn is_def_id_trait_method(cx: &LateContext<'_>, def_id: LocalDefId) -> bool {
399 if let Node::Item(item) = cx.tcx.parent_hir_node(cx.tcx.local_def_id_to_hir_id(def_id))
· · ·
571pub fn is_default_equivalent_call(
572 cx: &LateContext<'_>,
573 repl_func: &Expr<'_>,
574 whole_call_expr: Option<&Expr<'_>>,
575) -> bool {
· · ·
576 if let ExprKind::Path(ref repl_func_qpath) = repl_func.kind
577 && let Some(repl_def) = cx.qpath_res(repl_func_qpath, repl_func.hir_id).opt_def(cx)
578 && (repl_def.assoc_fn_parent(cx).is_diag_item(cx, sym::Default)
· · ·
577 && let Some(repl_def) = cx.qpath_res(repl_func_qpath, repl_func.hir_id).opt_def(cx)
578 && (repl_def.assoc_fn_parent(cx).is_diag_item(cx, sym::Default)
579 || is_default_equivalent_ctor(cx, repl_def.1, repl_func_qpath))
+ 72 more matches in this file
compiler/rustc_resolve/src/late/diagnostics.rs RUST 48 matches · showing 5 view file →
65 "refer to the method with the fully-qualified path"
66 }
67 AssocSuggestion::AssocFn { called: true } => "call the associated function",
68 AssocSuggestion::AssocFn { called: false } => "refer to the associated function",
69 AssocSuggestion::AssocConst => "use the associated `const`",
· · ·
68 AssocSuggestion::AssocFn { called: false } => "refer to the associated function",
69 AssocSuggestion::AssocConst => "use the associated `const`",
70 AssocSuggestion::AssocType => "use the associated type",
· · ·
133}
134
135/// Description of the lifetimes appearing in a function parameter.
136/// This is used to provide a literal explanation to the elision failure.
137#[derive(Debug)]
· · ·
415 let (tick, mod_prefix, mod_str, module, suggestion) = if path.len() == 1 {
416 debug!(?self.diag_metadata.current_impl_items);
417 debug!(?self.diag_metadata.current_function);
418 let suggestion = if self.current_trait_ref.is_none()
419 && let Some((fn_kind, _)) = self.diag_metadata.current_function
· · ·
419 && let Some((fn_kind, _)) = self.diag_metadata.current_function
420 && let Some(FnCtxt::Assoc(_)) = fn_kind.ctxt()
421 && let FnKind::Fn(_, _, ast::Fn { sig, .. }) = fn_kind
+ 43 more matches in this file
src/tools/rust-analyzer/crates/hir-ty/src/infer.rs RUST 43 matches · showing 5 view 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'
· · ·
44use hir_def::{
45 AdtId, AssocItemId, AttrDefId, ConstId, DefWithBodyId, ExpressionStoreOwnerId, FieldId,
46 FunctionId, GenericDefId, GenericParamId, HasModule, LocalFieldId, Lookup, StaticId, TraitId,
47 TupleFieldId, TupleId, VariantId,
48 attrs::AttrFlags,
· · ·
52 layout::Integer,
53 resolver::{HasResolver, ResolveValueResult, Resolver, TypeNs, ValueNs},
54 signatures::{ConstSignature, EnumSignature, FunctionSignature, StaticSignature},
55 type_ref::{LifetimeRefId, TypeRefId},
56 unstable_features::UnstableFeatures,
· · ·
150
151 match def {
152 DefWithBodyId::FunctionId(f) => {
153 ctx.collect_fn(f, body.self_param.map(|param| param.formal), &body.params)
154 }
+ 38 more matches in this file
compiler/rustc_passes/src/stability.rs RUST 37 matches · showing 5 view file →
129/// with the `rustc_private` feature. This is intended for use when
130/// compiling library and `rustc_*` crates themselves so we can leverage crates.io
131/// while maintaining the invariant that all sysroot crates are unstable
132/// by default and are unable to be used.
133const FORCE_UNSTABLE: Stability = Stability {
· · ·
239 {
240 const_stab = Some(ConstStability {
241 // We subject these implicitly-const functions to recursive const stability.
242 const_stable_indirect: true,
243 promotable: false,
· · ·
384 }
385
386 // If the current node is a function with const stability attributes (directly given or
387 // implied), check if the function/method is const or the parent impl block is const.
388 let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
· · ·
387 // implied), check if the function/method is const or the parent impl block is const.
388 let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
389 if let Some(fn_sig) = fn_sig
· · ·
936 self.fully_stable = false;
937 }
938 if let TyKind::FnPtr(function) = t.kind {
939 if extern_abi_stability(function.abi).is_err() {
940 self.fully_stable = false;
+ 32 more matches in this file
src/tools/clippy/clippy_lints/src/doc/mod.rs RUST 38 matches · showing 5 view 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;
34mod 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
src/tools/rust-analyzer/crates/ide/src/rename.rs RUST 79 matches · showing 5 view 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
compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs RUST 15 matches · showing 5 view file →
1129 debug!("cmp(t1={}, t1.kind={:?}, t2={}, t2.kind={:?})", t1, t1.kind(), t2, t2.kind());
1130
1131 // helper functions
1132 fn fmt_region<'tcx>(region: ty::Region<'tcx>) -> String {
1133 let mut r = region.to_string();
· · ·
1216 let len2 = sub_no_defaults_2.len();
1217 let common_len = cmp::min(len1, len2);
1218 let remainder1 = &sub1[common_len..];
1219 let remainder2 = &sub2[common_len..];
1220 let common_default_params =
· · ·
1219 let remainder2 = &sub2[common_len..];
1220 let common_default_params =
1221 iter::zip(remainder1.iter().rev(), remainder2.iter().rev())
· · ·
1221 iter::zip(remainder1.iter().rev(), remainder2.iter().rev())
1222 .filter(|(a, b)| a == b)
1223 .count();
· · ·
1933 };
1934
1935 // FIXME(#73154): For now, we do leak check when coercing function
1936 // pointers in typeck, instead of only during borrowck. This can lead
1937 // to these `RegionsInsufficientlyPolymorphic` errors that aren't helpful.
+ 10 more matches in this file
compiler/rustc_lint/src/builtin.rs RUST 26 matches · showing 5 view file →
3//! This contains lints which can feasibly be implemented as their own
4//! AST visitor. Also see `rustc_lint_defs::builtin`, which contains the
5//! definitions of lints that are emitted directly inside the main compiler.
6//!
7//! To add a new lint to rustc, declare it here using [`declare_lint!`].
· · ·
123 ///
124 ///
125 /// fn main() {
126 /// let p = Point {
127 /// x: 5,
· · ·
334 ) {
335 // Only check publicly-visible items, using the result from the privacy pass.
336 // It's an option so the crate root can also use this function (it doesn't
337 // have a `NodeId`).
338 if def_id != CRATE_DEF_ID && !cx.effective_visibilities.is_exported(def_id) {
· · ·
437 /// pub field: i32
438 /// }
439 /// # fn main() {}
440 /// ```
441 ///
· · ·
578 /// #![deny(missing_debug_implementations)]
579 /// pub struct Foo;
580 /// # fn main() {}
581 /// ```
582 ///
+ 21 more matches in this file
compiler/rustc_codegen_ssa/src/back/linker.rs RUST 19 matches · showing 5 view file →
163}
164
165// Note: Ideally neither these helper function, nor the macro-generated inherent methods below
166// would exist, and these functions would live in `trait Linker`.
167// Unfortunately, adding these functions to `trait Linker` make it `dyn`-incompatible.
· · ·
166// would exist, and these functions would live in `trait Linker`.
167// Unfortunately, adding these functions to `trait Linker` make it `dyn`-incompatible.
168// If the methods are added to the trait with `where Self: Sized` bounds, then even a separate
· · ·
167// Unfortunately, adding these functions to `trait Linker` make it `dyn`-incompatible.
168// If the methods are added to the trait with `where Self: Sized` bounds, then even a separate
169// implementation of them for `dyn Linker {}` wouldn't work due to a conflict with those
· · ·
366impl<'a> GccLinker<'a> {
367 fn takes_hints(&self) -> bool {
368 // Really this function only returns true if the underlying linker
369 // configured for a compiler is binutils `ld.bfd` and `ld.gold`. We
370 // don't really have a foolproof way to detect that, so rule out some
· · ·
372 //
373 // * On OSX they have their own linker, not binutils'
374 // * For WebAssembly the only functional linker is LLD, which doesn't
375 // support hint flags
376 !self.sess.target.is_like_darwin && !self.sess.target.is_like_wasm
+ 14 more matches in this file
src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs RUST 99 matches · showing 5 view 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
library/core/src/num/int_macros.rs RUST 73 matches · showing 5 view file →
95 ///
96 /// Depending on what you're doing with the value, you might also be interested in the
97 /// [`ilog2`] function which returns a consistent number, even if the type widens.
98 ///
99 /// # Examples
· · ·
253 /// Returns the bit pattern of `self` reinterpreted as an unsigned integer of the same size.
254 ///
255 /// This produces the same result as an `as` cast, but ensures that the bit-width remains
256 /// the same.
257 ///
· · ·
604 /// ## Overflow behavior
605 ///
606 /// This function will always panic on overflow, regardless of whether overflow checks are enabled.
607 ///
608 /// # Examples
· · ·
694 /// ## Overflow behavior
695 ///
696 /// This function will always panic on overflow, regardless of whether overflow checks are enabled.
697 ///
698 /// # Examples
· · ·
744 /// ## Overflow behavior
745 ///
746 /// This function will always panic on overflow, regardless of whether overflow checks are enabled.
747 ///
748 /// # Examples
+ 68 more matches in this file
src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs RUST 49 matches · showing 5 view 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
src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs RUST 144 matches · showing 5 view 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
compiler/rustc_mir_transform/src/liveness.rs RUST 20 matches · showing 5 view file →
133 };
134
135 // Get the remaining variables' names from debuginfo.
136 checked_places.record_debuginfo(&body.var_debug_info);
137
· · ·
360/// - a = _temp.0
361///
362/// This function tries to detect this pattern in order to avoid marking statement as a definition
363/// and use. This will let the analysis be dictated by the next use of `a`.
364///
· · ·
759 }
760
761 // Check liveness of function arguments on entry.
762 {
763 cursor.seek_to_block_start(START_BLOCK);
· · ·
865 }
866
867 // This is a capture: pass information to the enclosing function.
868 if is_capture(*place) {
869 for p in place.projection {
· · ·
1007 }
1008
1009 // this is a capture: let the enclosing function report the unused variable.
1010 if is_capture(*place) {
1011 continue;
+ 15 more matches in this file
src/librustdoc/html/render/mod.rs RUST 32 matches · showing 5 view file →
14//! rendered.
15//!
16//! The main entry point to the rendering system is the implementation of
17//! `FormatRenderer` on `Context`.
18//!
· · ·
82};
83use crate::html::render::print_item::ImplString;
84use crate::html::render::search_index::get_function_type_for_search;
85use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD;
86use crate::html::{highlight, sources};
· · ·
130 pub(crate) ty: ItemType,
131 pub(crate) desc: String,
132 pub(crate) search_type: Option<IndexItemFunctionType>,
133 pub(crate) aliases: Box<[Symbol]>,
134 pub(crate) deprecation: Option<Deprecation>,
· · ·
146 ) -> Self {
147 let desc = short_markdown_summary(&item.doc_value(), &item.link_names(cache));
148 let search_type = get_function_type_for_search(item, tcx, impl_generics, parent_did, cache);
149 let aliases = item.attrs.get_doc_aliases();
150 let deprecation = item.deprecation(tcx);
· · ·
327}
328
329/// Full type of functions/methods in the search index.
330#[derive(Clone, Debug, Eq, PartialEq)]
331pub(crate) struct IndexItemFunctionType {
+ 27 more matches in this file
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.