24,437 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 →
387 /// [llvm data layout string](https://llvm.org/docs/LangRef.html#data-layout)
388 ///
389 /// This function doesn't fill `c_enum_min_size` and it will always be `I32` since it can not be
390 /// determined from llvm string.
391 pub fn parse_from_llvm_datalayout_string<'a>(
· · ·
598 ///
599 /// The theoretical maximum object size is defined as the maximum positive `isize` value.
600 /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly
601 /// index every address within an object along with one byte past the end, along with allowing
602 /// `isize` to store the difference between any two pointers into an object.
· · ·
617 ///
618 /// The theoretical maximum object size is defined as the maximum positive `isize` value.
619 /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly
620 /// index every address within an object along with one byte past the end, along with allowing
621 /// `isize` to store the difference between any two pointers into an object.
· · ·
1818 // FIXME(rustc_scalable_vector): Scalable vectors are `Sized` while the
1819 // `sized_hierarchy` feature is not yet fully implemented. After `sized_hierarchy` is
1820 // fully implemented, scalable vectors will remain `Sized`, they just won't be
1821 // `const Sized` - whether `is_unsized` continues to return `false` at that point will
1822 // need to be revisited and will depend on what `is_unsized` is used for.
· · ·
1983 /// For example, `Option<(usize, &T)>` is represented such that the tag for
1984 /// `None` is the null pointer in the second tuple field, and
1985 /// `Some` is the identity function (with a non-null reference)
1986 /// and has no additional tag, i.e. the reference being non-null uniquely identifies this variant.
1987 ///
+ 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.
· · ·
185}
186
187/// Like `join_path_syms`, but for `Ident`s. This function is necessary because
188/// `Ident::to_string` does more than just print the symbol in the `name` field.
189pub fn join_path_idents(path: impl IntoIterator<Item = impl Borrow<Ident>>) -> String {
· · ·
467
468/// Represents lifetime, type and const parameters attached to a declaration of
469/// a function, enum, trait, etc.
470#[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)]
471pub 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
· · ·
762
763 // This is only used by the MutVisitor. We include this symmetry here to make writing other
764 // functions easier.
765 $(${ignore($lt)}
766 #[expect(unused, rustc::disallowed_pass_by_ref)]
· · ·
821 ) -> V::Result {
822 match self {
823 ItemKind::Fn(func) => {
824 let kind = FnKind::Fn(FnCtxt::Free, visibility, &$($mut)? *func);
825 try_visit!(vis.visit_fn(kind, attrs, span, id));
· · ·
824 let kind = FnKind::Fn(FnCtxt::Free, visibility, &$($mut)? *func);
825 try_visit!(vis.visit_fn(kind, attrs, span, id));
826 }
· · ·
883 AssocItemKind::Const(item) =>
884 visit_visitable!($($mut)? vis, item),
885 AssocItemKind::Fn(func) => {
886 let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), visibility, &$($mut)? *func);
887 try_visit!(vis.visit_fn(kind, attrs, span, id))
+ 5 more matches in this file
compiler/rustc_ast_lowering/src/errors.rs RUST 6 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`")]
· · ·
138
139#[derive(Diagnostic)]
140#[diag("functional record updates are not allowed in destructuring assignments")]
141pub(crate) struct FunctionalRecordUpdateDestructuringAssignment {
142 #[primary_span]
· · ·
141pub(crate) struct FunctionalRecordUpdateDestructuringAssignment {
142 #[primary_span]
143 #[suggestion(
+ 1 more matches in this file
compiler/rustc_ast_lowering/src/expr.rs RUST 7 matches · showing 5 view file →
19use super::errors::{
20 AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, ClosureCannotBeStatic,
21 CoroutineTooManyParameters, FunctionalRecordUpdateDestructuringAssignment,
22 InclusiveRangeWithNoEnd, MatchArmWithNoBody, NeverPatternWithBody, NeverPatternWithGuard,
23 UnderscoreExprLhsAssign,
· · ·
712 let coroutine_kind = hir::CoroutineKind::Desugared(desugaring_kind, coroutine_source);
713
714 // The `async` desugaring takes a resume argument and maintains a `task_context`,
715 // whereas a generator does not.
716 let (inputs, params, task_context): (&[_], &[_], _) = match desugaring_kind {
· · ·
896 // Note that the name of this binding must not be changed to something else because
897 // debuggers and debugger extensions expect it to be called `__awaitee`. They use
898 // this name to identify what is being awaited by a suspended async functions.
899 let awaitee_ident = Ident::with_dummy_span(sym::__awaitee);
900 let (awaitee_pat, awaitee_pat_hid) =
· · ·
1428 let fields_omitted = match &se.rest {
1429 StructRest::Base(e) => {
1430 self.dcx().emit_err(FunctionalRecordUpdateDestructuringAssignment {
1431 span: e.span,
1432 });
· · ·
2006
2007 let (constructor_item, target_id) = match self.try_block_scope {
2008 TryBlockScope::Function => {
2009 (hir::LangItem::TryTraitFromResidual, Err(hir::LoopIdError::OutsideLoopScope))
2010 }
+ 2 more matches in this file
compiler/rustc_ast_lowering/src/lib.rs RUST 18 matches · showing 5 view file →
188
189 // Lowering state.
190 try_block_scope: TryBlockScope::Function,
191 loop_scope: None,
192 is_in_loop_condition: false,
· · ·
262
263 // We do not need to look at `partial_res_overrides`. That map only contains overrides for
264 // `self_param` locals. And here we are looking for the function definition that `expr`
265 // resolves to.
266 let def_id = self.partial_res_map.get(&expr.id)?.full_res()?.opt_def_id()?;
· · ·
452enum TryBlockScope {
453 /// There isn't a `try` block, so a `?` will use `return`.
454 Function,
455 /// We're inside a `try { … }` block, so a `?` will block-break
456 /// from that block using a type depending only on the argument.
· · ·
686 /// The lowered item is registered into `self.children`.
687 ///
688 /// This function sets up `HirId` lowering infrastructure,
689 /// and stashes the shared mutable state to avoid pollution by the closure.
690 #[instrument(level = "debug", skip(self, f))]
· · ·
844 // This can happen when trying to lower the return type `x` in erroneous code like
845 // async fn foo(x: u8) -> x {}
846 // In that case, `x` is lowered as a function parameter, and the return type is lowered as
847 // an opaque type as a synthesized HIR owner.
848 res.unwrap_or(Res::Err)
+ 13 more matches in this file
compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs RUST 10 matches · showing 5 view file →
6use crate::attributes::AttributeSafety;
7use crate::session_diagnostics::{
8 NakedFunctionIncompatibleAttribute, NullOnExport, NullOnObjcClass, NullOnObjcSelector,
9 ObjcClassExpectedStringLiteral, ObjcSelectorExpectedStringLiteral,
10};
· · ·
227 // * `#[test]`, `#[ignore]`, `#[should_panic]`
228 //
229 // NOTE: when making changes to this list, check that `error_codes/E0736.md` remains
230 // accurate.
231 const ALLOW_LIST: &[rustc_span::Symbol] = &[
· · ·
288
289 if other_attr.word_is(sym::target_feature) {
290 if !cx.features().naked_functions_target_feature() {
291 feature_err(
292 &cx.sess(),
· · ·
293 sym::naked_functions_target_feature,
294 other_attr.span(),
295 "`#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions",
· · ·
295 "`#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions",
296 ).emit();
297 }
+ 5 more matches in this file
compiler/rustc_attr_parsing/src/attributes/mod.rs RUST 6 matches · showing 5 view file →
1//! This module defines traits for attribute parsers, little state machines that recognize and parse
2//! attributes out of a longer list of attributes. The main trait is called [`AttributeParser`].
3//! You can find more docs about [`AttributeParser`]s on the trait itself.
4//! However, for many types of attributes, implementing [`AttributeParser`] is not necessary.
· · ·
81///
82/// Then, it defines what paths this group will accept in [`AttributeParser::ATTRIBUTES`].
83/// These are listed as pairs, of symbols and function pointers. The function pointer will
84/// be called when that attribute is found on an item, which can influence the state of the little
85/// state machine.
· · ·
86///
87/// Finally, after all attributes on an item have been seen, and possibly been accepted,
88/// the [`finalize`](AttributeParser::finalize) functions for all attribute parsers are called. Each can then report
89/// whether it has seen the attribute it has been looking for.
90///
· · ·
96 /// The symbols for the attributes that this parser is interested in.
97 ///
98 /// If an attribute has this symbol, the `accept` function will be called on it.
99 const ATTRIBUTES: AcceptMapping<Self>;
100 const ALLOWED_TARGETS: AllowedTargets;
· · ·
183 Ignore,
184
185 /// Custom function called when a duplicate attribute is found.
186 ///
187 /// - `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 6 matches · showing 5 view file →
16};
17
18pub(crate) struct RustcMainParser;
19
20impl NoArgsAttributeParser for RustcMainParser {
· · ·
20impl NoArgsAttributeParser for RustcMainParser {
21 const PATH: &[Symbol] = &[sym::rustc_main];
22 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
· · ·
21 const PATH: &[Symbol] = &[sym::rustc_main];
22 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
23 const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcMain;
· · ·
23 const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcMain;
24}
25
· · ·
29 const PATH: &[Symbol] = &[sym::rustc_must_implement_one_of];
30 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
31 const TEMPLATE: AttributeTemplate = template!(List: &["function1, function2, ..."]);
32 fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
33 let list = cx.expect_list(args, cx.attr_span)?;
+ 1 more matches in this file
compiler/rustc_attr_parsing/src/context.rs RUST 5 matches view file →
191 Single<MustUseParser>,
192 Single<OptimizeParser>,
193 Single<PatchableFunctionEntryParser>,
194 Single<PathAttributeParser>,
195 Single<PatternComplexityLimitParser>,
· · ·
196 Single<ProcMacroDeriveParser>,
197 Single<RecursionLimitParser>,
198 Single<ReexportTestHarnessMainParser>,
199 Single<RustcAbiParser>,
200 Single<RustcAllocatorZeroedVariantParser>,
· · ·
247 Single<WithoutArgs<NoImplicitPreludeParser>>,
248 Single<WithoutArgs<NoLinkParser>>,
249 Single<WithoutArgs<NoMainParser>>,
250 Single<WithoutArgs<NoMangleParser>>,
251 Single<WithoutArgs<NoStdParser>>,
· · ·
294 Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
295 Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,
296 Single<WithoutArgs<RustcMainParser>>,
297 Single<WithoutArgs<RustcNeverReturnsNullPtrParser>>,
298 Single<WithoutArgs<RustcNoImplicitAutorefsParser>>,
· · ·
485 ///
486 /// This is a higher-level (and harder to misuse) wrapper over [`ArgParser::as_list`] that
487 /// allows using `?` when the attribute parsing function allows it. You may still want to use
488 /// [`ArgParser::as_list`] for the following reasons:
489 ///
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// tidy-alphabetical-start
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 44 matches · showing 5 view file →
462 && let Some(pos) = args.iter().position(|arg| arg.hir_id == expr.hir_id)
463 {
464 // The move occurred as one of the arguments to a function call. Is that
465 // argument generic? `def_id` can't be a closure here, so using `fn_sig` is fine
466 let arg_param = if self.infcx.tcx.def_kind(def_id).is_fn_like()
· · ·
476
477 // If the moved value is a mut reference, it is used in a
478 // generic function and it's type is a generic param, it can be
479 // reborrowed to avoid moving.
480 // for example:
· · ·
512 && let Some(arg) = fn_decl.inputs.get(pos + offset)
513 {
514 // If we can't suggest borrowing in the call, but the function definition
515 // is local, instead offer changing the function to borrow that argument.
516 let mut span: MultiSpan = arg.span.into();
· · ·
515 // is local, instead offer changing the function to borrow that argument.
516 let mut span: MultiSpan = arg.span.into();
517 span.push_span_label(
· · ·
520 );
521 let descr = match node.fn_kind() {
522 Some(hir::intravisit::FnKind::ItemFn(..)) | None => "function",
523 Some(hir::intravisit::FnKind::Method(..)) => "method",
524 Some(hir::intravisit::FnKind::Closure) => "closure",
+ 39 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> },
· · ·
359 // LL | let mut var = None;
360 // | ------- captured outer variable
361 // LL | func(|| {
362 // | -- captured by this `FnMut` closure
363 // 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,
· · ·
153/// appear in the closure's signature or on its field types. These
154/// requirements are then verified and proved by the closure's
155/// creating function. This struct encodes those requirements.
156///
157/// The requirements are listed as being between various `RegionVid`. The 0th
· · ·
458 let diags_buffer = &mut BorrowckDiagnosticsBuffer::default();
459 // While promoteds should mostly be correct by construction, we need to check them for
460 // invalid moves to detect moving out of arrays:`struct S; fn main() { &([S][0]); }`.
461 for promoted_body in &promoted {
462 use rustc_middle::mir::visit::Visitor;
· · ·
558 .cloned()
559 .collect();
560 // For the remaining unused locals that are marked as mutable, we avoid linting any that
561 // were never initialized. These locals may have been removed as unreachable code; or will be
562 // linted as unused variables.
· · ·
631 let entry_states: EntryStates<_> =
632 itertools::izip!(borrows.entry_states, uninits.entry_states, ever_inits.entry_states)
633 .map(|(borrows, uninits, ever_inits)| BorrowckDomain { borrows, uninits, ever_inits })
634 .collect();
635
+ 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 4 matches view file →
117
118 /// Information about how the universally quantified regions in
119 /// scope on this function relate to one another.
120 universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
121}
· · ·
348 /// Initializes the region variables for each universally
349 /// quantified region (lifetime parameter). The first N variables
350 /// always correspond to the regions appearing in the function
351 /// signature (both named and anonymous) and where-clauses. This
352 /// function iterates over those regions and initializes them with
· · ·
352 /// function iterates over those regions and initializes them with
353 /// minimum values.
354 ///
· · ·
1199 assert!(self.max_nameable_universe(longer_fr_scc).is_root());
1200
1201 // Only check all of the relations for the main representative of each
1202 // SCC, otherwise just check that we outlive said representative. This
1203 // 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`
· · ·
218 /// recursing into them may corrupt your data structures if you're not careful.
219 promoted: &'a IndexSlice<Promoted, Body<'tcx>>,
220 /// User type annotations are shared between the main MIR and the MIR of
221 /// all of the promoted items.
222 user_type_annotations: &'a CanonicalUserTypeAnnotations<'tcx>,
· · ·
324 /// requires that `&'2 u32 = &'1 u32` -- but at what point? In the
325 /// older NLL analysis, we required this only at the entry point
326 /// to the function. By the nature of the constraints, this wound
327 /// up propagating to all points reachable from start (because
328 /// `'1` -- as a universal region -- is live everywhere). In the
· · ·
482 // Determine the constraints from the promoted MIR by running the type
483 // checker on the promoted MIR, then transfer the constraints back to
484 // the main MIR, changing the locations to the provided location.
485
486 let parent_body = mem::replace(&mut self.body, promoted_body);
· · ·
537
538 // If the region is live at least one location in the promoted MIR,
539 // then add a liveness constraint to the main MIR for this region
540 // at the location provided as an argument to this method
541 //
+ 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.