31,173 matches across 25 files for func main
snippet_mode: auto · sorted by relevance
src/librustdoc/html/static/js/search.js JAVASCRIPT 282 matches · showing 5 view file →
10 * @param {stringdex.Hooks} hooks
11 */
12const 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
library/std/src/io/mod.rs RUST 116 matches · showing 5 view file →
1//! Traits, helpers, and type definitions for core I/O functionality.
2//!
3//! The `std::io` module contains a number of common things you'll need
· · ·
20//! use std::fs::File;
21//!
22//! fn main() -> io::Result<()> {
23//! let mut f = File::open("foo.txt")?;
24//! let mut buffer = [0; 10];
· · ·
49//! use std::fs::File;
50//!
51//! fn main() -> io::Result<()> {
52//! let mut f = File::open("foo.txt")?;
53//! let mut buffer = [0; 10];
· · ·
84//! use std::fs::File;
85//!
86//! fn main() -> io::Result<()> {
87//! let f = File::open("foo.txt")?;
88//! let mut reader = BufReader::new(f);
· · ·
106//! use std::fs::File;
107//!
108//! fn main() -> io::Result<()> {
109//! let f = File::create("foo.txt")?;
110//! {
+ 111 more matches in this file
src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs RUST 99 matches · showing 5 view file →
34// Assist: inline_into_callers
35//
36// Inline a function or method body into all of its callers where possible, creating a `let` statement per parameter
37// unless the parameter can be inlined. The parameter will be inlined either if it the supplied argument is a simple local
38// or if the parameter is only accessed inside the function body once.
· · ·
38// or if the parameter is only accessed inside the function body once.
39// If all calls can be inlined the function will be removed.
40//
· · ·
39// If all calls can be inlined the function will be removed.
40//
41// ```
· · ·
74 let vfs_def_file = ctx.vfs_file_id();
75 let name = ctx.find_node_at_offset::<ast::Name>()?;
76 let ast_func = name.syntax().parent().and_then(ast::Fn::cast)?;
77 let func_body = ast_func.body()?;
78 let param_list = ast_func.param_list()?;
· · ·
77 let func_body = ast_func.body()?;
78 let param_list = ast_func.param_list()?;
79
+ 94 more matches in this file
compiler/rustc_codegen_ssa/src/back/write.rs RUST 99 matches · showing 5 view file →
31use rustc_span::source_map::SourceMap;
32use rustc_span::{FileName, InnerSpan, Span, SpanData};
33use rustc_target::spec::{MergeFunctions, SanitizerSet};
34use tracing::debug;
35
· · ·
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>,
· · ·
233
234 // Some targets (namely, NVPTX) interact badly with the
235 // MergeFunctions pass. This is because MergeFunctions can generate
236 // new function calls which may interfere with the target calling
237 // convention; e.g. for the NVPTX target, PTX kernels should not
· · ·
236 // new function calls which may interfere with the target calling
237 // convention; e.g. for the NVPTX target, PTX kernels should not
238 // call other PTX kernels. MergeFunctions can also be configured to
· · ·
238 // call other PTX kernels. MergeFunctions can also be configured to
239 // generate aliases instead, but aliases are not supported by some
240 // backends (again, NVPTX). Therefore, allow targets to opt out of
+ 94 more matches in this file
compiler/rustc_codegen_ssa/src/base.rs RUST 48 matches · showing 5 view file →
194 // traits are equal, then the associated type bounds (`dyn Trait<Assoc=T>`)
195 // are also equal, which is ensured by the fact that normalization is
196 // a function and we do not allow overlapping impls.
197 return old_info;
198 }
· · ·
397) {
398 // this is an info! to allow collecting monomorphization statistics
399 // and to allow finding the last function before LLVM aborts from
400 // release builds.
401 info!("codegen_instance({})", instance);
· · ·
449 expr.span,
450 ),
451 _ => span_bug!(*op_sp, "asm sym is not a function"),
452 };
453
· · ·
473}
474
475/// Creates the `main` function which will initialize the rust runtime and call
476/// users main function.
477pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
· · ·
476/// users main function.
477pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
478 cx: &'a Bx::CodegenCx,
+ 43 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
src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs RUST 144 matches · showing 5 view file →
115 postfix_snippet("dbg", "dbg!(expr)", format!("dbg!({receiver_text})")).add_to(acc, ctx.db); // fixme
116 postfix_snippet("dbgr", "dbg!(&expr)", format!("dbg!(&{receiver_text})")).add_to(acc, ctx.db);
117 postfix_snippet("call", "function(expr)", format!("${{1}}({receiver_text})"))
118 .add_to(acc, ctx.db);
119
· · ·
123 let is_valid_new = expected_ty
124 .iterate_assoc_items(ctx.db, |item| {
125 if let hir::AssocItem::Function(func) = item
126 && func.name(ctx.db) == hir::sym::new
127 && !func.has_self_param(ctx.db)
· · ·
126 && func.name(ctx.db) == hir::sym::new
127 && !func.has_self_param(ctx.db)
128 {
· · ·
127 && !func.has_self_param(ctx.db)
128 {
129 let params = func.params_without_self(ctx.db);
· · ·
129 let params = func.params_without_self(ctx.db);
130 if params.len() == 1 {
131 return Some(());
+ 139 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_hir_typeck/src/expr.rs RUST 54 matches · showing 5 view file →
44 AddressOfTemporaryTaken, BaseExpressionDoubleDot, BaseExpressionDoubleDotAddExpr,
45 BaseExpressionDoubleDotRemove, CantDereference, FieldMultiplySpecifiedInInitializer,
46 FunctionalRecordUpdateOnNonStruct, HelpUseLatestEdition, NakedAsmOutsideNakedFn,
47 NoFieldOnVariant, ReturnLikeStatementKind, ReturnStmtOutsideOfFnBody, StructExprNonExhaustive,
48 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
+ 49 more matches in this file
src/tools/rust-analyzer/crates/ide-completion/src/render.rs RUST 187 matches · showing 5 view file →
3
4pub(crate) mod const_;
5pub(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
src/tools/rust-analyzer/crates/ide/src/runnables.rs RUST 83 matches · showing 5 view 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
src/tools/rust-analyzer/crates/ide/src/rename.rs RUST 78 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(
· · ·
400 sema: &Semantics<'_, RootDatabase>,
401 source_change: &mut SourceChange,
402 f: hir::Function,
403) {
404 let calls = Definition::Function(f).usages(sema).all();
· · ·
404 let calls = Definition::Function(f).usages(sema).all();
405 for (_file_id, calls) in calls {
406 for call in calls {
+ 73 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
src/tools/clippy/clippy_lints/src/doc/mod.rs RUST 36 matches · showing 5 view file →
18use rustc_resolve::rustdoc::pulldown_cmark::{BrokenLink, CodeBlockKind, CowStr, Options, TagEnd};
19use rustc_resolve::rustdoc::{
20 DocFragment, add_doc_fragment, attrs_to_doc_fragments, main_body_opts, pulldown_cmark,
21 source_span_for_markdown_range, span_of_fragments,
22};
· · ·
35mod markdown;
36mod missing_headers;
37mod needless_doctest_main;
38mod suspicious_doc_comments;
39mod test_attr_in_doctest;
· · ·
266 /// /// [`SmallVec<[T; INLINE_CAPACITY]>`][SmallVec].
267 /// /// [SmallVec]: SmallVec
268 /// fn main() {}
269 /// ```
270 #[clippy::version = "pre 1.29.0"]
· · ·
401 /// Detects documentation that is empty.
402 /// ### Why is this bad?
403 /// Empty docs clutter code without adding value, reducing readability and maintainability.
404 /// ### Example
405 /// ```no_run
· · ·
423declare_clippy_lint! {
424 /// ### What it does
425 /// Checks the doc comments of publicly visible functions that
426 /// return a `Result` type and warns if there is no `# Errors` section.
427 ///
+ 31 more matches in this file
src/librustdoc/doctest/make.rs RUST 34 matches · showing 5 view 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,
· · ·
136
137 let Ok(Ok(ParseSourceInfo {
138 has_main_fn,
139 already_has_extern_crate,
140 supports_color,
· · ·
185 DocTestBuilder {
186 supports_color,
187 has_main_fn,
188 global_crate_attrs,
189 crate_attrs,
· · ·
204 pub(crate) supports_color: bool,
205 pub(crate) already_has_extern_crate: bool,
206 pub(crate) has_main_fn: bool,
207 pub(crate) global_crate_attrs: Vec<String>,
208 pub(crate) crate_attrs: String,
+ 29 more matches in this file
src/tools/rust-analyzer/crates/ide/src/goto_definition.rs RUST 86 matches · showing 5 view file →
164 sema: &Semantics<'_, RootDatabase>,
165 node: &SyntaxNode,
166) -> Option<hir::Function> {
167 let node = ast::TryExpr::cast(node.clone())?;
168 let try_expr_ty = sema.type_of_expr(&node.expr()?)?.adjusted();
· · ·
190
191 let from_trait = fd.core_convert_From()?;
192 let from_fn = from_trait.function(sema.db, sym::from)?;
193 sema.resolve_trait_impl_method(
194 returned_err_ty.clone(),
· · ·
206 let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?;
207 let callable = sema.resolve_method_call_as_callable(&method_call)?;
208 let CallableKind::Function(f) = callable.kind() else { return None };
209 let assoc = f.as_assoc_item(sema.db)?;
210
· · ·
218 {
219 let t = fd.core_convert_FromStr()?;
220 let t_f = t.function(sema.db, &sym::from_str)?;
221 return sema
222 .resolve_trait_impl_method(
· · ·
234 let f = if fn_name == sym::into && fd.core_convert_Into() == Some(t) {
235 let dual = fd.core_convert_From()?;
236 let dual_f = dual.function(sema.db, &sym::from)?;
237 sema.resolve_trait_impl_method(
238 return_type.clone(),
+ 81 more matches in this file
src/tools/rust-analyzer/crates/ide/src/signature_help.rs RUST 85 matches · showing 5 view 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
compiler/rustc_passes/src/stability.rs RUST 37 matches · showing 5 view file →
127/// with the `rustc_private` feature. This is intended for use when
128/// compiling library and `rustc_*` crates themselves so we can leverage crates.io
129/// while maintaining the invariant that all sysroot crates are unstable
130/// by default and are unable to be used.
131const FORCE_UNSTABLE: Stability = Stability {
· · ·
237 {
238 const_stab = Some(ConstStability {
239 // We subject these implicitly-const functions to recursive const stability.
240 const_stable_indirect: true,
241 promotable: false,
· · ·
382 }
383
384 // If the current node is a function with const stability attributes (directly given or
385 // implied), check if the function/method is const or the parent impl block is const.
386 let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
· · ·
385 // implied), check if the function/method is const or the parent impl block is const.
386 let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
387 if let Some(fn_sig) = fn_sig
· · ·
934 self.fully_stable = false;
935 }
936 if let TyKind::FnPtr(function) = t.kind {
937 if extern_abi_stability(function.abi).is_err() {
938 self.fully_stable = false;
+ 32 more matches in this file
library/std/src/fs.rs RUST 220 matches · showing 5 view 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//!
· · ·
71/// use std::io::prelude::*;
72///
73/// fn main() -> std::io::Result<()> {
74/// let mut file = File::create("foo.txt")?;
75/// file.write_all(b"Hello, world!")?;
· · ·
84/// use std::io::prelude::*;
85///
86/// fn main() -> std::io::Result<()> {
87/// let mut file = File::open("foo.txt")?;
88/// let mut contents = String::new();
· · ·
100/// use std::io::prelude::*;
101///
102/// fn main() -> std::io::Result<()> {
103/// let file = File::open("foo.txt")?;
104/// let mut buf_reader = BufReader::new(file);
· · ·
159/// # Platform-specific behavior
160///
161/// On supported systems (including Windows and some UNIX-based OSes), this function acquires a
162/// handle/file descriptor for the directory. This allows functions like [`Dir::open_file`] to
163/// avoid [TOCTOU] errors when the directory itself is being moved.
+ 215 more matches in this file
src/tools/rust-analyzer/crates/hir-ty/src/infer.rs RUST 39 matches · showing 5 view file →
5//! check_* methods in rustc_hir_analysis/check/mod.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'
· · ·
42use hir_def::{
43 AdtId, AssocItemId, AttrDefId, ConstId, DefWithBodyId, ExpressionStoreOwnerId, FieldId,
44 FunctionId, GenericDefId, GenericParamId, HasModule, LocalFieldId, Lookup, StaticId, TraitId,
45 TupleFieldId, TupleId, VariantId,
46 attrs::AttrFlags,
· · ·
50 layout::Integer,
51 resolver::{HasResolver, ResolveValueResult, Resolver, TypeNs, ValueNs},
52 signatures::{ConstSignature, EnumSignature, FunctionSignature, StaticSignature},
53 type_ref::{LifetimeRefId, TypeRefId},
54 unstable_features::UnstableFeatures,
· · ·
146
147 match def {
148 DefWithBodyId::FunctionId(f) => ctx.collect_fn(f, body.self_param(), &body.params),
149 DefWithBodyId::ConstId(c) => ctx.collect_const(c, ConstSignature::of(db, c)),
150 DefWithBodyId::StaticId(s) => ctx.collect_static(s, StaticSignature::of(db, s)),
+ 34 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
src/tools/rust-analyzer/crates/ide/src/highlight_related.rs RUST 37 matches · showing 5 view file →
424
425 // We should handle `return` separately, because when it is used in a `try` block,
426 // it will exit the outside function instead of the block itself.
427 WalkExpandedExprCtx::new(sema)
428 .with_check_ctx(&WalkExpandedExprCtx::is_async_const_block_or_closure)
· · ·
871 r#"
872fn foo() {
873 unsafe fn this_is_unsafe_function() {}
874
875 unsa$0fe {
· · ·
883 //^^^^^^^^
884
885 this_is_unsafe_function();
886 //^^^^^^^^^^^^^^^^^^^^^^^^^
887 }
· · ·
937 check(
938 r#"
939//- /main.rs crate:main deps:lib
940use lib$0;
941 //^^^ import
· · ·
1640struct Struct { field: u32 }
1641 //^^^^^
1642fn function(field: u32) {
1643 //^^^^^
1644 Struct { field$0 }
+ 32 more matches in this file
src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs RUST 67 matches · showing 5 view 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() {
· · ·
595use foo::example_mod::func;
596fn main() {
597 func$0();
· · ·
596fn main() {
597 func$0();
598}
+ 62 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, ModuleDefId, StructId, VariantId,
17 expr_store::{
18 Body, BodySourceMap, ExpressionStore, ExpressionStoreSourceMap, HygieneId,
· · ·
62
63use crate::{
64 Adt, AnyFunctionId, AssocItem, BindingMode, BuiltinAttr, BuiltinType, Callable, Const,
65 DeriveHelper, EnumVariant, Field, Function, GenericSubstitution, Local, Macro, ModuleDef,
66 PredicateEvaluationResult, SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type,
· · ·
65 DeriveHelper, EnumVariant, Field, Function, GenericSubstitution, Local, Macro, ModuleDef,
66 PredicateEvaluationResult, SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type,
67 TypeAlias, TypeOwnerId,
· · ·
626 ) -> Option<Callable<'db>> {
627 let expr_id = self.expr_id(call.clone().into())?.as_expr()?;
628 let (func, args) = self.infer()?.method_resolution(expr_id)?;
629 let interner = DbInterner::new_no_crate(db);
630 let ty = db.value_ty(func.into())?.instantiate(interner, args).skip_norm_wip();
+ 44 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
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.