4,327 matches across 25 files for func main lang:Rust
snippet_mode: auto · sorted by relevance
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
compiler/rustc_resolve/src/late/diagnostics.rs RUST 48 matches · showing 5 view file →
63 "refer to the method with the fully-qualified path"
64 }
65 AssocSuggestion::AssocFn { called: true } => "call the associated function",
66 AssocSuggestion::AssocFn { called: false } => "refer to the associated function",
67 AssocSuggestion::AssocConst => "use the associated `const`",
· · ·
66 AssocSuggestion::AssocFn { called: false } => "refer to the associated function",
67 AssocSuggestion::AssocConst => "use the associated `const`",
68 AssocSuggestion::AssocType => "use the associated type",
· · ·
132}
133
134/// Description of the lifetimes appearing in a function parameter.
135/// This is used to provide a literal explanation to the elision failure.
136#[derive(Clone, Debug)]
· · ·
433 let (mod_prefix, mod_str, module, suggestion) = if path.len() == 1 {
434 debug!(?self.diag_metadata.current_impl_items);
435 debug!(?self.diag_metadata.current_function);
436 let suggestion = if self.current_trait_ref.is_none()
437 && let Some((fn_kind, _)) = self.diag_metadata.current_function
· · ·
437 && let Some((fn_kind, _)) = self.diag_metadata.current_function
438 && let Some(FnCtxt::Assoc(_)) = fn_kind.ctxt()
439 && let FnKind::Fn(_, _, ast::Fn { sig, .. }) = fn_kind
+ 43 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_lint/src/builtin.rs RUST 27 matches · showing 5 view file →
3//! This contains lints which can feasibly be implemented as their own
4//! AST visitor. Also see `rustc_session::lint::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 ///
· · ·
579 /// #![deny(missing_debug_implementations)]
580 /// pub struct Foo;
581 /// # fn main() {}
582 /// ```
583 ///
+ 22 more matches in this file
compiler/rustc_parse/src/parser/ty.rs RUST 21 matches · showing 5 view file →
47/// Signals whether parsing a type should recover `->`.
48///
49/// More specifically, when parsing a function like:
50/// ```compile_fail
51/// fn foo() => u8 { 0 }
· · ·
142 }
143
144 /// Parse a type suitable for a function or function pointer parameter.
145 /// The difference from `parse_ty` is that this version allows `...`
146 /// (`CVarArgs`) at the top level of the type.
· · ·
182 ///
183 /// Example 1: `&'a TYPE`
184 /// `+` is prohibited to maintain operator priority (P(+) < P(&)).
185 /// Example 2: `value1 as TYPE + value2`
186 /// `+` is prohibited to avoid interactions with expression grammar.
· · ·
233 }
234
235 /// Parses an optional return type `[ -> TY ]` in a function declaration.
236 pub(super) fn parse_ret_ty(
237 &mut self,
· · ·
336 TyKind::Infer
337 } else if self.check_fn_front_matter(false, Case::Sensitive) {
338 // Function pointer type
339 self.parse_ty_fn_ptr(lo, ThinVec::new(), None, recover_return_sign)?
340 } else if self.check_keyword(exp!(For)) {
+ 16 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
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_target/src/spec/mod.rs RUST 41 matches · showing 5 view file →
196 /// At this point the target's reference linker flavor doesn't yet exist and we need to infer
197 /// it. The inference always succeeds and gives some result, and we don't report any flavor
198 /// incompatibility errors for json target specs. The CLI flavor is used as the main source
199 /// of truth, other flags are used in case of ambiguities.
200 fn from_cli_json(cli: LinkerFlavorCli, lld_flavor: LldFlavor, is_gnu: bool) -> LinkerFlavor {
· · ·
925
926crate::target_spec_enum! {
927 pub enum MergeFunctions {
928 Disabled = "disabled",
929 Trampolines = "trampolines",
· · ·
931 }
932
933 parse_error_type = "value for merge-functions";
934}
935
· · ·
1089
1090 /// Split debug-information can be found in individual object files on the
1091 /// filesystem. The main executable may point to the object files.
1092 ///
1093 /// * Windows - not supported
· · ·
1305 Always = "always",
1306 /// Forces the machine code generator to preserve the frame pointers except for the leaf
1307 /// functions (i.e. those that don't call other functions).
1308 NonLeaf = "non-leaf",
1309 /// Allows the machine code generator to omit the frame pointers.
+ 36 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
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
· · ·
355/// - a = _temp.0
356///
357/// This function tries to detect this pattern in order to avoid marking statement as a definition
358/// and use. This will let the analysis be dictated by the next use of `a`.
359///
· · ·
754 }
755
756 // Check liveness of function arguments on entry.
757 {
758 cursor.seek_to_block_start(START_BLOCK);
· · ·
860 }
861
862 // This is a capture: pass information to the enclosing function.
863 if is_capture(*place) {
864 for p in place.projection {
· · ·
950 }
951
952 // this is a capture: let the enclosing function report the unused variable.
953 if is_capture(*place) {
954 continue;
+ 15 more matches in this file
compiler/rustc_codegen_ssa/src/back/linker.rs RUST 16 matches · showing 5 view file →
165}
166
167// Note: Ideally neither these helper function, nor the macro-generated inherent methods below
168// would exist, and these functions would live in `trait Linker`.
169// Unfortunately, adding these functions to `trait Linker` make it `dyn`-incompatible.
· · ·
168// would exist, and these functions would live in `trait Linker`.
169// Unfortunately, adding these functions to `trait Linker` make it `dyn`-incompatible.
170// If the methods are added to the trait with `where Self: Sized` bounds, then even a separate
· · ·
169// Unfortunately, adding these functions to `trait Linker` make it `dyn`-incompatible.
170// If the methods are added to the trait with `where Self: Sized` bounds, then even a separate
171// implementation of them for `dyn Linker {}` wouldn't work due to a conflict with those
· · ·
374impl<'a> GccLinker<'a> {
375 fn takes_hints(&self) -> bool {
376 // Really this function only returns true if the underlying linker
377 // configured for a compiler is binutils `ld.bfd` and `ld.gold`. We
378 // don't really have a foolproof way to detect that, so rule out some
· · ·
380 //
381 // * On OSX they have their own linker, not binutils'
382 // * For WebAssembly the only functional linker is LLD, which doesn't
383 // support hint flags
384 !self.sess.target.is_like_darwin && !self.sess.target.is_like_wasm
+ 11 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_passes/src/check_attr.rs RUST 29 matches · showing 5 view file →
86#[derive(Copy, Clone)]
87pub(crate) enum ProcMacroKind {
88 FunctionLike,
89 Derive,
90 Attribute,
· · ·
96 ProcMacroKind::Attribute => "attribute proc macro",
97 ProcMacroKind::Derive => "derive proc macro",
98 ProcMacroKind::FunctionLike => "function-like proc macro",
99 }
100 .into_diag_arg(&mut None)
· · ·
170 /// [`Attribute::Parsed`].
171 ///
172 /// This is a separate function to help with comprehensibility and rustfmt-ability.
173 fn check_one_parsed_attribute(
174 &self,
· · ·
182 match attr {
183 AttributeKind::ProcMacro => {
184 self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
185 }
186 AttributeKind::ProcMacroAttribute => {
· · ·
294 AttributeKind::NoImplicitPrelude => (),
295 AttributeKind::NoLink => (),
296 AttributeKind::NoMain => (),
297 AttributeKind::NoMangle(..) => (),
298 AttributeKind::NoStd { .. } => (),
+ 24 more matches in this file
compiler/rustc_session/src/session.rs RUST 18 matches · showing 5 view file →
39use crate::config::{
40 self, Cfg, CheckCfg, CoverageLevel, CoverageOptions, CrateType, DebugInfo, ErrorOutputType,
41 FunctionReturn, Input, InstrumentCoverage, OptLevel, OutFileName, OutputType,
42 SwitchWithOptPath,
43};
· · ·
183 pub used_features: Lock<FxHashMap<Symbol, u32>>,
184
185 /// Whether the test harness removed a user-written `#[rustc_main]` attribute
186 /// while generating the synthetic test entry point.
187 pub removed_rustc_main_attr: AtomicBool,
· · ·
187 pub removed_rustc_main_attr: AtomicBool,
188}
189
· · ·
782 pub fn must_emit_unwind_tables(&self) -> bool {
783 // This is used to control the emission of the `uwtable` attribute on
784 // LLVM functions. The `uwtable` attribute according to LLVM is:
785 //
786 // This attribute indicates that the ABI being targeted requires that an
· · ·
787 // unwind table entry be produced for this function even if we can show
788 // that no exceptions passes by it. This is normally the case for the
789 // ELF x86-64 abi, but it can be disabled for some compilation units.
+ 13 more matches in this file
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs RUST 17 matches · showing 5 view file →
64 /// - Points out the method's return type as the reason for the expected type.
65 /// - Possible missing semicolon.
66 /// - Possible missing return type if the return type is the default, and not `fn main()`.
67 pub(crate) fn suggest_mismatched_types_on_tail(
68 &self,
· · ·
94 /// ```compile_fail,E0308
95 /// fn foo(x: usize) -> usize { x }
96 /// let x: usize = foo; // suggest calling the `foo` function: `foo(42)`
97 /// ```
98 pub(crate) fn suggest_fn_call(
· · ·
944 ///
945 /// This routine checks if the return type is left as default, the method is not part of an
946 /// `impl` block and that it isn't the `main` method. If so, it suggests setting the return
947 /// type.
948 #[instrument(level = "trace", skip(self, err))]
· · ·
965 self.resolve_numeric_literals_with_default(self.resolve_vars_if_possible(found));
966 // Only suggest changing the return type for methods that
967 // haven't set a return type at all (and aren't `fn main()`, impl or closure).
968 match &fn_decl.output {
969 // For closure with default returns, don't suggest adding return type
· · ·
1068 && let Some(ty) = constraint.ty()
1069 {
1070 // Check if async function's return type was omitted.
1071 // Don't emit suggestions if the found type is `impl Future<...>`.
1072 debug!(?found);
+ 12 more matches in this file
compiler/rustc_borrowck/src/lib.rs RUST 34 matches · showing 5 view file →
54use crate::borrow_set::{BorrowData, BorrowSet};
55use crate::consumers::{BodyWithBorrowckFacts, RustcFacts};
56use crate::dataflow::{BorrowIndex, Borrowck, BorrowckDomain, Borrows};
57use crate::diagnostics::{
58 AccessKind, BorrowckDiagnosticsBuffer, IllegalMoveOriginKind, MoveError, RegionName,
· · ·
158/// appear in the closure's signature or on its field types. These
159/// requirements are then verified and proved by the closure's
160/// creating function. This struct encodes those requirements.
161///
162/// The requirements are listed as being between various `RegionVid`. The 0th
· · ·
463 let diags_buffer = &mut BorrowckDiagnosticsBuffer::default();
464 // While promoteds should mostly be correct by construction, we need to check them for
465 // invalid moves to detect moving out of arrays:`struct S; fn main() { &([S][0]); }`.
466 for promoted_body in &promoted {
467 use rustc_middle::mir::visit::Visitor;
· · ·
563 .cloned()
564 .collect();
565 // For the remaining unused locals that are marked as mutable, we avoid linting any that
566 // were never initialized. These locals may have been removed as unreachable code; or will be
567 // linted as unused variables.
· · ·
636 let entry_states: EntryStates<_> =
637 itertools::izip!(borrows.entry_states, uninits.entry_states, ever_inits.entry_states)
638 .map(|(borrows, uninits, ever_inits)| BorrowckDomain { borrows, uninits, ever_inits })
639 .collect();
640
+ 29 more matches in this file
compiler/rustc_index/src/bit_set.rs RUST 160 matches · showing 5 view file →
44fn inclusive_start_end<T: Idx>(
45 range: impl RangeBounds<T>,
46 domain: usize,
47) -> Option<(usize, usize)> {
48 // Both start and end are inclusive.
· · ·
55 Bound::Included(end) => end.index(),
56 Bound::Excluded(end) => end.index().checked_sub(1)?,
57 Bound::Unbounded => domain - 1,
58 };
59 assert!(end < domain);
· · ·
59 assert!(end < domain);
60 if start > end {
61 return None;
· · ·
97/// A fixed-size bitset type with a dense representation.
98///
99/// Note 1: Since this bitset is dense, if your domain is big, and/or relatively
100/// homogeneous (for example, with long runs of bits set or unset), then it may
101/// be preferable to instead use a [MixedBitSet], or an
· · ·
102/// [IntervalSet](crate::interval::IntervalSet). They should be more suited to
103/// sparse, or highly-compressible, domains.
104///
105/// Note 2: Use [`GrowableBitSet`] if you need support for resizing after creation.
+ 155 more matches in this file
compiler/rustc_monomorphize/src/partitioning.rs RUST 39 matches · showing 5 view file →
21//!
22//! From that point of view it would make sense to maximize the number of
23//! codegen units by, for example, putting each function into its own module.
24//! That way only those modules would have to be re-compiled that were actually
25//! affected by some change, minimizing the number of functions that could have
· · ·
25//! affected by some change, minimizing the number of functions that could have
26//! been re-used but just happened to be located in a module that is
27//! re-compiled.
· · ·
42//! - There are two codegen units for every source-level module:
43//! - One for "stable", that is non-generic, code
44//! - One for more "volatile" code, i.e., monomorphized instances of functions
45//! defined in that module
46//!
· · ·
48//! codegen unit can get invalidated:
49//!
50//! 1. The most straightforward case is when the BODY of a function or global
51//! changes. Then any codegen unit containing the code for that item has to be
52//! re-compiled. Note that this includes all codegen units where the function
· · ·
52//! re-compiled. Note that this includes all codegen units where the function
53//! has been inlined.
54//!
+ 34 more matches in this file
compiler/rustc_parse/src/parser/pat.rs RUST 15 matches · showing 5 view file →
20use crate::errors::{
21 self, AmbiguousRangePattern, AtDotDotInStructPattern, AtInStructPattern,
22 DotDotDotForRemainingFields, DotDotDotRangeToPatternNotAllowed, DotDotDotRestPattern,
23 EnumPatternInsteadOfIdentifier, ExpectedBindingLeftOfAt, ExpectedCommaAfterPatternField,
24 GenericArgsInPatRequireTurbofishSyntax, InclusiveRangeExtraEquals, InclusiveRangeMatchArrow,
· · ·
28 UnexpectedExpressionInPattern, UnexpectedExpressionInPatternSugg, UnexpectedLifetimeInPattern,
29 UnexpectedParenInRangePat, UnexpectedParenInRangePatSugg,
30 UnexpectedVertVertBeforeFunctionParam, UnexpectedVertVertInPattern, WrapInParens,
31};
32use crate::parser::expr::{DestructuredFloat, could_be_unclosed_char_literal};
· · ·
93pub enum PatternLocation {
94 LetBinding,
95 FunctionParameter,
96}
97
· · ·
134 /// Corresponds to `PatternNoTopAlt` in RFC 3637 and does not admit or-patterns
135 /// or guard patterns at the top level. Used when parsing the parameters of lambda
136 /// expressions, functions, function pointers, and `pat_param` macro fragments.
137 pub fn parse_pat_no_top_alt(
138 &mut self,
· · ·
291 TopLevelOrPatternNotAllowed::LetBinding { span, sub }
292 }
293 PatternLocation::FunctionParameter => {
294 TopLevelOrPatternNotAllowed::FunctionParameter { span, sub }
295 }
+ 10 more matches in this file
compiler/rustc_resolve/src/late.rs RUST 81 matches · showing 5 view file →
88 PatternSource::Let => "let binding",
89 PatternSource::For => "for binding",
90 PatternSource::FnParam => "function parameter",
91 }
92 }
· · ·
101/// Denotes whether the context for the set of already bound bindings is a `Product`
102/// or `Or` context. This is used in e.g., `fresh_binding` and `resolve_pattern_inner`.
103/// See those functions for more information.
104#[derive(PartialEq)]
105enum PatBoundCtx {
· · ·
205 AssocItem,
206
207 /// We passed through a function, closure or coroutine signature. Disallow labels.
208 FnOrCoroutine,
209
· · ·
380 Item,
381 ConstItem,
382 Function,
383 Closure,
384 ImplBlock,
· · ·
397 ImplAssocType => "associated type",
398 ImplBlock => "impl block",
399 Function => "function",
400 Closure => "closure",
401 }
+ 76 more matches in this file
compiler/rustc_borrowck/src/type_check/mod.rs RUST 30 matches · showing 5 view file →
89/// - `body` -- MIR body to type-check
90/// - `promoted` -- map of promoted constants within `body`
91/// - `universal_regions` -- the universal regions from `body`s function signature
92/// - `location_table` -- for datalog polonius, the map between `Location`s and `RichLocation`s
93/// - `borrow_set` -- information about borrows occurring in `body`
· · ·
237 /// recursing into them may corrupt your data structures if you're not careful.
238 promoted: &'a IndexSlice<Promoted, Body<'tcx>>,
239 /// User type annotations are shared between the main MIR and the MIR of
240 /// all of the promoted items.
241 user_type_annotations: &'a CanonicalUserTypeAnnotations<'tcx>,
· · ·
343 /// requires that `&'2 u32 = &'1 u32` -- but at what point? In the
344 /// older NLL analysis, we required this only at the entry point
345 /// to the function. By the nature of the constraints, this wound
346 /// up propagating to all points reachable from start (because
347 /// `'1` -- as a universal region -- is live everywhere). In the
· · ·
511 // Determine the constraints from the promoted MIR by running the type
512 // checker on the promoted MIR, then transfer the constraints back to
513 // the main MIR, changing the locations to the provided location.
514
515 let parent_body = mem::replace(&mut self.body, promoted_body);
· · ·
566
567 // If the region is live at least one location in the promoted MIR,
568 // then add a liveness constraint to the main MIR for this region
569 // at the location provided as an argument to this method
570 //
+ 25 more matches in this file
compiler/rustc_hir_typeck/src/method/probe.rs RUST 21 matches · showing 5 view file →
77 private_candidate: Cell<Option<(DefKind, DefId)>>,
78
79 /// Collects near misses when the candidate functions are missing a `self` keyword and is only
80 /// used for error reporting
81 static_candidates: RefCell<Vec<CandidateSource>>,
· · ·
633 // such types are reachable by following the (potentially shorter)
634 // chain of `Deref<Target=T>`. We will use the first list when finding
635 // potentially relevant function implementations (e.g. relevant impl blocks)
636 // but the second list when determining types that the receiver may be
637 // converted to, in order to find out which of those methods might actually
· · ·
850 // However, in this code, it is OK if we end up with an object type that is
851 // "more general" than the object type that we are evaluating. For *every*
852 // object type `MY_OBJECT`, a function call that goes through a trait-ref
853 // of the form `<MY_OBJECT as SuperTraitOf(MY_OBJECT)>::func` is a valid
854 // `ObjectCandidate`, and it should be discoverable "exactly" through one
· · ·
853 // of the form `<MY_OBJECT as SuperTraitOf(MY_OBJECT)>::func` is a valid
854 // `ObjectCandidate`, and it should be discoverable "exactly" through one
855 // of the iterations in the autoderef loop, so there is no problem with it
· · ·
1253 // Pick stable methods only first, and consider unstable candidates if not found.
1254 self.pick_all_method(&mut PickDiagHints {
1255 // This first cycle, maintain a list of unstable candidates which
1256 // we encounter. This will end up in the Pick for diagnostics.
1257 unstable_candidates: Some(Vec::new()),
+ 16 more matches in this file
compiler/rustc_resolve/src/imports.rs RUST 12 matches · showing 5 view file →
300 /// Returns the best declaration if it is not going to change, and `None` if the best
301 /// declaration may still change to something else.
302 /// FIXME: this function considers `single_imports`, but not `unexpanded_invocations`, so
303 /// the returned declaration may actually change after expanding macros in the same module,
304 /// because of this fact we have glob overwriting (`select_glob_decl`). Consider using
· · ·
305 /// `unexpanded_invocations` here and avoiding glob overwriting entirely, if it doesn't cause
306 /// code breakage in practice.
307 /// FIXME: relationship between this function and similar `DeclData::determined` is unclear.
308 pub(crate) fn determined_decl(&self) -> Option<Decl<'ra>> {
309 if self.non_glob_decl.is_some() {
· · ·
722 // After a full pass over the current set of `indeterminate_imports`,
723 // the collected resolutions are committed together. The process
724 // repeats until either no imports remain or no further progress can
725 // be made.
726
· · ·
780 PendingDecl::Ready(Some(import_decl)) => {
781 if import_decl.is_assoc_item()
782 && !this.tcx.features().import_trait_associated_functions()
783 {
784 feature_err(
· · ·
785 this.tcx.sess,
786 sym::import_trait_associated_functions,
787 import.span,
788 "`use` associated items of traits is unstable",
+ 7 more matches in this file
compiler/rustc_mir_build/src/builder/matches/mod.rs RUST 54 matches · showing 5 view file →
1//! Code related to match expressions. These are sufficiently complex to
2//! warrant their own module and submodules. :) This main module includes the
3//! high-level algorithm, the submodules contain the details.
4//!
· · ·
5//! This also includes code for pattern bindings in `let` statements and
6//! function parameters.
7
8use std::borrow::Borrow;
· · ·
34};
35
36// helper functions, broken out by category:
37mod buckets;
38mod match_pair;
· · ·
76#[derive(Clone, Copy, Debug)]
77pub(crate) enum ScheduleDrops {
78 /// Yes, the relevant functions should also schedule drops as appropriate.
79 Yes,
80 /// No, don't schedule drops. The caller has taken responsibility for any
· · ·
654 let [branch] = built_tree.branches.try_into().unwrap();
655
656 // For matches and function arguments, the place that is being matched
657 // can be set when creating the variables. But the place for
658 // let PATTERN = ... might not even exist until we do the assignment.
+ 49 more matches in this file
compiler/rustc_resolve/src/lib.rs RUST 18 matches · showing 5 view file →
66use rustc_middle::query::Providers;
67use rustc_middle::ty::{
68 self, DelegationInfo, MainDefinition, PerOwnerResolverData, RegisteredTools,
69 ResolverAstLowering, ResolverGlobalCtxt, TyCtxt, TyCtxtFeed, Visibility,
70};
· · ·
222/// #![deny(redundant_imports)]
223/// use std::mem::drop;
224/// fn main() {
225/// let s = Box::new(32);
226/// drop(s);
· · ·
525 ///
526 /// ```
527 /// fn main() {
528 /// fn f() {} // (1)
529 /// { // This is an anonymous module
· · ·
1234 // Suppose that we resolved macro invocation with `invoc_parent_expansion` to binding `binding`
1235 // at some expansion round `max(invoc, binding)` when they both emerged from macros.
1236 // Then this function returns `true` if `self` may emerge from a macro *after* that
1237 // in some later round and screw up our previously found resolution.
1238 // See more detailed explanation in
· · ·
1252
1253 /// Returns whether this declaration may be shadowed or overwritten by something else later.
1254 /// FIXME: this function considers `unexpanded_invocations`, but not `single_imports`, so
1255 /// the declaration may not be as "determined" as we think.
1256 /// FIXME: relationship between this function and similar `NameResolution::determined_decl`
+ 13 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.