about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-4/+4
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-01Use `FieldIdx` in various things related to aggregatesScott McMurray-1/+1
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
2023-03-30Auto merge of #105587 - tgross35:once-cell-min, r=m-ou-sebors-1/+1
Partial stabilization of `once_cell` This PR aims to stabilize a portion of the `once_cell` feature: - `core::cell::OnceCell` - `std::cell::OnceCell` (re-export of the above) - `std::sync::OnceLock` This will leave `LazyCell` and `LazyLock` unstabilized, which have been moved to the `lazy_cell` feature flag. Tracking issue: https://github.com/rust-lang/rust/issues/74465 (does not fully close, but it may make sense to move to a new issue) Future steps for separate PRs: - ~~Add `#[inline]` to many methods~~ #105651 - Update cranelift usage of the `once_cell` crate - Update rust-analyzer usage of the `once_cell` crate - Update error messages discussing once_cell ## To be stabilized API summary ```rust // core::cell (in core/cell/once.rs) pub struct OnceCell<T> { .. } impl<T> OnceCell<T> { pub const fn new() -> OnceCell<T>; pub fn get(&self) -> Option<&T>; pub fn get_mut(&mut self) -> Option<&mut T>; pub fn set(&self, value: T) -> Result<(), T>; pub fn get_or_init<F>(&self, f: F) -> &T where F: FnOnce() -> T; pub fn into_inner(self) -> Option<T>; pub fn take(&mut self) -> Option<T>; } impl<T: Clone> Clone for OnceCell<T>; impl<T: Debug> Debug for OnceCell<T> impl<T> Default for OnceCell<T>; impl<T> From<T> for OnceCell<T>; impl<T: PartialEq> PartialEq for OnceCell<T>; impl<T: Eq> Eq for OnceCell<T>; ``` ```rust // std::sync (in std/sync/once_lock.rs) impl<T> OnceLock<T> { pub const fn new() -> OnceLock<T>; pub fn get(&self) -> Option<&T>; pub fn get_mut(&mut self) -> Option<&mut T>; pub fn set(&self, value: T) -> Result<(), T>; pub fn get_or_init<F>(&self, f: F) -> &T where F: FnOnce() -> T; pub fn into_inner(self) -> Option<T>; pub fn take(&mut self) -> Option<T>; } impl<T: Clone> Clone for OnceLock<T>; impl<T: Debug> Debug for OnceLock<T>; impl<T> Default for OnceLock<T>; impl<#[may_dangle] T> Drop for OnceLock<T>; impl<T> From<T> for OnceLock<T>; impl<T: PartialEq> PartialEq for OnceLock<T> impl<T: Eq> Eq for OnceLock<T>; impl<T: RefUnwindSafe + UnwindSafe> RefUnwindSafe for OnceLock<T>; unsafe impl<T: Send> Send for OnceLock<T>; unsafe impl<T: Sync + Send> Sync for OnceLock<T>; impl<T: UnwindSafe> UnwindSafe for OnceLock<T>; ``` No longer planned as part of this PR, and moved to the `rust_cell_try` feature gate: ```rust impl<T> OnceCell<T> { pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E> where F: FnOnce() -> Result<T, E>; } impl<T> OnceLock<T> { pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E> where F: FnOnce() -> Result<T, E>; } ``` I am new to this process so would appreciate mentorship wherever needed.
2023-03-29Stabilize a portion of 'once_cell'Trevor Gross-1/+1
Move items not part of this stabilization to 'lazy_cell' or 'once_cell_try'
2023-03-28Move `mir::Field` → `abi::FieldIdx`Scott McMurray-3/+4
The first PR for https://github.com/rust-lang/compiler-team/issues/606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
2023-03-23Auto merge of #108861 - b-naber:eager-nll-type-relating, r=lcnrbors-14/+4
Make NLL Type Relating Eager We previously instantiated bound regions in nll type relating lazily. Making this eager is more consistent with how we handle type relating in [`higher_ranked_sub`](https://github.com/rust-lang/rust/blob/0a3b557d528dd7c8a88ceca6f7dc0699b89a3ef4/compiler/rustc_infer/src/infer/higher_ranked/mod.rs#L28) and should allow us to short circuit in case there's structural equality.
2023-03-22assertion for only collection nll region variable information for debug in ↵b-naber-14/+4
non-canonicalization contexts
2023-03-17Remove VecMapMichael Goulet-2/+1
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-09Introduce a no-op PlaceMention statement for `let _ =`.Camille GILLOT-0/+2
2023-03-08Rollup merge of #108856 - Zeegomo:remove-drop-and-rep, r=tmiaskoMatthias Krüger-10/+0
Remove DropAndReplace terminator #107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-03-07Remove DropAndReplace terminatorGiacomo Pasini-10/+0
PR 107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-03-07Auto merge of #108735 - clubby789:borrowck-unstable, r=Nilstriebbors-11/+10
Remove `allow(potential_query_instability)` from `borrowck` cc #84447 Replace uses of `FxHash*` with `FxIndex*`. One `#[allow]` for a HashMap in an external crate but the output is sorted afterwards.
2023-03-05Remove `allow(potential_query_instability)` from `borrowck`clubby789-11/+10
2023-03-03use helper function for error reportingGiacomo Pasini-17/+3
2023-03-03Desugars drop and replace at MIR buildGiacomo Pasini-8/+17
This commit desugars the drop and replace deriving from an assignment at MIR build, avoiding the construction of the DropAndReplace terminator (which will be removed in a followign PR) In order to retain the same error messages for replaces a new DesugaringKind::Replace variant is introduced.
2023-02-26Access upvars through a query.Camille GILLOT-5/+5
2023-02-23Rollup merge of #108350 - compiler-errors:assoc-type-bound-dogfooding, r=oli-obkMatthias Krüger-0/+1
Use associated type bounds in some places in the compiler Use associated type bounds for some nested `impl Trait<Assoc = impl Trait2>` cases. I'm generally keen to introduce new lang features that are more mature into the compiler, but maybe let's see what others think? Side-note: I was surprised that the only use-cases of nested impl trait in the compiler are just iterator related?!
2023-02-22errors: generate typed identifiers in each crateDavid Wood-1/+4
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21address reviewb-naber-2/+2
2023-02-21Associated type bounds in some places in the compilerMichael Goulet-0/+1
2023-02-19add some cfgs backb-naber-23/+33
2023-02-19remove cfgsb-naber-21/+0
2023-02-19some conditional importsb-naber-0/+1
2023-02-19collect region contexts during mir renumberingb-naber-14/+76
2023-02-19add BorrowckInferCtxtb-naber-1/+29
2023-02-02Put a DefId in AggregateKind.Camille GILLOT-0/+1
2023-01-23During MirBorrowck, ignore ConstEvalCounterBryan Garza-3/+3
2023-01-23Revert "Move CtfeLimit to mir_const's set of passes"Bryan Garza-2/+2
This reverts commit 332542a92223b2800ed372d2d461921147f29477.
2023-01-23Move CtfeLimit to mir_const's set of passesBryan Garza-2/+2
2023-01-23Create stable metric to measure long computation in Const EvalBryan Garza-1/+2
This patch adds a `MirPass` that tracks the number of back-edges and function calls in the CFG, adds a new MIR instruction to increment a counter every time they are encountered during Const Eval, and emit a warning if a configured limit is breached.
2023-01-21Auto merge of #106976 - tmiasko:borrowck-lazy-dominators, r=cjgillotbors-6/+10
Lazy dominator tree construction in borrowck Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-17Lazy dominator tree construction in borrowckTomasz Miąsko-6/+10
Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2023-01-04Merge borrowck permission checksGiacomo Pasini-37/+11
Merge `check_access_permission` and `check_if_reassignment_to_immutable_state`. The goal of this commit is twofold: First, we simplify the codebase by removing duplicate logic. Second, we avoid duplicate reporting of illegal reassignment errors by reusing the exiting de-duplicating logic of access_place.
2023-01-01Merge multiple mutable borrows of immutable binding errorsEsteban Küber-0/+24
Fix #53466.
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-4/+1
2022-12-19clippy::complexity fixesMatthias Krüger-6/+1
filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool
2022-12-09Remove unneeded field from `SwitchTargets`Jakob Degen-1/+1
2022-12-06`rustc_borrowck`: remove `ref` patternsMaybe Waffle-34/+35
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+1
2022-11-18require an `ErrorGuaranteed` to taint infcx with errorsBoxy-1/+1
2022-11-18rename `is_tainted_by_errors` Boxy-3/+7
2022-11-18`InferCtxt::is_tainted_by_errors` returns `ErrorGuaranteed`Boxy-1/+1
2022-11-18dont unchecked create `ErrorGuaranteed` in `BorrowckErrors`Boxy-10/+12
2022-11-08Add support for custom MIR parsingJakob Degen-0/+14
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-8/+5
2022-10-07Remove TypeckResults from InferCtxtCameron Steffen-3/+3
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-1/+1
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`