Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #129770

Closed
wants to merge 165 commits into from

Commits on Aug 1, 2024

  1. Configuration menu
    Copy the full SHA
    c1245e1 View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2024

  1. Configuration menu
    Copy the full SHA
    662f02f View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2024

  1. Configuration menu
    Copy the full SHA
    aa6e8d3 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2024

  1. docs: Add a doc comment for OpQueue

    Add an explanatory sentence and some sample code to help
    readers understand why this struct exists.
    Wilfred committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    5e058db View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2024

  1. Auto merge of rust-lang#17885 - Wilfred:op_queue_docs, r=lnicola

    minor: Add a doc comment for OpQueue
    
    Add an explanatory sentence and some sample code to help readers understand why this struct exists.
    bors committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    54ecca0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4a14155 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#17891 - lnicola:binop-bad-lang-items, r=flodi…

    …ebold
    
    internal: Be more resilient to bad language item definitions in binop inference
    
    Fixes rust-lang#16287
    Fixes rust-lang#16286
    
    There's one more in `write_fn_trait_method_resolution`, but I'm not sure if it won't cause further problems in `infer_closures`.
    bors committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    e2f2e73 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    81b68b2 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#17882 - ShoyuVanilla:issue-17866, r=lnicola

    fix: Panic while canonicalizing erroneous projection type
    
    Fixes rust-lang#17866
    
    The root cause of rust-lang#17866 is quite horrifyng 😨
    
    ```rust
    trait T {
        type A;
    }
    
    type Foo = <S as T>::A; // note that S isn't defined
    
    fn main() {
        Foo {}
    }
    ```
    
    While inferencing alias type `Foo = <S as T>::A`;
    
    https://github.com/rust-lang/rust-analyzer/blob/78c2bdce860dbd996a8083224d01a96660dd6a15/crates/hir-ty/src/infer.rs#L1388-L1398
    
    the error type `S` in it is substituted by inference var in L1396 above as below;
    
    https://github.com/rust-lang/rust-analyzer/blob/78c2bdce860dbd996a8083224d01a96660dd6a15/crates/hir-ty/src/infer/unify.rs#L866-L869
    
    This new inference var's index is `1`, as the type inferecing procedure here previously inserted another inference var into same `InferenceTable`.
    
    But after that, the projection type made from the above then passed to the following function;
    
    https://github.com/rust-lang/rust-analyzer/blob/78c2bdce860dbd996a8083224d01a96660dd6a15/crates/hir-ty/src/traits.rs#L88-L96
    
    here, a whole new `InferenceTable` is made, without any inference var and in the L94, this table calls;
    
    https://github.com/rust-lang/rust-analyzer/blob/78c2bdce860dbd996a8083224d01a96660dd6a15/crates/hir-ty/src/infer/unify.rs#L364-L370
    
    And while registering `AliasEq` `obligation`, this obligation contains inference var `?1` made from the previous table, but this table has only one inference var `?0` made at L365.
    So, the chalk panics when we try to canonicalize that obligation to register it, because the obligation contains an inference var `?1` that the canonicalizing table doesn't have.
    
    Currently, we are calling `InferenceTable::new()` to do some normalizing, unifying or coercing things to some targets that might contain inference var that the new table doesn't have.
    I think that this is quite dangerous footgun because the inference var is just an index that does not contain the information which table does it made from, so sometimes this "foreign" index might cause panic like this case, or point at the wrong variable.
    
    This PR mitigates such behaviour simply by inserting sufficient number of inference vars to new table to avoid such problem.
    This strategy doesn't harm current r-a's intention because the inference vars that passed into new tables are just "unresolved" variables in current r-a, so this is just making sure that such "unresolved" variables exist in the new table
    bors committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    89cd585 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2024

  1. Configuration menu
    Copy the full SHA
    b0183f8 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17893 - ShoyuVanilla:issue-17871, r=flodiebold

    fix: Panic while hovering associated function with type annotation on generic param that not inherited from its container type
    
    Fixes rust-lang#17871
    
    We call `generic_args_sans_defaults` here;
    
    https://github.com/rust-lang/rust-analyzer/blob/64a140527b383e3a2fe95908881624fc5374c60c/crates/hir-ty/src/display.rs#L1021-L1034
    
    but the following substitution inside that function panic in rust-lang#17871;
    
    https://github.com/rust-lang/rust-analyzer/blob/64a140527b383e3a2fe95908881624fc5374c60c/crates/hir-ty/src/display.rs#L1468
    
    it's because the `Binders.binder` inside `default_parameters` has a same length with the generics of the function we are hovering on, but the generics of it is split into two, `fn_params` and `parent_params`.
    Because of this, it may panic if the function has one or more default parameters and both `fn_params` and `parent_params` are non-empty, like the case in the title of this PR.
    
    So, we must call `generic_args_sans_default` first and then split it into `fn_params` and `parent_params`
    bors committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    e20180d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6ed283b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a783e30 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#17896 - Veykril:editioned-syntax-kinds, r=Vey…

    …kril
    
    internal: Properly check the edition for edition dependent syntax kinds
    
    This puts the current edition in a bunch of places, most of which I annoted with FIXMEs asside from the ones in ide-assists because I couldnt bother with those
    bors committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    a594a2d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bf4d31d View commit details
    Browse the repository at this point in the history
  7. Allow flycheck process to exit gracefully

    Assuming it isn't cancelled. Closes rust-lang#17902.
    
    The only place CommandHandle::join is used is when the flycheck command
    finishes, so this commit changes the behavior of the method itself.
    tmandry committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    23c8dcd View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2024

  1. Replace once_cell with std's recently stabilized OnceCell/Lock and La…

    …zyCell/Lock
    
    This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
    ChayimFriedman2 committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    642a0f8 View commit details
    Browse the repository at this point in the history
  2. Test for word boundary in FindUsages

    This speeds up short identifiers search significantly, while unlikely to have an effect on long identifiers (the analysis takes much longer than some character comparison).
    
    Tested by finding all references to `eq()` (from `PartialEq`) in the rust-analyzer repo. Total time went down from 100s to 10s (a 10x reduction!).
    ChayimFriedman2 committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    0cbf6a7 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#17907 - ChayimFriedman2:no-once_cell, r=Veykril

    internal: Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/Lock
    
    This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    b68992a View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#17908 - ChayimFriedman2:usages-word-boundarie…

    …s, r=Veykril
    
    Test for word boundary in `FindUsages`
    
    This speeds up short identifiers search significantly, while unlikely to have an effect on long identifiers (the analysis takes much longer than some character comparison).
    
    Tested by finding all references to `eq()` (from `PartialEq`) in the rust-analyzer repo. Total time went down from 100s to 10s (a 10x reduction!).
    
    Feel free to close this if you consider this a non-issue, as most short identifiers are local.
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    95f5e4b View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#17903 - tmandry:graceful-exit, r=Veykril

    Allow flycheck process to exit gracefully
    
    Assuming it isn't cancelled. Closes rust-lang#17902.
    
    The only place CommandHandle::join() is used is when the flycheck command
    finishes, so this commit changes the behavior of the method itself.
    
    The only reason I can see for the existing behavior is if the command is somehow holding onto a build lock longer than it should, this would force it to be released. But it would be a pretty heavy-handed way to solve that issue. I'm not aware of this occurring in practice.
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    fdd5294 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4ca597a View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#17595 - dfireBird:infer-lt, r=flodiebold

    Implement lifetime inferring
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    2071778 View commit details
    Browse the repository at this point in the history
  8. Properly account for editions in names

    This PR touches a lot of parts. But the main changes are changing
    `hir_expand::Name` to be raw edition-dependently and only when necessary
    (unrelated to how the user originally wrote the identifier),
    and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware
    (this was done in rust-lang#17896, but the FIXMEs were fixed here).
    
    It is possible that I missed some cases, but most IDE parts should properly
    escape (or not escape) identifiers now.
    
    The rules of thumb are:
    
     - If we show the identifier to the user, its rawness should be determined
       by the edition of the edited crate. This is nice for IDE features,
       but really important for changes we insert to the source code.
     - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update
       tests when an edition becomes stable, to avoid churn).
     - For debugging tools (helper methods and logs), I used `Edition::LATEST`.
    ChayimFriedman2 committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    3d6129d View commit details
    Browse the repository at this point in the history
  9. Auto merge of rust-lang#17905 - ChayimFriedman2:edition-dependent-raw…

    …-keyword, r=Veykril
    
    fix: Properly account for editions in names
    
    This PR touches a lot of parts. But the main changes are changing `hir_expand::Name` to be raw edition-dependently and only when necessary (unrelated to how the user originally wrote the identifier), and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware (this was done in rust-lang#17896, but the FIXMEs were fixed here).
    
    It is possible that I missed some cases, but most IDE parts should properly escape (or not escape) identifiers now.
    
    The rules of thumb are:
    
     - If we show the identifier to the user, its rawness should be determined by the edition of the edited crate. This is nice for IDE features, but really important for changes we insert to the source code.
     - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update tests when an edition becomes stable, to avoid churn).
     - For debugging tools (helper methods and logs), I used `Edition::LATEST`.
    
    Reviewing notes:
    
    This is a really big PR but most of it is mechanical translation. I changed `Name` displayers to require an edition, and followed the compiler errors. Most methods just propagate the edition requirement. The interesting cases are mostly in `ide-assists`, as sometimes the correct crate to fetch the edition from requires awareness (there may be two). `ide-completions` and `ide-diagnostics` were solved pretty easily by introducing an edition field to their context. `ide` contains many features, for most of them it was propagated to the top level function and there the edition was fetched based on the file.
    
    I also fixed all FIXMEs from rust-lang#17896. Some required introducing an edition parameter (usually not for many methods after the changes to `Name`), some were changed to a new method `is_any_identifier()` because they really want any possible keyword.
    
    Fixes rust-lang#17895.
    Fixes rust-lang#17774.
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    6908451 View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#17900 - darichey:exclude-vendored-libraries, …

    …r=davidbarsky
    
    Add scip/lsif flag to exclude vendored libaries
    
    rust-lang#17809 changed StaticIndex to include vendored libraries. This PR adds a flag to disable that behavior.
    
    At work, our monorepo has too many rust targets to index all at once, so we split them up into several shards. Since all of our libraries are vendored, if rust-analyzer includes them, sharding no longer has much benefit, because every shard will have to index the entire transitive dependency graphs of all of its targets. We get around the issue presented in rust-lang#17809 because some other shard will index the libraries directly.
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    995a014 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    6fc487d View commit details
    Browse the repository at this point in the history
  12. Auto merge of rust-lang#17909 - darichey:remove-discoverProjectRunner…

    …, r=lnicola
    
    Remove rust-analyzer.workspace.discoverProjectRunner
    
    The functionality for this vscode config option was removed in rust-lang#17395, so it doesn't do anything anymore.
    bors committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    01245bd View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2024

  1. Pin rowan to 0.15.15

    ShoyuVanilla committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    d3fa5e9 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17917 - ShoyuVanilla:pin-rowan, r=lnicola

    Pin `rowan` to `0.15.15`
    
    To prevent rust-lang#17914, I think that it would be safer pinning this before we fix it correctly
    bors committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    d2d41b4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c4b8c65 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#17916 - ShoyuVanilla:issue-17711, r=Veykril

    fix: Wrong BoundVar index when lowering impl trait parameter of parent generics
    
    Fixes rust-lang#17711
    
    From the following test code;
    
    ```rust
    //- minicore: deref
    use core::ops::Deref;
    
    struct Struct<'a, T>(&'a T);
    
    trait Trait {}
    
    impl<'a, T: Deref<Target = impl Trait>> Struct<'a, T> {
        fn foo(&self) -> &Self { self }
    
        fn bar(&self) {
            let _ = self.foo();
        }
    
    }
    ```
    
    when we call `register_obligations_for_call` for `let _ = self.foo();`,
    
    https://github.com/rust-lang/rust-analyzer/blob/07659783fdfd4ec0a0bffa93017e33e31e567e42/crates/hir-ty/src/infer/expr.rs#L1939-L1952
    
    we are querying `generic_predicates` and it has `T: Deref<Target = impl Trait>` predicate from the parent `impl Struct`;
    
    https://github.com/rust-lang/rust-analyzer/blob/07659783fdfd4ec0a0bffa93017e33e31e567e42/crates/hir-ty/src/lower.rs#L375-L399
    
    but as we can see above, lowering `TypeRef = impl Trait` doesn't take into account the parent generic parameters, so the `BoundVar` index here is `0`, as `fn foo` has no generic args other than parent's,
    
    But this `BoundVar` is pointing at `'a` in `<'a, T: Deref<Target = impl Trait>>`.
    So, in the first code reference `register_obligations_for_call`'s L:1948 - `.substitute(Interner, parameters)`, we are substituting `'a` with `Ty`, not `Lifetime` and this makes panic inside the chalk.
    
    This PR fixes this wrong `BoundVar` index in such cases
    bors committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    eb12861 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d0ce97f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    324cf83 View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#17915 - Veykril:offline-no-deps, r=Veykril

    feat: Make rust-analyzer work partially when offline
    
    Helps out with rust-lang/rust-analyzer#12499 a bit
    bors committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    51e3775 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2024

  1. Configuration menu
    Copy the full SHA
    74db4d3 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2024

  1. Auto merge of rust-lang#17925 - darichey:issue-17767, r=Veykril

    Include generics when lowering extern type
    
    Fixes rust-lang#17767
    bors committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    2c18533 View commit details
    Browse the repository at this point in the history
  2. chore(config): remove invocationLocation in favor of `invocationStr…

    …ategy`
    
    These flags were added to help rust-analyzer integrate with repos
    requiring non-Cargo invocations. The consensus is that having two
    independent settings are no longer needed. This change removes
    `invocationLocation` in favor of `invocationStrategy` and changes
    the internal representation of `InvocationStrategy::Once` to hold
    the workspace root.
    Tyrubias committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    1bfb362 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#17888 - Tyrubias:remove-invocation-location, …

    …r=Veykril
    
    chore(config): remove `invocationLocation` in favor of `invocationStrategy`
    
    These flags were added to help rust-analyzer integrate with repos requiring non-Cargo invocations. The consensus is that having two independent settings are no longer needed. This change removes `invocationLocation` in favor of `invocationStrategy` and changes the internal representation of `InvocationStrategy::Once` to hold the workspace root.
    
    Closes rust-lang#17848.
    bors committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    85f6d15 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    036affc View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#17928 - roife:fix-issue-17869, r=Veykril

    fix: keep comments in convert_while_to_loop
    
    Fix rust-lang#17869.
    bors committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    05f5c77 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b2062ea View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#17929 - Veykril:invocation-loc-docs, r=Veykril

    minor: Improve documentation for `InvocationStrategy`
    
    cc rust-lang/rust-analyzer#17888
    bors committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    f17e9a0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    bd6ea75 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    879fa66 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    ea12d79 View commit details
    Browse the repository at this point in the history
  11. Auto merge of rust-lang#17924 - ShoyuVanilla:issue-17921, r=Veykril

    fix: Panic when a TAIT exists in a RPIT
    
    Fixes  rust-lang#17921
    
    When there is a TAIT inside of a RPIT like;
    
    ```rust
    trait Foo {}
    type Bar = impl Foo;
    fn foo<A>() -> impl Future<Output = Bar> { .. }
    ```
    
    while inferencing `fn foo`, `insert_inference_vars_for_impl_trait` tries to substitute impl trait bounds of `Bar`, i.e. `Implemented(Foo)` with RPITs `placeholders`, and this causes panic
    
    https://github.com/rust-lang/rust-analyzer/blob/fa003262474185fd62168379500fe906b331824b/crates/hir-ty/src/infer.rs#L903-L905
    bors committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    f9c0c8a View commit details
    Browse the repository at this point in the history
  12. ServerStatusParams should consider 'prime caches' in quiescent status

    Priming caches is a performance win, but it takes a lock on the salsa
    database and prevents rust-analyzer from responding to e.g. go-to-def
    requests.
    
    This causes confusion for users, who see the spinner next to
    rust-analyzer in the VS Code footer stop, so they start attempting to
    navigate their code.
    
    Instead, set the `quiescent` status in LSP to false during cache
    priming, so the VS Code spinner persists until we can respond to any
    LSP request.
    Wilfred committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    f25cb80 View commit details
    Browse the repository at this point in the history
  13. Auto merge of rust-lang#17886 - Wilfred:prime_caches_quiescent, r=Vey…

    …kril
    
    internal: ServerStatusParams should consider 'prime caches' in quiescent status
    
    Priming caches is a performance win, but it takes a lock on the salsa database and prevents rust-analyzer from responding to e.g. go-to-def requests.
    
    This causes confusion for users, who see the spinner next to rust-analyzer in the VS Code footer stop, so they start attempting to navigate their code.
    
    Instead, set the `quiescent` status in LSP to false during cache priming, so the VS Code spinner persists until we can respond to any LSP request.
    bors committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    df6ce96 View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2024

  1. Configuration menu
    Copy the full SHA
    a7d15a8 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17932 - Veykril:default-reply-lat-sensitive, …

    …r=Veykril
    
    fix: Fix panics for semantic highlighting at startup
    
    Without this we might try to process semantic highlighting requests before the database has entries for the given file resulting in a panic. There is no work to be done either way so delay this like we do with other request handlers.
    bors committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    a9e3555 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a42c732 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8e31598 View commit details
    Browse the repository at this point in the history
  5. Old configs are back

    alibektas committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    1b2eaa5 View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#17930 - Veykril:config-user-config, r=alibektas

    Remove the ability to configure the user config path
    
    Being able to do this makes little sense as this is effectively a cyclic dependency (and we do not want to fixpoint this really).
    bors committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    085aac3 View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#17913 - alibektas:ratoml_improvements, r=alib…

    …ektas
    
    fix: Add workspace level config to ratoml
    bors committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    9cb66c2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    94f206a View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2024

  1. Configuration menu
    Copy the full SHA
    3f89eeb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    db2e8e1 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2024

  1. Auto merge of rust-lang#17939 - ShoyuVanilla:maybe-sized-fix, r=Veykril

    fix: Wrong `Sized` predicate for `generic_predicates_for_param`
    
    I found this gathers wrong `Self: Sized` bound while implementing object safety, though I couldn't find proper test for this.
    
    If we call `generic_predicates_for_param` to `Bar` in the following code;
    ```rust
    trait Foo<T: ?Sized> {}
    trait Bar<T: Foo<Self> + ?Sized> {}
    ```
    it returns `T: Sized` and `Self: Sized` bound, because normaly, the `?Sized` bound applied properly in L1059 with;
    https://github.com/rust-lang/rust-analyzer/blob/3723e5910c14f0ffbd13de474b8a8fcc74db04ce/crates/hir-ty/src/lower.rs#L1035-L1061
    
    But we filter them before it is lowered with that function here;
    
    https://github.com/rust-lang/rust-analyzer/blob/3723e5910c14f0ffbd13de474b8a8fcc74db04ce/crates/hir-ty/src/lower.rs#L1540-L1586
    
    So, the `?Sized` bounded params are not gathered into `ctx.unsized_types` and thus we are applying them implicit `Sized` bound here;
    
    https://github.com/rust-lang/rust-analyzer/blob/3723e5910c14f0ffbd13de474b8a8fcc74db04ce/crates/hir-ty/src/lower.rs#L1591-L1602
    bors committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    614fb24 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f845536 View commit details
    Browse the repository at this point in the history
  3. Drop MacroInputKind

    Veykril committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    d893dcc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    aeb9c7b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1179cbb View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    8e82e44 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4d61444 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d79999a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    b0e7ef4 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f9db48f View commit details
    Browse the repository at this point in the history
  11. Auto merge of rust-lang#17942 - HKalbasi:fp-const-eval, r=HKalbasi

    Implement floating point casts in const eval
    
    fix rust-lang#17926
    bors committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    06228b9 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    71c7cea View commit details
    Browse the repository at this point in the history
  13. Auto merge of rust-lang#17898 - Veykril:descend-2.0, r=Veykril

    internal: Improve macro token mapping heuristics
    
    Fixes rust-lang/rust-analyzer#16235
    bors committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    81a9956 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    0a27711 View commit details
    Browse the repository at this point in the history
  15. Auto merge of rust-lang#17943 - Veykril:diags, r=Veykril

    fix: Improve proc-macro panic message and workspace loading failure diagnostic
    bors committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    1b0e158 View commit details
    Browse the repository at this point in the history
  16. When descending into macros in search, first check if there is a need…

    … to - i.e. if we are inside a macro call
    
    This avoids the need to analyze the file when we are not inside a macro call.
    
    This is especially important for the optimization in the next commit(s), as there the common case will be to descent into macros but then not analyze.
    ChayimFriedman2 committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    f65d605 View commit details
    Browse the repository at this point in the history
  17. Speed up search for short associated functions, especially very commo…

    …n identifiers such as `new`
    
    The search is used by IDE features such as rename and find all references.
    
    The search is slow because we need to verify each candidate, and that requires analyzing it; the key to speeding it up is to avoid the analysis where possible.
    
    I did that with a bunch of tricks that exploits knowledge about the language and its possibilities. The first key insight is that associated methods may only be referenced in the form `ContainerName::func_name` (parentheses are not necessary!) (Rust doesn't include a way to `use Container::func_name`, and even if it will in the future most usages are likely to stay in that form.
    
    Searching for `::` will help only a bit, but searching for `Container` can help considerably, since it is very rare that there will be two identical instances of both a container and a method of it.
    
    However, things are not as simple as they sound. In Rust a container can be aliased in multiple ways, and even aliased from different files/modules. If we will try to resolve the alias, we will lose any gain from the textual search (although very common method names such as `new` will still benefit, most will suffer because there are more instances of a container name than its associated item).
    
    This is where the key trick enters the picture. The key insight is that there is still a textual property: a container namer cannot be aliased, unless its name is mentioned in the alias declaration, or a name of alias of it is mentioned in the alias declaration.
    
    This becomes a fixpoint algorithm: we expand our list of aliases as we collect more and more (possible) aliases, until we eventually reach a fixpoint. A fixpoint is not guaranteed (and we do have guards for the rare cases where it does not happen), but it is almost so: most types have very few aliases, if at all.
    
    We do use some semantic information while analyzing aliases. It's a balance: too much semantic analysis, and the search will become slow. But too few of it, and we will bring many incorrect aliases to our list, and risk it expands and expands and never reach a fixpoint. At the end, based on benchmarks, it seems worth to do a lot to avoid adding an alias (but not too much), while it is worth to do a lot to avoid the need to semantically analyze func_name matches (but again, not too much).
    
    After we collected our list of aliases, we filter matches based on this list. Only if a match can be real, we do semantic analysis for it.
    
    The results are promising: searching for all references on `new()` in `base-db` in the rust-analyzer repository, which previously took around 60 seconds, now takes as least as two seconds and a half (roughly), while searching for `Vec::new()`, almost an upper bound to how much a symbol can be used, that used to take 7-9 minutes(!) now completes in 100-120 seconds, and with less than half of non-verified results (aka. false positives).
    
    This is the less strictly correct (but faster) of this patch; it can miss some (rare) cases (there is a test for that - `goto_ref_on_short_associated_function_complicated_type_magic_can_confuse_our_logic()`). There is another branch that have no false negatives but is slower to search (`Vec::new()` never reaches a fixpoint in aliases collection there). I believe it is possible to create a strategy that will have the best of both worlds, but it will involve significant complexity and I didn't bother, especially considering that in the vast majority of the searches the other branch will be more than enough. But all in all, I decided to bring this branch (of course if the maintainers will agree), since our search is already not 100% accurate (it misses macros), and I believe there is value in the additional perf.
    ChayimFriedman2 committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    a57def2 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    a44152a View commit details
    Browse the repository at this point in the history
  19. Apply changes

    alibektas committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    0251cfa View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2024

  1. Auto merge of rust-lang#17912 - alibektas:cargo_check_on_binary, r=Ve…

    …ykril
    
    fix: run flycheck without rev_deps when target is specified
    
    Since querying for a crate's target is a call to salsa and therefore blocking, flycheck task is now deferred out of main thread by using `GlobalState`s `deferred_task_queue`. Fixes rust-lang#17829  and rust-lang/rustlings#2071
    bors committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    b88a4f0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    916c559 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#17927 - ChayimFriedman2:speedup-new-usages, r…

    …=Veykril
    
    perf: Speed up search for short associated functions, especially very common identifiers such as `new`
    
    `@Veykril` said in rust-lang/rust-analyzer#17908 (comment) that people complain searches for `new()` are slow (they are right), so here I am to help!
    
    The search is used by IDE features such as rename and find all references.
    
    The search is slow because we need to verify each candidate, and that requires analyzing it; the key to speeding it up is to avoid the analysis where possible.
    
    I did that with a bunch of tricks that exploits knowledge about the language and its possibilities. The first key insight is that associated methods may only be referenced in the form `ContainerName::func_name` (parentheses are not necessary!) (Rust doesn't include a way to `use Container::func_name`, and even if it will in the future most usages are likely to stay in that form.
    
    Searching for `::` will help only a bit, but searching for `Container` can help considerably, since it is very rare that there will be two identical instances of both a container and a method of it.
    
    However, things are not as simple as they sound. In Rust a container can be aliased in multiple ways, and even aliased from different files/modules. If we will try to resolve the alias, we will lose any gain from the textual search (although very common method names such as `new` will still benefit, most will suffer because there are more instances of a container name than its associated item).
    
    This is where the key trick enters the picture. The key insight is that there is still a textual property: a container namer cannot be aliased, unless its name is mentioned in the alias declaration, or a name of alias of it is mentioned in the alias declaration.
    
    This becomes a fixpoint algorithm: we expand our list of aliases as we collect more and more (possible) aliases, until we eventually reach a fixpoint. A fixpoint is not guaranteed (and we do have guards for the rare cases where it does not happen), but it is almost so: most types have very few aliases, if at all.
    
    We do use some semantic information while analyzing aliases. It's a balance: too much semantic analysis, and the search will become slow. But too few of it, and we will bring many incorrect aliases to our list, and risk it expands and expands and never reach a fixpoint. At the end, based on benchmarks, it seems worth to do a lot to avoid adding an alias (but not too much), while it is worth to do a lot to avoid the need to semantically analyze func_name matches (but again, not too much).
    
    After we collected our list of aliases, we filter matches based on this list. Only if a match can be real, we do semantic analysis for it.
    
    The results are promising: searching for all references on `new()` in `base-db` in the rust-analyzer repository, which previously took around 60 seconds, now takes as least as two seconds and a half (roughly), while searching for `Vec::new()`, almost an upper bound to how much a symbol can be used, that used to take 7-9 minutes(!) now completes in 100-120 seconds, and with less than half of non-verified results (aka. false positives).
    
    This is the less strictly correct (but faster) branch of this patch; it can miss some (rare) cases (there is a test for that - `goto_ref_on_short_associated_function_complicated_type_magic_can_confuse_our_logic()`). There is another branch that have no false negatives but is slower to search (`Vec::new()` never reaches a fixpoint in aliases collection there). I believe it is possible to create a strategy that will have the best of both worlds, but it will involve significant complexity and I didn't bother, especially considering that in the vast majority of the searches the other branch will be more than enough. But all in all, I decided to bring this branch (of course if the maintainers will agree), since our search is already not 100% accurate (it misses macros), and I believe there is value in the additional perf.
    
    You can find the strict branch at https://github.com/ChayimFriedman2/rust-analyzer/tree/speedup-new-usages-strict.
    
    Should fix rust-lang#7404, I guess (will check now).
    bors committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    39cc5b6 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#17936 - Veykril:module_path, r=Veykril

    feat: Implement `module_path` macro
    
    Turns out this is a pain to implement because of our hir-def hir-expand split :)
    bors committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    ac912c7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5f7489a View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#17946 - Veykril:flycheck-crates-for, r=Veykril

    internal: Don't requery crates_for for flycheck when crates are known
    bors committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    e030cf0 View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#17857 - ChayimFriedman2:rust-project-cfg-grou…

    …p, r=Veykril
    
    feat: Allow declaring cfg groups in rust-project.json, to help sharing common cfgs
    
    Closes rust-lang#17815.
    bors committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    3a097e1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    eb896a5 View commit details
    Browse the repository at this point in the history
  9. Auto merge of rust-lang#17948 - ShoyuVanilla:parent-self-sized, r=Vey…

    …kril
    
    fix: Wrong `Self: Sized` predicate for trait assoc items
    
    Again while implementing object safety like rust-lang#17939 😅
    
    If we call `generic_predicates_query` on `fn foo` in the following code;
    ```
    trait Foo {
        fn foo();
    }
    ```
    It returns implicit bound `Self: Sized`, even though `Self` is not appearing as a generic parameter inside angle brackets, but as a parent generic parameter, "trait self".
    
    This PR prevent pushing "implicit" `Self: Sized` predicates in such cases
    bors committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    3bd42d3 View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2024

  1. Configuration menu
    Copy the full SHA
    bdbc057 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17949 - Wilfred:include_build_file_in_watcher…

    …s, r=lnicola
    
    fix: rust-analyzer should watch build files from rust-project.json
    
    rust-analyzer always watches Cargo.toml for changes, but other build systems using rust-project.json have their own build files.
    
    Ensure we also watch those for changes, so we know when to reconfigure rust-analyzer when dependencies change.
    bors committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    a074e1a View commit details
    Browse the repository at this point in the history
  3. Fix few bugs in closure capture computation, and add tests

    Also create a test infrastructure for capture computation.
    ChayimFriedman2 committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    12faedd View commit details
    Browse the repository at this point in the history
  4. Preserve all spans for closure captures, not just one

    This is important for the "convert closure to fn" assist, as it needs to find and modify the places the captures are used.
    ChayimFriedman2 committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    77ab568 View commit details
    Browse the repository at this point in the history
  5. Add gen modifier to functions

    We don't yet lower or maybe even parse them, but blocks already have `gen`, so why not.
    ChayimFriedman2 committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    cf243e5 View commit details
    Browse the repository at this point in the history
  6. Handle associated types that are lang items

    Previously we were ignoring them.
    ChayimFriedman2 committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    1e0df17 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2c6a521 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    737a969 View commit details
    Browse the repository at this point in the history
  9. Modify hacks::parse_expr_from_str() to take an edition too

    This will be needed as we parse unknown identifiers and want to insert them into source code.
    ChayimFriedman2 committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    7339337 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    6340522 View commit details
    Browse the repository at this point in the history
  11. Impl PartialEq and Eq for IndentLevel

    We can impl PartialOrd and Ord too, but I didn't need that.
    ChayimFriedman2 committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    becfc5a View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2024

  1. Don't enable the search fast path for short associated functions when…

    … a search scope is set
    
    In most places where we set a search scope it is a single file, and so the fast path will actually harm performance, since it has to search for aliases in the whole project.
    The only exception that qualifies for the fast path is SSR (there is an exception that don't qualify for the fast path as it search for `use` items). It sets the search scope to avoid dependencies. We could make it use the fast path, but I didn't bother.
    ChayimFriedman2 committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    7bd3ca1 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17955 - ChayimFriedman2:fix-fast-search-with-…

    …scope, r=Veykril
    
    fix: Don't enable the search fast path for short associated functions when a search scope is set
    
    In most places where we set a search scope it is a single file, and so the fast path will actually harm performance, since it has to search for aliases in the whole project. The only exception that qualifies for the fast path is SSR (there is an exception that don't qualify for the fast path as it search for `use` items). It sets the search scope to avoid dependencies. We could make it use the fast path, but I didn't bother.
    
    I forgot this while working on rust-lang#17927.
    bors committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    cba00a8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d9d8d94 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#17956 - Veykril:metadata-err, r=Veykril

    fix: Fix metadata retrying eating original errors
    bors committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    c223013 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    606401f View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#17958 - Veykril:deref-chain-method-completion…

    …s, r=Veykril
    
    fix: Fix trait method completions not acknowledging Deref impls
    bors committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    bdee5c9 View commit details
    Browse the repository at this point in the history
  7. fix: add extra_test_bin_args to test explorer test runner

    trim whitespace
    duncan committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    2703ea1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    98e23d3 View commit details
    Browse the repository at this point in the history
  9. Auto merge of rust-lang#17961 - Veykril:autoderef-alloc, r=Veykril

    internal: Don't allocate autoderef steps when not needed
    bors committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    31a532a View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#17960 - duncanawoods:master, r=HKalbasi

    fix: add extra_test_bin_args to test explorer test runner
    
    `@HKalbasi` I thought I included this in rust-lang#17470 but it appears not so I have created a new issue rust-lang#17959 for this fix.
    bors committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    e0b1719 View commit details
    Browse the repository at this point in the history
  11. Fix Return Type Syntax to include .. (i.e. method(..) and not `me…

    …thod()`) as specified in the RFC
    ChayimFriedman2 committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    326a1c6 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2024

  1. Auto merge of rust-lang#17962 - ChayimFriedman2:update-rtn, r=Veykril

    fix: Fix Return Type Syntax to include `..` (i.e. `method(..)` and not `method()`) as specified in the RFC
    
    Fixes rust-lang#17952.
    bors committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    a3f1196 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17941 - ChayimFriedman2:pre-closure-to-fn, r=…

    …Veykril
    
    Preliminary work for rust-lang#17940
    
    I split the PR as requested, and made small commits.
    bors committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    239dc5d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9dad25a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9d4fdc0 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#17963 - avrong:avrong/error-lifetimes, r=Veykril

    Always show error lifetime arguments as `'_`
    
    Fixes rust-lang#17947
    
    Changed error lifetime argument presentation in non-test environment to `'_` and now showing them even if all of args are error lifetimes.
    
    This also influenced some of the other tests like `extract_function.rs`, `predicate.rs` and `type_pos.rs`. Not sure whether I need to refrain from adding lifetimes args there. Happy to fix if needed
    bors committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    05e6fb6 View commit details
    Browse the repository at this point in the history
  6. Fix "Unwrap block" assist with block modifiers

    The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`.
    ChayimFriedman2 committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    65e9f8b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c61f85b View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2024

  1. Bump backtrace to rust-lang/backtrace@fc37b22

    It should be 0.3.74~ish.
    
    This should help with backtraces on Android, QNX NTO 7.0, and Windows.
    workingjubilee committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    0763a3a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    65d25fe View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#17972 - rust-lang:revert-17936-module_path, r…

    …=Veykril
    
    Revert "feat: Implement `module_path` macro"
    
    Reverts rust-lang/rust-analyzer#17936 Fixes rust-lang/rust-analyzer#17968
    bors committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    f0bfd43 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#17970 - ChayimFriedman2:unwrap-unsafe-block, …

    …r=Veykril
    
    fix: Fix "Unwrap block" assist with block modifiers
    
    The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`.
    
    Fixes rust-lang#17964.
    bors committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    6593688 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    df4580b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b592256 View commit details
    Browse the repository at this point in the history
  7. Auto merge of rust-lang#17973 - Veykril:proc-macro-curr-dir, r=Veykril

    Expand proc-macros in workspace root, not package root
    
    Should fix rust-lang/rust-analyzer#17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
    bors committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    e4c404e View commit details
    Browse the repository at this point in the history
  8. Auto merge of rust-lang#17974 - lnicola:rm-apache-appendix, r=lnicola

    internal: Drop Apache license appendices
    
    Closes rust-lang#14586
    
    Similar to rust-lang#67734
    bors committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    2dce250 View commit details
    Browse the repository at this point in the history
  9. Fix tests

    Veykril committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    c9a3b02 View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#17757 - alibektas:toggle_macro_delimiters, r=…

    …Veykril
    
    assist: Add new assist toggle_macro_delimiter
    
    Closes rust-lang#17716
    bors committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    199c01d View commit details
    Browse the repository at this point in the history
  11. Create an assist to convert closure to freestanding fn

    The assist converts all captures to parameters.
    ChayimFriedman2 committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    34e50f5 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Configuration menu
    Copy the full SHA
    51055f7 View commit details
    Browse the repository at this point in the history
  2. Auto merge of rust-lang#17981 - lnicola:proc-macro-cwd, r=Veykril

    minor: Fix cwd used for proc macro expansion
    
    Fixes rust-lang#17980.
    bors committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    248a557 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4dbd81c View commit details
    Browse the repository at this point in the history
  4. allow BufReader::peek to be called on unsized types

    binarycat committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    ae6f8a7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4880eee View commit details
    Browse the repository at this point in the history
  6. Consider all expressions that autoderef in "Extract variable", not ju…

    …st method and field accesses.
    ChayimFriedman2 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    2a7ec0b View commit details
    Browse the repository at this point in the history
  7. Don't add reference when it isn't needed for the "Extract variable" a…

    …ssist
    
    I.e. don't generate `let var_name = &foo()`.
    
    Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing.
    
    I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
    ChayimFriedman2 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    fe5f91e View commit details
    Browse the repository at this point in the history
  8. internal: Avoid newlines in fetch workspace errors

    Most logs lines don't have newlines, ensure fetch workspace errors follow this
     pattern.
    
    Before:
    
    2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError:
    rust-analyzer failed to discover workspace
    
    After:
    
    2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
    Wilfred committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    5aefe78 View commit details
    Browse the repository at this point in the history
  9. Also handle deref expressions in "Extract variable"

    And BTW, remove the parentheses of the extracted expression if there are.
    ChayimFriedman2 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    3ff3d39 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    b3fcd8e View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2024

  1. Configuration menu
    Copy the full SHA
    c2c1bd0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9200452 View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#17992 - Wilfred:newlines_in_logs, r=Veykril

    internal: Avoid newlines in fetch errors
    
    Most logs lines don't have newlines, ensure fetch errors follow this pattern. This makes it easier to see which log line is associated with the error.
    
    Before:
    
        2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError:
        rust-analyzer failed to discover workspace
    
    After:
    
        2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    3a14e30 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    14ec120 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    03d6745 View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#17994 - Veykril:proc-macro-srv-from-str-panic…

    …, r=Veykril
    
    fix: Fix TokenStream::to_string implementation dropping quotation marks
    
    Fixes rust-lang/rust-analyzer#17986
    We might wanna consider backporting this to beta if that's simple enough to do
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    266bb1f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2ec71c8 View commit details
    Browse the repository at this point in the history
  8. Merge from rust-lang/rust

    lnicola committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    26888c3 View commit details
    Browse the repository at this point in the history
  9. Auto merge of rust-lang#17995 - lnicola:sync-from-rust, r=lnicola

    minor: sync from downstream
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    f05888d View commit details
    Browse the repository at this point in the history
  10. Auto merge of rust-lang#17940 - ChayimFriedman2:closure-to-fn, r=Veykril

    feat: Create an assist to convert closure to freestanding fn
    
    The assist converts all captures to parameters.
    
    Closes rust-lang#17920.
    
    This was more work than I though, since it has to handle a bunch of edge cases...
    
    Based on rust-lang#17941. Needs to merge it first.
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    b195ff3 View commit details
    Browse the repository at this point in the history
  11. Auto merge of rust-lang#17988 - darichey:fix-scip-def, r=Veykril

    Fix incorrect symbol definitions in SCIP output
    
    The SCIP output incorrectly marks some symbols as definitions because it doesn't account for the file ID when comparing the token's range to its definition's range.
    
    This means that if a symbol is referenced in a file at the same position at which it is defined in another file, that reference will be marked as a definition. I was quite surprised by how common this is. For example, `PartialEq` is defined [here](https://github.com/rust-lang/rust/blob/1.80.1/library/core/src/cmp.rs#L273) and `uuid` references it [here](https://github.com/uuid-rs/uuid/blob/1.8.0/src/lib.rs#L329). And what do you know, they're both at offset 10083! In our large monorepo, this happens for basically every common stdlib type!
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    e0625d5 View commit details
    Browse the repository at this point in the history
  12. Auto merge of rust-lang#17987 - ChayimFriedman2:column-macro, r=Veykril

    fix: Fix name resolution of shadowed builtin macro
    
    Fixes rust-lang#17969.
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    b6d0fd0 View commit details
    Browse the repository at this point in the history
  13. Auto merge of rust-lang#17991 - ChayimFriedman2:extract-variable-ref,…

    … r=Veykril
    
    fix: Don't add reference when it isn't needed for the "Extract variable" assist
    
    I.e. don't generate `let var_name = &foo()`. Because it always irritates me when I need to fix that.
    
    Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing.
    
    I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    cd377d9 View commit details
    Browse the repository at this point in the history
  14. Auto merge of rust-lang#17993 - ChayimFriedman2:convert-to-tuple-attr…

    …s, r=Veykril
    
    Consider field attributes when converting from tuple to named struct and the opposite
    
    Fixes rust-lang#17983.
    
    I tried to use the `SourceChangeBuilder::make_mut()` API, but it duplicated the attribute...
    bors committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    34e7e79 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    8c798c8 View commit details
    Browse the repository at this point in the history
  16. wasi: Fix sleeping for Duration::MAX

    This commit fixes an assert in the WASI-specific implementation of
    thread sleep to ensure that sleeping for a very large period of time
    blocks instead of panicking. This can come up when testing programs that
    sleep "forever", for example.
    alexcrichton committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    c824c1a View commit details
    Browse the repository at this point in the history
  17. Try latest backtrace

    workingjubilee committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    518b41c View commit details
    Browse the repository at this point in the history
  18. Remove Option<!> return types.

    Several compiler functions have `Option<!>` for their return type.
    That's odd. The only valid return value is `None`, so why is this type
    used?
    
    Because it lets you write certain patterns slightly more concisely. E.g.
    if you have these common patterns:
    ```
        let Some(a) = f() else { return };
        let Ok(b) = g() else { return };
    ```
    you can shorten them to these:
    ```
        let a = f()?;
        let b = g().ok()?;
    ```
    Huh.
    
    An `Option` return type typically designates success/failure. How should
    I interpret the type signature of a function that always returns (i.e.
    doesn't panic), does useful work (modifying `&mut` arguments), and yet
    only ever fails? This idiom subverts the type system for a cute
    syntactic trick.
    
    Furthermore, returning `Option<!>` from a function F makes things
    syntactically more convenient within F, but makes things worse at F's
    callsites. The callsites can themselves use `?` with F but should not,
    because they will get an unconditional early return, which is almost
    certainly not desirable. Instead the return value should be ignored.
    (Note that some of callsites of `process_operand`, `process_immedate`,
    `process_assign` actually do use `?`, though the early return doesn't
    matter in these cases because nothing of significance comes after those
    calls. Ugh.)
    
    When I first saw this pattern I had no idea how to interpret it, and it
    took me several minutes of close reading to understand everything I've
    written above. I even started a Zulip thread about it to make sure I
    understood it properly. "Save a few characters by introducing types so
    weird that compiler devs have to discuss it on Zulip" feels like a bad
    trade-off to me. This commit replaces all the `Option<!>` return values
    and uses `else`/`return` (or something similar) to replace the relevant
    `?` uses. The result is slightly more verbose but much easier to
    understand.
    nnethercote committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    fa4f892 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2024

  1. Rollup merge of rust-lang#120221 - compiler-errors:statements-are-not…

    …-patterns, r=nnethercote
    
    Don't make statement nonterminals match pattern nonterminals
    
    Right now, the heuristic we use to check if a token may begin a pattern nonterminal falls back to `may_be_ident`:
    https://github.com/rust-lang/rust/blob/ef71f1047e04438181d7cb925a833e2ada6ab390/compiler/rustc_parse/src/parser/nonterminal.rs#L21-L37
    
    This has the unfortunate side effect that a `stmt` nonterminal eagerly matches against a `pat` nonterminal, leading to a parse error:
    ```rust
    macro_rules! m {
        ($pat:pat) => {};
        ($stmt:stmt) => {};
    }
    
    macro_rules! m2 {
        ($stmt:stmt) => {
            m! { $stmt }
        };
    }
    
    m2! { let x = 1 }
    ```
    
    This PR fixes it by more accurately reflecting the set of nonterminals that may begin a pattern nonterminal.
    
    As a side-effect, I modified `Token::can_begin_pattern` to work correctly and used that in `Parser::nonterminal_may_begin_with`.
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    4b25505 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#127897 - nyurik:add-qnx-70-target, r=saethlin

    add `aarch64_unknown_nto_qnx700` target - QNX 7.0 support for aarch64le
    
    This backports the QNX 7.1 aarch64 implementation to 7.0.
    
    * [x] required `-lregex` disabled, see rust-lang/libc#3775 (released in libc 0.2.156)
    * [x] uses `libgcc.a` instead of `libgcc_s.so` (7.0 used ancient GCC 5.4 which didn't have gcc_s)
    * [x] a fix in `backtrace` crate to support stack traces rust-lang/backtrace-rs#648
    
    This PR bumps libc dependency to 0.2.158
    
    CC: to the folks who did the [initial implementation](https://doc.rust-lang.org/rustc/platform-support/nto-qnx.html): `@flba-eb,` `@gh-tr,` `@jonathanpallant,` `@japaric`
    
    # Compile target
    
    ```bash
    # Configure qcc build environment
    source _path_/_to_/qnx7.0/qnxsdp-env.sh
    
    # Tell rust to use qcc when building QNX 7.0 targets
    export build_env='
        CC_aarch64-unknown-nto-qnx700=qcc
        CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
        CXX_aarch64-unknown-nto-qnx700=qcc
        AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'
    
    # Build rust compiler, libs, and the remote test server
    env $build_env ./x.py build \
      --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
      rustc library/core library/alloc library/std src/tools/remote-test-server
    
    rustup toolchain link stage1 build/host/stage1
    ```
    
    # Compile "hello world"
    
    ```bash
    source _path_/_to_/qnx7.0/qnxsdp-env.sh
    
    cargo new hello_world
    cd hello_world
    cargo +stage1 build --release --target aarch64-unknown-nto-qnx700
    ```
    
    # Configure a remote for testing
    
    Do this from a new shell - we will need to run more commands in the previous one.  I ran into these two issues, and found some workarounds.
    
    * Temporary dir might not work properly
    * Default `remote-test-server` has issues binding to an address
    
    ```
    # ./remote-test-server
    starting test server
    thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
    called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    ```
    
    Specifying `--bind` param actually fixes that, and so does setting `TMPDIR` properly.
    
    ```bash
    # Copy remote-test-server to remote device. You may need to use sftp instead.
    # ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
    scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/
    
    # Run ssh with port forwarding - so that rust tester can connect to the local port instead
    ssh -L 12345:127.0.0.1:12345 qnxdevice
    
    # on the device, run
    rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345
    ```
    
    # Run test suit
    
    Assume all previous environment variables are still set, or re-init them
    
    ```bash
    export TEST_DEVICE_ADDR="localhost:12345"
    
    # tidy needs to be skipped due to using un-published libc dependency
    export exclude_tests='
        --exclude src/bootstrap
        --exclude src/tools/error_index_generator
        --exclude src/tools/linkchecker
        --exclude src/tools/tidy
        --exclude tests/ui-fulldeps
        --exclude rustc
        --exclude rustdoc
        --exclude tests/run-make-fulldeps'
    
    env $build_env ./x.py test  $exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700
    ```
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    fc45466 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#129123 - aDotInTheVoid:rustdoc-json-self, r…

    …=fmease
    
    rustdoc-json: Add test for `Self` type
    
    Inspired by rust-lang#128471, the rustdoc-json suite had no tests in place for the `Self` type. This PR adds one.
    
    I've also manually checked locally that this test passes on 29e9248, confirming that adding `clean::Type::SelfTy` didn't change the JSON output. (potentially adding a self type to json (insead of (ab)using generic) is tracked in rust-lang#128522)
    
    Updates rust-lang#81359
    
    r? ```@fmease```
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    4b9e608 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#129642 - workingjubilee:bump-backtrace-fc37…

    …b22, r=workingjubilee
    
    Bump backtrace to 0.3.74~ish
    
    Commit: rust-lang/backtrace-rs@230570f
    
    This should help with backtraces on Android, QNX NTO 7.0, and Windows.
    It addresses a case of backtrace incurring undefined behavior on Android.
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    4f2d244 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#129675 - lolbinarycat:bufreader_peek_unsize…

    …d, r=workingjubilee
    
    allow BufReader::peek to be called on unsized types
    
    rust-lang#128405
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    605f8cf View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#129723 - compiler-errors:extern-providers, …

    …r=lcnr
    
    Simplify some extern providers
    
    Simplifies some extern crate providers:
    1. Generalize the `ProcessQueryValue` identity impl to work on non-`Option` types.
    2. Allow `ProcessQueryValue` to wrap its output in an `EarlyBinder`, to simplify `explicit_item_bounds`/`explicit_item_super_predicates`.
    3. Use `{ table }` and friends more when possible.
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    77916fa View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#129724 - nnethercote:rm-Option-bang, r=fee1…

    …-dead
    
    Remove `Option<!>` return types.
    
    Several compiler functions have `Option<!>` for their return type. That's odd. The only valid return value is `None`, so why is this type used?
    
    Because it lets you write certain patterns slightly more concisely. E.g. if you have these common patterns:
    ```
        let Some(a) = f() else { return };
        let Ok(b) = g() else { return };
    ```
    you can shorten them to these:
    ```
        let a = f()?;
        let b = g().ok()?;
    ```
    Huh.
    
    An `Option` return type typically designates success/failure. How should I interpret the type signature of a function that always returns (i.e. doesn't panic), does useful work (modifying `&mut` arguments), and yet only ever fails? This idiom subverts the type system for a cute syntactic trick.
    
    Furthermore, returning `Option<!>` from a function F makes things syntactically more convenient within F, but makes things worse at F's callsites. The callsites can themselves use `?` with F but should not, because they will get an unconditional early return, which is almost certainly not desirable. Instead the return value should be ignored. (Note that some of callsites of `process_operand`, `process_immedate`, `process_assign` actually do use `?`, though the early return doesn't matter in these cases because nothing of significance comes after those calls. Ugh.)
    
    When I first saw this pattern I had no idea how to interpret it, and it took me several minutes of close reading to understand everything I've written above. I even started a Zulip thread about it to make sure I understood it properly. "Save a few characters by introducing types so weird that compiler devs have to discuss it on Zulip" feels like a bad trade-off to me. This commit replaces all the `Option<!>` return values and uses `else`/`return` (or something similar) to replace the relevant `?` uses. The result is slightly more verbose but much easier to understand.
    
    r? `@cjgillot`
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    1796f7f View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#129725 - compiler-errors:predicates-of, r=f…

    …mease
    
    Stop using `ty::GenericPredicates` for non-predicates_of queries
    
    `GenericPredicates` is a struct of several parts: A list of of an item's own predicates, and a parent def id (and some effects related stuff, but ignore that since it's kinda irrelevant). When instantiating these generic predicates, it calls `predicates_of` on the parent and instantiates its predicates, and appends the item's own instantiated predicates too:
    
    https://github.com/rust-lang/rust/blob/acb4e8b6251f1d8da36f08e7a70fa23fc581839e/compiler/rustc_middle/src/ty/generics.rs#L407-L413
    
    Notice how this should result in a recursive set of calls to `predicates_of`... However, `GenericPredicates` is *also* misused by a bunch of *other* queries as a convenient way of passing around a list of predicates. For these queries, we don't ever set the parent def id of the `GenericPredicates`, but if we did, then this would be very easy to mistakenly call `predicates_of` instead of some other intended parent query.
    
    Given that footgun, and the fact that we don't ever even *use* the parent def id in the `GenericPredicates` returned from queries like `explicit_super_predicates_of`, It really has no benefit over just returning `&'tcx [(Clause<'tcx>, Span)]`.
    
    This PR additionally opts to wrap the results of `EarlyBinder`, as we've tended to use that in the return type of these kinds of queries to properly convey that the user has params to deal with, and it also gives a convenient way of iterating over a slice of things after instantiating.
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    4e0b6e9 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#129733 - lnicola:sync-from-ra, r=lnicola

    Subtree update of `rust-analyzer`
    
    r? `@ghost`
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    627a063 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#129754 - alexcrichton:fix-wasi-long-sleep, …

    …r=workingjubilee
    
    wasi: Fix sleeping for `Duration::MAX`
    
    This commit fixes an assert in the WASI-specific implementation of thread sleep to ensure that sleeping for a very large period of time blocks instead of panicking. This can come up when testing programs that sleep "forever", for example.
    
    I'll note that I haven't included a test for this since it's sort of difficult to test. I've tested this locally though that long sleeps do indeed block and short sleeps still only sleep for a short amount of time.
    workingjubilee committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    2e53bb9 View commit details
    Browse the repository at this point in the history