about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
AgeCommit message (Collapse)AuthorLines
2023-10-21Do not report errors from move path builder.Camille GILLOT-112/+267
2023-10-21Make `ty::print::Printer` take `&mut self` instead of `self`Nilstrieb-2/+4
This simplifies the code by removing all the `self` assignments and makes the flow of data clearer - always into the printer. Especially in v0 mangling, which already used `&mut self` in some places, it gets a lot more uniform.
2023-10-21Rollup merge of #116990 - estebank:issue-68445, r=cjgillotMatthias Krüger-0/+22
Mention `into_iter` on borrow errors suggestions when appropriate If we encounter a borrow error on `vec![1, 2, 3].iter()`, suggest `into_iter`. Fix #68445.
2023-10-20Rename `CoroutineKind::Gen` to `::Coroutine`Oli Scherer-2/+2
2023-10-20s/generator/coroutine/Oli Scherer-104/+104
2023-10-20s/Generator/Coroutine/Oli Scherer-69/+69
2023-10-20consider a loan escapes the function via applied member constraintsRémy Rakic-12/+14
2023-10-20Mention `into_iter` on borrow errors suggestions when appropriateEsteban Küber-0/+22
If we encounter a borrow error on `vec![1, 2, 3].iter()`, suggest `into_iter`. Fix #68445.
2023-10-19make `applied_member_constraints` accept an SCC instead of a regionRémy Rakic-6/+7
2023-10-18revert rust-lang/rust#114586Ali MJ Al-Nasrawy-20/+13
2023-10-17Auto merge of #116822 - notriddle:notriddle/rust-logo, r=fmeasebors-1/+3
docs: add Rust logo to more compiler crates c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more. r? `@GuillaumeGomez`
2023-10-17Use a visitor that could be reused by opaque type capture check laterMichael Goulet-99/+13
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-1/+3
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-10-16Remove `DefiningAnchor::Bubble` from opaque wf checkMichael Goulet-8/+8
2023-10-16Avoid unnecessary renumberingJonáš Fiala-0/+4
2023-10-14Consider static speciallyMichael Goulet-8/+20
2023-10-14Consider param-env candidates, tooMichael Goulet-1/+21
2023-10-14Consider alias bounds when considering lliveness for alias types in NLLMichael Goulet-19/+76
2023-10-13Format all the let chains in compilerMichael Goulet-195/+183
2023-10-12Auto merge of #113487 - estebank:sugg-113174, r=oli-obkbors-23/+149
Use structured suggestion for #113174 When encountering a for loop that is rejected by the borrow checker because it is being advanced within its body, provide a structured suggestion for `while let Some(pat) = iter.next()`.
2023-10-11Use structured suggestion for #113174Esteban Küber-23/+149
When encountering a for loop that is rejected by the borrow checker because it is being advanced within its body, provide a structured suggestion for `while let Some(pat) = iter.next()`.
2023-10-11Auto merge of #113218 - lqd:polonius-scopes, r=jackh726bors-34/+360
Compute NLL loan scopes using the polonius model For a *location-insensitive* analysis (that is, without expressiveness improvements for users yet), this PR implements loans going out of scope using reachability and liveness, rather than checking if the issuing region's values contain a given CFG point. This is equivalent to NLL scopes and computes the same data. r? `@matthewjasper` A couple of notes: - there are some assumptions about SCC representatives, placeholders, free regions, and member constraints that I believe hold, and they're documented in the code - this passes all the UI tests with `-Zpolonius=next` -- the perf is [not terrible](https://github.com/rust-lang/rust/pull/112432#issuecomment-1749685862) and there are a bunch of ways to improve it in the future. - there's a fixme left, hopefully Matthew you know a clean way to get the information it mentions.
2023-10-06Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiserbors-1/+1
Show more information when multiple `impl`s apply - When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s). ``` error[E0283]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); | ^ ---- type must be known at this point | note: multiple `impl`s satisfying `_: From<Baz>` found --> $DIR/multiple-impl-apply.rs:14:1 | LL | impl From<Baz> for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl From<Baz> for Foo { | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); | ++++++++++++ ``` - Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user. - Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases. ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/cross-return-site-inference.rs:38:16 | LL | return Err(From::from("foo")); | ^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation | LL | return Err(</* self type */ as From>::from("foo")); | +++++++++++++++++++ + ``` Fix #88284.
2023-10-05compute NLL loan scopes with liveness in `-Zpolonius=next`Rémy Rakic-28/+339
2023-10-05allow access to liveness' `PointIndex`esRémy Rakic-0/+5
2023-10-05add note why a function is pubRémy Rakic-0/+1
2023-10-05Rollup merge of #116223 - catandcoder:master, r=cjgillotJubilee-6/+6
Fix misuses of a vs an Fixes the misuse of "a" vs "an", according to English grammatical expectations and using https://www.a-or-an.com/
2023-10-04document Borrows dataflow analysisRémy Rakic-0/+7
2023-10-04rename ancient regioncxRémy Rakic-2/+2
2023-10-04introduce `Polonius` enum for `-Zpolonius`Rémy Rakic-4/+6
this allows to opt into using the legacy version or the in-tree prototype
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-1/+1
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
2023-10-04Fix misuses of a vs ancui fliter-6/+6
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-02have better explanation for `relate_types`ouz-a-5/+3
2023-10-02change is_subtype to relate_typesouz-a-9/+8
2023-10-02Add docs, remove code, change subtyper codeouz-a-7/+16
2023-10-02subtyping_projectionsouz-a-0/+12
2023-09-27fix clippy::{redundant_guards, useless_format}Matthias Krüger-2/+2
2023-09-27Auto merge of #116163 - compiler-errors:lazyness, r=oli-obkbors-1/+1
Don't store lazyness in `DefKind::TyAlias` 1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query. 2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase. r? `@oli-obk` cc `@fmease`
2023-09-26subst -> instantiatelcnr-7/+6
2023-09-26Don't store lazyness in DefKindMichael Goulet-1/+1
2023-09-24Remove span from BrAnon.Camille GILLOT-35/+19
2023-09-24Try to use approximate placeholder regions when outputting an ↵Jack Huey-13/+54
AscribeUserType error in borrowck
2023-09-21Record asyncness span in HIRMichael Goulet-1/+1
2023-09-21Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obkGuillaume Gomez-22/+21
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`. Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all. However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish... ``@oli-obk`` any ideas?
2023-09-21Prevent promotion of const fn calls in inline constsOli Scherer-1/+1
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-22/+21
2023-09-18Remove `RegionHighlightMode::tcx`.Nicholas Nethercote-4/+4
It's easier to pass it in to the one method that needs it (`highlighting_region_vid`) than to store it in the type. This means `RegionHighlightMode` can impl `Default`.
2023-09-11Auto merge of #114586 - oli-obk:patch_tait_rpit_order_check, ↵bors-13/+20
r=lcnr,compiler-errors Bubble up opaque <eq> opaque operations instead of picking an order In case we are in `Bubble` mode (meaning every opaque type that is defined in the current crate is treated as if it were in its defining scope), we don't try to register an opaque type as the hidden type of another opaque type, but instead bubble up an obligation to equate them at the query caller site. Usually that means we have a `DefiningAnchor::Bind` and thus can reliably figure out whether an opaque type is in its defining scope. Where we can't, we'll error out, so the default is sound. With this change we start using `AliasTyEq` predicates in the old solver, too. fixes https://github.com/rust-lang/rust/issues/108498 But also regresses `tests/ui/impl-trait/anon_scope_creep.rs`. Our use of `Bubble` for `check_opaque_type_well_formed` is going to keep biting us. r? `@lcnr` `@compiler-errors`
2023-09-11Bubble up opaque <eq> opaque operations instead of picking an orderOli Scherer-13/+20
2023-09-11Auto merge of #115595 - surechen:114896, r=davidtwcobors-6/+78
Fix incorrect mutable suggestion information for binding in ref pattern like: `let &b = a;` fixes #114896 I find we have to get pat_span but not local_decl.source_info.span for suggestion. In `let &b = a;` pat_span is &b. I think check `let &b = a` in hir to make sure it is hir::Node::Local(hir::Local {pat: hir::Pat{kind: hir::PatKind::Ref(....... can distinguish it from other situation, but I'm not sure. If my processing method is not accurate, please guide me to modify it, thank you. r? `@davidtwco`