32,125 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
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
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
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
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
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
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
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 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
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 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/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 →
179 sema: &Semantics<'_, RootDatabase>,
180 node: &SyntaxNode,
181) -> Option<hir::Function> {
182 let node = ast::TryExpr::cast(node.clone())?;
183 let try_expr_ty = sema.type_of_expr(&node.expr()?)?.adjusted();
· · ·
205
206 let from_trait = fd.core_convert_From()?;
207 let from_fn = from_trait.function(sema.db, sym::from)?;
208 sema.resolve_trait_impl_method(
209 returned_err_ty.clone(),
· · ·
221 let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?;
222 let callable = sema.resolve_method_call_as_callable(&method_call)?;
223 let CallableKind::Function(f) = callable.kind() else { return None };
224 let assoc = f.as_assoc_item(sema.db)?;
225
· · ·
233 {
234 let t = fd.core_convert_FromStr()?;
235 let t_f = t.function(sema.db, &sym::from_str)?;
236 return sema
237 .resolve_trait_impl_method(
· · ·
249 let f = if fn_name == sym::into && fd.core_convert_Into() == Some(t) {
250 let dual = fd.core_convert_From()?;
251 let dual_f = dual.function(sema.db, &sym::from)?;
252 sema.resolve_trait_impl_method(
253 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 →
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
library/std/src/fs.rs RUST 238 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//!
· · ·
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.
+ 233 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
src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs RUST 68 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}
+ 63 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
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 →
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 //^^^^^
1646fn function(field: u32) {
1647 //^^^^^
1648 Struct { field$0 }
+ 32 more matches in this file
src/tools/rust-analyzer/crates/ide/src/inlay_hints/param_name.rs RUST 44 matches · showing 5 view 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
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.