25,046 matches across 25 files for func main lang:Rust
snippet_mode: grep · sorted by relevance
compiler/rustc_abi/src/lib.rs RUST 9 matches · showing 5 view file →
388 /// [llvm data layout string](https://llvm.org/docs/LangRef.html#data-layout)
389 ///
390 /// This function doesn't fill `c_enum_min_size` and it will always be `I32` since it can not be
391 /// determined from llvm string.
392 pub fn parse_from_llvm_datalayout_string<'a>(
· · ·
599 ///
600 /// The theoretical maximum object size is defined as the maximum positive `isize` value.
601 /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly
602 /// index every address within an object along with one byte past the end, along with allowing
603 /// `isize` to store the difference between any two pointers into an object.
· · ·
618 ///
619 /// The theoretical maximum object size is defined as the maximum positive `isize` value.
620 /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly
621 /// index every address within an object along with one byte past the end, along with allowing
622 /// `isize` to store the difference between any two pointers into an object.
· · ·
1819 // FIXME(rustc_scalable_vector): Scalable vectors are `Sized` while the
1820 // `sized_hierarchy` feature is not yet fully implemented. After `sized_hierarchy` is
1821 // fully implemented, scalable vectors will remain `Sized`, they just won't be
1822 // `const Sized` - whether `is_unsized` continues to return `false` at that point will
1823 // need to be revisited and will depend on what `is_unsized` is used for.
· · ·
1984 /// For example, `Option<(usize, &T)>` is represented such that the tag for
1985 /// `None` is the null pointer in the second tuple field, and
1986 /// `Some` is the identity function (with a non-null reference)
1987 /// and has no additional tag, i.e. the reference being non-null uniquely identifies this variant.
1988 ///
+ 4 more matches in this file
compiler/rustc_ast/src/ast.rs RUST 34 matches · showing 5 view file →
2//!
3//! This module contains common structures forming the language AST.
4//! Two main entities in the module are [`Item`] (which represents an AST element with
5//! additional metadata), and [`ItemKind`] (which represents a concrete type and contains
6//! information specific to the type of the item).
· · ·
11//! - [`Pat`] and [`PatKind`]: A parsed Rust pattern. Patterns are often dual to expressions.
12//! - [`Stmt`] and [`StmtKind`]: An executable action that does not return a value.
13//! - [`FnDecl`], [`FnHeader`] and [`Param`]: Metadata associated with a function declaration.
14//! - [`Generics`], [`GenericParam`], [`WhereClause`]: Metadata associated with generic parameters.
15//! - [`EnumDef`] and [`Variant`]: Enum declaration.
· · ·
187}
188
189/// Like `join_path_syms`, but for `Ident`s. This function is necessary because
190/// `Ident::to_string` does more than just print the symbol in the `name` field.
191pub fn join_path_idents(path: impl IntoIterator<Item = impl Borrow<Ident>>) -> String {
· · ·
469
470/// Represents lifetime, type and const parameters attached to a declaration of
471/// a function, enum, trait, etc.
472#[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)]
473pub struct Generics {
· · ·
1417 /// is a path, it mostly dispatches to [`Path::is_potential_trivial_const_arg`].
1418 ///
1419 /// This function will only allow paths with no qself, before dispatching to the `Path`
1420 /// function of the same name.
1421 ///
+ 29 more matches in this file
compiler/rustc_ast/src/entry.rs RUST 18 matches · showing 5 view file →
3#[derive(Debug)]
4pub enum EntryPointType {
5 /// This function is not an entrypoint.
6 None,
7 /// This is a function called `main` at the root level.
· · ·
7 /// This is a function called `main` at the root level.
8 /// ```
9 /// fn main() {}
· · ·
9 /// fn main() {}
10 /// ```
11 MainNamed,
· · ·
11 MainNamed,
12 /// This is a function with the `#[rustc_main]` attribute.
13 /// Used by the testing harness to create the test entrypoint.
· · ·
12 /// This is a function with the `#[rustc_main]` attribute.
13 /// Used by the testing harness to create the test entrypoint.
14 /// ```ignore (clashes with test entrypoint)
+ 13 more matches in this file
compiler/rustc_ast/src/visit.rs RUST 10 matches · showing 5 view file →
5//!
6//! Note: it is an important invariant that the default visitor walks the body
7//! of a function in "execution order" (more concretely, reverse post-order
8//! with respect to the CFG implied by the AST), meaning that if AST node A may
9//! execute before AST node B, then A is visited first. The borrow checker in
· · ·
763
764 // This is only used by the MutVisitor. We include this symmetry here to make writing other
765 // functions easier.
766 $(${ignore($lt)}
767 #[expect(unused, rustc::disallowed_pass_by_ref)]
· · ·
822 ) -> V::Result {
823 match self {
824 ItemKind::Fn(func) => {
825 let kind = FnKind::Fn(FnCtxt::Free, visibility, &$($mut)? *func);
826 try_visit!(vis.visit_fn(kind, attrs, span, id));
· · ·
825 let kind = FnKind::Fn(FnCtxt::Free, visibility, &$($mut)? *func);
826 try_visit!(vis.visit_fn(kind, attrs, span, id));
827 }
· · ·
884 AssocItemKind::Const(item) =>
885 visit_visitable!($($mut)? vis, item),
886 AssocItemKind::Fn(func) => {
887 let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), visibility, &$($mut)? *func);
888 try_visit!(vis.visit_fn(kind, attrs, span, id))
+ 5 more matches in this file
compiler/rustc_ast_lowering/src/diagnostics.rs RUST 9 matches · showing 5 view file →
84#[derive(Diagnostic)]
85#[diag("`impl Trait` is not allowed in {$position}", code = E0562)]
86#[note("`impl Trait` is only allowed in arguments and return types of functions and methods")]
87pub(crate) struct MisplacedImplTrait<'a> {
88 #[primary_span]
· · ·
114
115#[derive(Diagnostic)]
116#[diag("`await` is only allowed inside `async` functions and blocks", code = E0728)]
117pub(crate) struct AwaitOnlyInAsyncFnAndBlocks {
118 #[primary_span]
· · ·
119 #[label("only allowed inside `async` functions and blocks")]
120 pub await_kw_span: Span,
121 #[label("this is not `async`")]
· · ·
124
125#[derive(Diagnostic)]
126#[diag("a function cannot be both `comptime` and `const`")]
127pub(crate) struct ConstComptimeFn {
128 #[primary_span]
· · ·
129 #[suggestion("remove the `const`", applicability = "machine-applicable", code = "")]
130 #[note("`const` implies the function can be called at runtime, too")]
131 pub span: Span,
132 #[label("`comptime` because of this")]
+ 4 more matches in this file
compiler/rustc_ast_lowering/src/expr.rs RUST 7 matches · showing 5 view file →
21use crate::diagnostics::{
22 AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks,
23 FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd,
24 InvalidLegacyConstGenericArg, MatchArmWithNoBody, MoveExprOnlyInPlainClosures,
25 NeverPatternWithBody, NeverPatternWithGuard, UnderscoreExprLhsAssign, UseConstGenericArg,
· · ·
826 let coroutine_kind = hir::CoroutineKind::Desugared(desugaring_kind, coroutine_source);
827
828 // The `async` desugaring takes a resume argument and maintains a `task_context`,
829 // whereas a generator does not.
830 let (inputs, params, task_context): (&[_], &[_], _) = match desugaring_kind {
· · ·
1011 // Note that the name of this binding must not be changed to something else because
1012 // debuggers and debugger extensions expect it to be called `__awaitee`. They use
1013 // this name to identify what is being awaited by a suspended async functions.
1014 let awaitee_ident = Ident::with_dummy_span(sym::__awaitee);
1015 let (awaitee_pat, awaitee_pat_hid) =
· · ·
1370 let fields_omitted = match &se.rest {
1371 StructRest::Base(e) => {
1372 self.dcx().emit_err(FunctionalRecordUpdateDestructuringAssignment {
1373 span: e.span,
1374 });
· · ·
1948
1949 let (constructor_item, target_id) = match self.try_block_scope {
1950 TryBlockScope::Function => {
1951 (hir::LangItem::TryTraitFromResidual, Err(hir::LoopIdError::OutsideLoopScope))
1952 }
+ 2 more matches in this file
compiler/rustc_ast_lowering/src/lib.rs RUST 18 matches · showing 5 view file →
211
212 // Lowering state.
213 try_block_scope: TryBlockScope::Function,
214 loop_scope: None,
215 is_in_loop_condition: false,
· · ·
286
287 // We do not need to look at `partial_res_overrides`. That map only contains overrides for
288 // `self_param` locals. And here we are looking for the function definition that `expr`
289 // resolves to.
290 let def_id = self.partial_res_map.get(&expr.id)?.full_res()?.opt_def_id()?;
· · ·
446enum TryBlockScope {
447 /// There isn't a `try` block, so a `?` will use `return`.
448 Function,
449 /// We're inside a `try { … }` block, so a `?` will block-break
450 /// from that block using a type depending only on the argument.
· · ·
780 /// The lowered item is registered into `self.children`.
781 ///
782 /// This function sets up `HirId` lowering infrastructure,
783 /// and stashes the shared mutable state to avoid pollution by the closure.
784 #[instrument(level = "debug", skip(self, f))]
· · ·
964 // This can happen when trying to lower the return type `x` in erroneous code like
965 // async fn foo(x: u8) -> x {}
966 // In that case, `x` is lowered as a function parameter, and the return type is lowered as
967 // an opaque type as a synthesized HIR owner.
968 res.unwrap_or(Res::Err)
+ 13 more matches in this file
compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs RUST 13 matches · showing 5 view file →
9use crate::attributes::AttributeSafety;
10use crate::session_diagnostics::{
11 EmptyExportName, NakedFunctionIncompatibleAttribute, NullOnExport, NullOnObjcClass,
12 NullOnObjcSelector, ObjcClassExpectedStringLiteral, ObjcSelectorExpectedStringLiteral,
13 SanitizeInvalidStatic,
· · ·
224 })];
225 const SAFETY: AttributeSafety = AttributeSafety::Unsafe {
226 note: "the `#[naked]` attribute adds the safety obligation that the function's body must respect the function’s calling convention, uphold its signature, and either return or diverge (i.e., not fall through past the end of the assembly code).",
227 unsafe_since: None,
228 };
· · ·
246 // * `#[test]`, `#[ignore]`, `#[should_panic]`
247 //
248 // NOTE: when making changes to this list, check that `error_codes/E0736.md` remains
249 // accurate.
250 const ALLOW_LIST: &[rustc_span::Symbol] = &[
· · ·
307
308 if other_attr.word_is(sym::target_feature) {
309 if !cx.features().naked_functions_target_feature() {
310 feature_err(
311 &cx.sess(),
· · ·
312 sym::naked_functions_target_feature,
313 other_attr.span(),
314 "`#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions",
+ 8 more matches in this file
compiler/rustc_attr_parsing/src/attributes/mod.rs RUST 6 matches · showing 5 view file →
2//!
3//! This module defines traits for attribute parsers, little state machines that recognize and parse
4//! attributes out of a longer list of attributes. The main trait is called [`AttributeParser`].
5//! You can find more docs about [`AttributeParser`]s on the trait itself.
6//! However, for many types of attributes, implementing [`AttributeParser`] is not necessary.
· · ·
89///
90/// Then, it defines what paths this group will accept in [`AttributeParser::ATTRIBUTES`].
91/// These are listed as pairs, of symbols and function pointers. The function pointer will
92/// be called when that attribute is found on an item, which can influence the state of the little
93/// state machine.
· · ·
94///
95/// Finally, after all attributes on an item have been seen, and possibly been accepted,
96/// the [`finalize`](AttributeParser::finalize) functions for all attribute parsers are called. Each can then report
97/// whether it has seen the attribute it has been looking for.
98///
· · ·
104 /// The symbols for the attributes that this parser is interested in.
105 ///
106 /// If an attribute has this symbol, the `accept` function will be called on it.
107 const ATTRIBUTES: AcceptMapping<Self>;
108 const ALLOWED_TARGETS: AllowedTargets;
· · ·
196 Ignore,
197
198 /// Custom function called when a duplicate attribute is found.
199 ///
200 /// - `unused` is the span of the attribute that was unused or bad because of some
+ 1 more matches in this file
compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs RUST 8 matches · showing 5 view file →
17};
18
19pub(crate) struct RustcMainParser;
20
21impl NoArgsAttributeParser for RustcMainParser {
· · ·
21impl NoArgsAttributeParser for RustcMainParser {
22 const PATH: &[Symbol] = &[sym::rustc_main];
23 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
· · ·
22 const PATH: &[Symbol] = &[sym::rustc_main];
23 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
24 const STABILITY: AttributeStability = unstable!(
· · ·
25 rustc_attrs,
26 "the `#[rustc_main]` attribute is used internally to specify test entry point function"
27 );
28 const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcMain;
· · ·
28 const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcMain;
29}
30
+ 3 more matches in this file
compiler/rustc_attr_parsing/src/context.rs RUST 5 matches view file →
201 Single<MustUseParser>,
202 Single<OptimizeParser>,
203 Single<PatchableFunctionEntryParser>,
204 Single<PathAttributeParser>,
205 Single<PatternComplexityLimitParser>,
· · ·
206 Single<ProcMacroDeriveParser>,
207 Single<RecursionLimitParser>,
208 Single<ReexportTestHarnessMainParser>,
209 Single<RustcAbiParser>,
210 Single<RustcAllocatorZeroedVariantParser>,
· · ·
259 Single<WithoutArgs<NoImplicitPreludeParser>>,
260 Single<WithoutArgs<NoLinkParser>>,
261 Single<WithoutArgs<NoMainParser>>,
262 Single<WithoutArgs<NoMangleParser>>,
263 Single<WithoutArgs<NoStdParser>>,
· · ·
307 Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
308 Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,
309 Single<WithoutArgs<RustcMainParser>>,
310 Single<WithoutArgs<RustcNeverReturnsNullPtrParser>>,
311 Single<WithoutArgs<RustcNoImplicitAutorefsParser>>,
· · ·
500 ///
501 /// This is a higher-level (and harder to misuse) wrapper over [`ArgParser::as_list`] that
502 /// allows using `?` when the attribute parsing function allows it. You may still want to use
503 /// [`ArgParser::as_list`] for the following reasons:
504 ///
compiler/rustc_attr_parsing/src/lib.rs RUST 5 matches view file →
11//! This crate (`rustc_attr_parsing`) handles how to convert raw tokens into those structures.
12//! This split allows other parts of the compiler to use the data structures without needing
13//! the parsing logic, making the codebase more modular and maintainable.
14//!
15//! ## Background
· · ·
16//! Previously, the compiler had a single attribute definition ([`ast::Attribute`]) with parsing and
17//! validation scattered throughout the codebase. This was reorganized for better maintainability
18//! (see [#131229](https://github.com/rust-lang/rust/issues/131229)).
19//!
· · ·
20//! ## Types of Attributes
21//! In Rust, attributes are markers that can be attached to items. They come in two main categories.
22//!
23//! ### 1. Active Attributes
· · ·
32//! They can be user-defined (in proc-macro helpers) or built-in. Examples of built-in inert attributes:
33//! - `#[stable()]`: Marks stable API items
34//! - `#[inline()]`: Suggests function inlining
35//! - `#[repr()]`: Controls type representation
36//!
· · ·
82//! However, sometimes an attributes' parsed form is needed before the HIR is constructed.
83//! This is referred to as "early" attribute parsing,
84//! and is performed using the `parse_limited_*` family of functions on `AttributeParser`.
85//!
86//! [`ast::Attribute`]: rustc_ast::ast::Attribute
compiler/rustc_borrowck/src/dataflow.rs RUST 31 matches · showing 5 view file →
9use rustc_mir_dataflow::fmt::DebugWithContext;
10use rustc_mir_dataflow::impls::{
11 EverInitializedPlaces, EverInitializedPlacesDomain, MaybeUninitializedPlaces,
12 MaybeUninitializedPlacesDomain,
13};
· · ·
12 MaybeUninitializedPlacesDomain,
13};
14use rustc_mir_dataflow::{Analysis, GenKill, JoinSemiLattice};
· · ·
27
28impl<'a, 'tcx> Analysis<'tcx> for Borrowck<'a, 'tcx> {
29 type Domain = BorrowckDomain;
30
31 const NAME: &'static str = "borrowck";
· · ·
32
33 fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
34 BorrowckDomain {
35 borrows: self.borrows.bottom_value(body),
· · ·
34 BorrowckDomain {
35 borrows: self.borrows.bottom_value(body),
36 uninits: self.uninits.bottom_value(body),
+ 26 more matches in this file
compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs RUST 45 matches · showing 5 view file →
464 && let Some(pos) = args.iter().position(|arg| arg.hir_id == expr.hir_id)
465 {
466 // The move occurred as one of the arguments to a function call. Is that
467 // argument generic? `def_id` can't be a closure here, so using `fn_sig` is fine
468 let arg_param = if self.infcx.tcx.def_kind(def_id).is_fn_like()
· · ·
478
479 // If the moved value is a mut reference, it is used in a
480 // generic function and it's type is a generic param, it can be
481 // reborrowed to avoid moving.
482 // for example:
· · ·
514 && let Some(arg) = fn_decl.inputs.get(pos + offset)
515 {
516 // If we can't suggest borrowing in the call, but the function definition
517 // is local, instead offer changing the function to borrow that argument.
518 let mut span: MultiSpan = arg.span.into();
· · ·
517 // is local, instead offer changing the function to borrow that argument.
518 let mut span: MultiSpan = arg.span.into();
519 span.push_span_label(
· · ·
522 );
523 let descr = match node.fn_kind() {
524 Some(hir::intravisit::FnKind::ItemFn(..)) | None => "function",
525 Some(hir::intravisit::FnKind::Method(..)) => "method",
526 Some(hir::intravisit::FnKind::Closure) => "closure",
+ 40 more matches in this file
compiler/rustc_borrowck/src/diagnostics/move_errors.rs RUST 3 matches view file →
30
31 /// Illegal move due to attempt to move from field of an ADT that
32 /// implements `Drop`. Rust maintains invariant that all `Drop`
33 /// ADT's remain fully-initialized so that user-defined destructor
34 /// can safely read from all of the ADT's fields.
· · ·
33 /// ADT's remain fully-initialized so that user-defined destructor
34 /// can safely read from all of the ADT's fields.
35 InteriorOfTypeWithDestructor { container_ty: Ty<'tcx> },
· · ·
365 // LL | let mut var = None;
366 // | ------- captured outer variable
367 // LL | func(|| {
368 // | -- captured by this `FnMut` closure
369 // LL | // Shouldn't suggest `move ||.as_ref()` here
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_borrowck/src/nll.rs RUST 5 matches view file →
51
52/// Rewrites the regions in the MIR to use NLL variables, also scraping out the set of universal
53/// regions (e.g., region parameters) declared on the function. That set will need to be given to
54/// `compute_regions`.
55#[instrument(skip(infcx, body, promoted), level = "debug")]
· · ·
66 let universal_regions = UniversalRegions::new(infcx, def);
67
68 // Replace all remaining regions with fresh inference variables.
69 renumber::renumber_mir(infcx, body, promoted);
70
· · ·
80/// This is intended to be used by before [BorrowCheckRootCtxt::handle_opaque_type_uses]
81/// because applying member constraints may rely on closure requirements.
82/// This is frequently the case of async functions where pretty much everything
83/// happens inside of the inner async block but the opaque only gets constrained
84/// in the parent function.
· · ·
84/// in the parent function.
85pub(crate) fn compute_closure_requirements_modulo_opaques<'tcx>(
86 infcx: &BorrowckInferCtxt<'tcx>,
· · ·
300 }
301
302 // When the enclosing function is tagged with `#[rustc_regions]`,
303 // we dump out various bits of state as warnings. This is useful
304 // for verifying that the compiler is behaving as expected. These
compiler/rustc_borrowck/src/places_conflict.rs RUST 3 matches view file →
76}
77
78/// Helper function for checking if places conflict with a mutable borrow and deep access depth.
79/// This is used to check for places conflicting outside of the borrow checking code (such as in
80/// dataflow).
· · ·
115
116 if borrow_local != access_local {
117 // We have proven the borrow disjoint - further projections will remain disjoint.
118 return false;
119 }
· · ·
184 Overlap::Disjoint => {
185 // We have proven the borrow disjoint - further
186 // projections will remain disjoint.
187 debug!("disjoint");
188 return false;
compiler/rustc_borrowck/src/region_infer/mod.rs RUST 3 matches view file →
118
119 /// Information about how the universally quantified regions in
120 /// scope on this function relate to one another.
121 universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
122}
· · ·
371 // For each universally quantified region (lifetime parameter). The
372 // first N variables always correspond to the regions appearing in the
373 // function signature (both named and anonymous) and in where-clauses.
374 match definition.origin {
375 // For each free, universally quantified region X:
· · ·
1190 assert!(self.max_nameable_universe(longer_fr_scc).is_root());
1191
1192 // Only check all of the relations for the main representative of each
1193 // SCC, otherwise just check that we outlive said representative. This
1194 // reduces the number of redundant relations propagated out of
compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs RUST 8 matches · showing 5 view file →
91/// See the corresponding [rustc-dev-guide chapter] for more details. This
92/// ignores changes to the region values due to member constraints. Applying
93/// member constraints does not impact the result of this function.
94///
95/// [rustc-dev-guide chapter]: https://rustc-dev-guide.rust-lang.org/borrow_check/opaque-types-region-inference-restrictions.html
· · ·
191
192/// This computes the actual hidden types of the opaque types and maps them to their
193/// definition sites. Outside of registering the computed hidden types this function
194/// does not mutate the current borrowck state.
195///
· · ·
199/// defining scope.
200///
201/// It also means that this whole function is not really soundness critical as we
202/// recheck all uses of the opaques regardless.
203pub(crate) fn compute_definition_site_hidden_types<'tcx>(
· · ·
215 // We don't mutate the region graph used by `fn compute_regions` but instead
216 // manually track region information via a `RegionCtxt`. We discard this
217 // information at the end of this function.
218 let mut rcx = RegionCtxt::new(infcx, universal_region_relations, location_map, constraints);
219
· · ·
521}
522
523/// This function is what actually applies member constraints to the borrowck
524/// state. It is also responsible to check all uses of the opaques in their
525/// defining scope.
+ 3 more matches in this file
compiler/rustc_borrowck/src/type_check/liveness/trace.rs RUST 5 matches view file →
179 ///
180 /// Add facts for all locals with free regions, since regions may outlive
181 /// the function body only at certain nodes in the CFG.
182 fn add_extra_drop_facts(&mut self, relevant_live_locals: &[Local]) {
183 // This collect is more necessary than immediately apparent
· · ·
463 ///
464 /// In practice, the results of this dataflow analysis are rarely needed but can be expensive to
465 /// compute on big functions, so we compute them lazily as a fast path when:
466 /// - there are relevant live locals
467 /// - there are drop points for these relevant live locals.
· · ·
473 let tcx = self.typeck.tcx();
474 let body = self.typeck.body;
475 // FIXME: reduce the `MaybeInitializedPlaces` domain to the useful `MovePath`s.
476 //
477 // This dataflow analysis computes maybe-initializedness of all move paths, which
· · ·
478 // explains why it can be expensive on big functions. But this data is only used in
479 // drop-liveness. Therefore, most of the move paths computed here are ultimately unused,
480 // even if the results are computed lazily and "no relevant live locals with drop
· · ·
482 //
483 // So we only need the ones for 1) relevant live locals 2) that have drop points. That's
484 // a much, much smaller domain: in our benchmarks, when it's not zero (the most likely
485 // case), there are a few dozens compared to e.g. thousands or tens of thousands of
486 // locals and move paths.
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_borrowck/src/universal_regions.rs RUST 13 matches · showing 5 view file →
1//! Code to extract the universally quantified regions declared on a
2//! function. For example:
3//!
4//! ```
· · ·
64 num_universals: usize,
65
66 /// The "defining" type for this function, with all universal
67 /// regions instantiated. For a closure or coroutine, this is the
68 /// closure type, but for a top-level function it's the `FnDef`.
· · ·
68 /// closure type, but for a top-level function it's the `FnDef`.
69 pub defining_ty: DefiningTy<'tcx>,
70
· · ·
71 /// The return type of this function, with all regions replaced by
72 /// their universal `RegionVid` equivalents.
73 ///
· · ·
76 pub unnormalized_output_ty: Ty<'tcx>,
77
78 /// The fully liberated input types of this function, with all
79 /// regions replaced by their universal `RegionVid` equivalents.
80 ///
+ 8 more matches in this file
compiler/rustc_borrowck/src/used_muts.rs RUST 3 matches view file →
13 ///
14 /// `temporary_used_locals` should contain locals that were found to be temporary, mutable and
15 /// used from borrow checking. This function looks for assignments into these locals from
16 /// user-declared locals and adds those user-defined locals to the `used_mut` set. This can
17 /// occur due to a rare case involving upvars in closures.
· · ·
19 /// `never_initialized_mut_locals` should contain the set of user-declared mutable locals
20 /// (not arguments) that have not already been marked as being used.
21 /// This function then looks for assignments from statements or the terminator into the locals
22 /// from this set and removes them from the set. This leaves only those locals that have not
23 /// been assigned to - this set is used as a proxy for locals that were not initialized due to
· · ·
56 fn remove_never_initialized_mut_locals(&mut self, into: Place<'_>) {
57 // Remove any locals that we found were initialized from the
58 // `never_initialized_mut_locals` set. At the end, the only remaining locals will
59 // be those that were never initialized - we will consider those as being used as
60 // they will either have been removed by unreachable code optimizations; or linted
compiler/rustc_builtin_macros/src/deriving/generic/mod.rs RUST 14 matches · showing 5 view file →
59//! variants, it is represented as a count of 0.
60//!
61//! # "`cs`" functions
62//!
63//! The `cs_...` functions ("combine substructure") are designed to
· · ·
63//! The `cs_...` functions ("combine substructure") are designed to
64//! make life easier by providing some pre-made recipes for common
65//! threads; mostly calling the function being derived on all the
· · ·
65//! threads; mostly calling the function being derived on all the
66//! arguments and then combining them back together in some way (or
67//! letting the user chose that). They are not meant to be the only
· · ·
240 pub generics: Bounds,
241
242 /// Is there is a `&self` argument? If not, it is a static function.
243 pub explicit_self: bool,
244
· · ·
253 pub fieldless_variants_strategy: FieldlessVariantsStrategy,
254
255 pub combine_substructure: RefCell<CombineSubstructureFunc<'a>>,
256}
257
+ 9 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.