Commit Graph

217562 Commits

Author SHA1 Message Date
bors
8011029d3a Auto merge of #13975 - DropDemBits:on-enter-after-dot-chains, r=DropDemBits
fix: Suppress extra indent after the end of field and function chains

(spurred on by <https://github.com/rust-lang/rust-analyzer/issues/4182#issuecomment-671275652>)

Caveat that this doesn't work for after tail expressions, although there shouldn't be anything after those anyways.

This also complicates when to reload the language configuration by nature of now always having a language configuration applicable.

Examples of indentation fixes:

```rs
fn main() {
    println!("Hello!"); // < enter here!
    // ... indents down here

    fs::read_to_string("soup") // < enter here!
    // ... still indents down here :(
        .map(|_| ())
        .map(|_| ()) // < enter here!
        // ... still indents down here :D
        .map_err(|_| ())
        .unwrap(); // < enter here!
    // ... indents down here :D

    // ... and subsequent enters stay at the same indent

    0.0f64
        .to_radians()
        .to_radians()
        .to_radians() // force semi on a new line
        ; // < enter here!
    // ... indents down here :D
}

fn tail_end() -> i32 {
    0i32.wrapping_abs()
        .wrapping_abs()
        .wrapping_abs()
        .wrapping_abs() // < enter here!
        // ... still indents here 🤷
}
```
2023-02-10 20:10:54 +00:00
DropDemBits
c7bd3c682f
Always reload onEnter configuration
Configuration reload doesn't happen often anyway,
and there will always be a set of onEnter rules to load
2023-02-10 14:55:17 -05:00
bors
2773383a31 Auto merge of #107886 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

One day late. Sorry forgot about it yesterday :|
2023-02-10 18:33:22 +00:00
Michael Goulet
0eba2f3c16 Suggest fn call on pattern type mismatch 2023-02-10 18:18:08 +00:00
Chris Denton
59b11e8fa3
Zero the REPARSE_MOUNTPOINT_DATA_BUFFER header
Makes sure the full header is correctly initialized, including reserve parameters.
2023-02-10 18:14:53 +00:00
Michael Goulet
9790d6fbdd Add a couple random projection tests 2023-02-10 18:14:09 +00:00
Guillaume Gomez
295fd0d835 Add regression test for reexported macros docs 2023-02-10 18:37:32 +01:00
Guillaume Gomez
ddb31de281 Also get current import attributes 2023-02-10 18:32:33 +01:00
Guillaume Gomez
c003c01a03 Correctly handle reexports for macros 2023-02-10 18:32:18 +01:00
yukang
c52435a338 cleanup and fix naming 2023-02-10 17:23:09 +00:00
Matthias Krüger
5201bb53bb remove redundant clones 2023-02-10 18:08:25 +01:00
Lukas Bergdoll
7e072199a6 Speedup heapsort by 1.5x by making it branchless
`slice::sort_unstable` will fall back to heapsort if it repeatedly fails to find
a good pivot. By making the core child update code branchless it is much faster.
On Zen3 sorting 10k `u64` and forcing the sort to pick heapsort, results in:

455us -> 278us
2023-02-10 18:05:12 +01:00
yukang
414eb48b66 add only modified for compiletest 2023-02-10 16:25:01 +00:00
bors
d9c020d426 Auto merge of #14120 - Veykril:castable, r=Veykril
internal: Revert castable expectation and simplify

Unfixes https://github.com/rust-lang/rust-analyzer/issues/11571, the PR for that introduced some regressions (tried fixing them but doing what rustc does there specifically does not help, probably because something else affects it as well there)
2023-02-10 15:44:04 +00:00
Lukas Wirth
7677f41f41 Preallocate some vecs 2023-02-10 16:42:09 +01:00
bors
3574b1a69a Auto merge of #107889 - matthiaskrgr:rollup-c0d4al0, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107789 (Avoid exposing type parameters and implementation details sourced from macro expansions)
 - #107836 (Handle properly when there is no crate attrs)
 - #107839 (avoid duplicating the RUSTC_LOG env var name)
 - #107866 (Allow wasi-libc to initialize its environment variables lazily.)
 - #107876 (create symlink only for non-windows operating systems)
 - #107882 (Cleanup typos in en_US/borrowck.ftl)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-10 15:22:51 +00:00
bors
a28f53646d Auto merge of #14119 - Veykril:miniopt, r=Veykril
internal: Remove a few allocations in hir-ty::utils
2023-02-10 15:18:46 +00:00
Lukas Wirth
79492cb8ae internal: Revert castable expectation and simplify 2023-02-10 16:08:47 +01:00
Boxy
4c98429d8c Add tests 2023-02-10 14:56:28 +00:00
Boxy
fa83c10e96 implement compute_alias_eq_goal 2023-02-10 14:56:28 +00:00
Boxy
1f89e2aef2 emit AliasEq when relating type and const aliases 2023-02-10 14:33:13 +00:00
Matthias Krüger
1e106c1cf8
Rollup merge of #107882 - workingjubilee:fix-en-borrowck-ftl-typos, r=compiler-errors
Cleanup typos in en_US/borrowck.ftl

Noticed these while opening https://github.com/rust-lang/rust/pull/107881.
2023-02-10 15:28:50 +01:00
Matthias Krüger
08ce17affc
Rollup merge of #107876 - zephaniahong:issue-107547-fix, r=albertlarsan68
create symlink only for non-windows operating systems

Follow up on #107834
It's my first time using the #cfg attribute. Did I use it correctly?

Thank you!
2023-02-10 15:28:49 +01:00
Matthias Krüger
a4c64b9c0e
Rollup merge of #107866 - sunfishcode:sunfishcode/wasi-lazy-environ, r=workingjubilee
Allow wasi-libc to initialize its environment variables lazily.

Use `__wasilibc_get_environ()` to read the environment variable list from wasi-libc instead of using `environ`. `environ` is a global variable which effectively requires wasi-libc to initialize the environment variables eagerly, and `__wasilibc_get_environ()` is specifically designed to be an alternative that lets wasi-libc intiailize its environment variables lazily.

This should have the side effect of fixing at least some of the cases of #107635.
2023-02-10 15:28:48 +01:00
Matthias Krüger
d8e4d99001
Rollup merge of #107839 - RalfJung:rustc-log, r=oli-obk
avoid duplicating the RUSTC_LOG env var name

We also have the env var name here:
c40919b7a7/compiler/rustc_driver_impl/src/lib.rs (L1247-L1251)
Redundantly having this name twice doesn't seem great. Looks like `rustc_log::init_rustc_env_logger` is dead code anyway.

r? `@oli-obk`
2023-02-10 15:28:48 +01:00
Matthias Krüger
d494cd3eab
Rollup merge of #107836 - chenyukang:yukang/fix-107822, r=oli-obk
Handle properly when there is no crate attrs

Fixes #107822

r? `@oli-obk`
2023-02-10 15:28:47 +01:00
Matthias Krüger
dc7559b599
Rollup merge of #107789 - jieyouxu:issue-107745, r=lcnr
Avoid exposing type parameters and implementation details sourced from macro expansions

Fixes #107745.

~~I would like to **request some guidance** for this issue, because I don't think this is a good fix (a band-aid at best).~~

### The Problem

The code

```rust
fn main() {
    println!("{:?}", []);
}
```

gets desugared into (`rustc +nightly --edition=2018 issue-107745.rs -Z unpretty=hir`):

```rust
#[prelude_import]
use std::prelude::rust_2018::*;
#[macro_use]
extern crate std;
fn main() {
        {
                ::std::io::_print(<#[lang = "format_arguments"]>::new_v1(&["",
                                    "\n"], &[<#[lang = "format_argument"]>::new_debug(&[])]));
            };
    }
```

so the diagnostics code tries to be as specific and helpful as possible, and I think it finds that `[]` needs a type parameter and so does `new_debug`. But since `[]` doesn't have an origin for the type parameter definition, it points to `new_debug` instead and leaks the internal implementation detail since all `[]` has is an type inference variable.

### ~~The Bad Fix~~

~~This PR currently tries to fix the problem by bypassing the generated function `<#[lang = "format_argument"]>::new_debug` to avoid its generic parameter (I think it is auto-generated from the argument `[_; 0]`?) from getting collected as an `InsertableGenericArg`. This is problematic because it also prevents the help from getting displayed.~~

~~I think this fix is not ideal and hard-codes the format generated code pattern, but I can't think of a better fix. I have tried asking on Zulip but no responses there yet.~~
2023-02-10 15:28:47 +01:00
lcnr
3a72238aa6 revert #107074 2023-02-10 15:24:39 +01:00
Ralf Jung
623ed8e481 fix rustc_log doctest 2023-02-10 15:07:55 +01:00
Lukas Wirth
8f5deb4ff2 Remove a few allocations in hir-ty::utils 2023-02-10 14:57:03 +01:00
Guillaume Gomez
a03da2bdeb Add test for implementation on projection 2023-02-10 14:44:54 +01:00
Boxy
23ab2464be add AliasEq to PredicateKind 2023-02-10 13:44:46 +00:00
Philipp Krones
5566eb4da2
Update Cargo.lock 2023-02-10 14:01:31 +01:00
Philipp Krones
0be5779e7d
Merge commit '0f7558148c22e53cd4608773b56cdfa50dcdeac3' into clippyup 2023-02-10 14:01:19 +01:00
bors
0f7558148c Auto merge of #10314 - flip1995:clippy_dev-cli-fix, r=xFrednet
Fix CLI of clippy_dev

Clap was updated in rust-lang/rust-clippy#10270, which broke the command line of clippy_dev. This swaps out contains_id, which now returns always true in the places it was used with get_flag.

r? `@xFrednet`

This should also fix https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60cargo.20dev.20setup.20intellij.60.20is.20degraded/near/325770850

changelog: none
2023-02-10 10:58:06 +00:00
Philipp Krones
fabada0c81
Fix CLI of clippy_dev
Clap was updated in rust-lang/rust-clippy#10270, which broke the command
line of clippy_dev. This swaps out contains_id, which now returns always
true in the places it was used with get_flag.
2023-02-10 11:47:35 +01:00
bors
a7fecd6911 Auto merge of #10313 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-02-10 10:38:32 +00:00
Philipp Krones
19c07f88ee
Bump nightly version -> 2023-02-10 2023-02-10 11:34:02 +01:00
Philipp Krones
7c61b4ed89
Merge remote-tracking branch 'upstream/master' into rustup 2023-02-10 11:33:45 +01:00
Jubilee
1f76cea515 Cleanup typos in en_US/borrowck.ftl 2023-02-10 02:22:08 -08:00
bors
d1ac43a9b9 Auto merge of #107652 - estebank:re_error, r=oli-obk
Introduce `ReError`

CC #69314

r? `@nagisa`
2023-02-10 10:10:12 +00:00
Daniil Belov
601fc8b36b [link] enable packed bundled lib in non stable cases 2023-02-10 12:51:12 +03:00
bors
f11cff8976 Auto merge of #14116 - Veykril:inlay-hints-disc, r=Veykril
Render discriminant inlay hints for mixed variants if at least one discriminant is specified
2023-02-10 08:59:17 +00:00
Lukas Wirth
557aa1e378 Render discriminant inlay hints for mixed variants if at least one discriminant is specified 2023-02-10 09:57:03 +01:00
yukang
257389882d add test for no input file 2023-02-10 08:02:56 +00:00
Jubilee
1af9b4f347
Clarify new_size for realloc means bytes 2023-02-09 23:56:20 -08:00
Zephaniah Ong
d560574c4b create symlink only for non-windows operating systems 2023-02-10 15:25:01 +08:00
bors
e2b868c534 Auto merge of #14114 - lh123:insert-ws-when-inline-macro, r=lnicola
fix: Insert spaces when inlining macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/14108
2023-02-10 07:14:50 +00:00
Tobias Bucher
77c85e9cba Remove a couple of #[doc(hidden)] pub fn and their #[feature] gates 2023-02-10 08:06:35 +01:00
lh123
626dc651ff fix: Insert spaces when inlining macros 2023-02-10 14:22:56 +08:00