]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoincorporate some review feedback
Ralf Jung [Tue, 19 Jul 2022 23:50:04 +0000 (19:50 -0400)]
incorporate some review feedback

2 years agoadd intrinsic to access vtable size and align
Ralf Jung [Mon, 18 Jul 2022 13:48:20 +0000 (09:48 -0400)]
add intrinsic to access vtable size and align

2 years agowe seem to monomorphize fewer vtables by default now, so adjust some tests
Ralf Jung [Sun, 17 Jul 2022 20:17:25 +0000 (16:17 -0400)]
we seem to monomorphize fewer vtables by default now, so adjust some tests

2 years agomake use of symbolic vtables in interpreter
Ralf Jung [Sun, 17 Jul 2022 20:02:49 +0000 (16:02 -0400)]
make use of symbolic vtables in interpreter

2 years agorename get_global_alloc to try_get_global_alloc
Ralf Jung [Sun, 17 Jul 2022 15:40:34 +0000 (11:40 -0400)]
rename get_global_alloc to try_get_global_alloc

2 years agoNormalize the arg spans to be within the call span
Michael Goulet [Wed, 20 Jul 2022 03:05:14 +0000 (03:05 +0000)]
Normalize the arg spans to be within the call span

2 years agoadd a Vtable kind of symbolic allocations
Ralf Jung [Sun, 17 Jul 2022 15:36:37 +0000 (11:36 -0400)]
add a Vtable kind of symbolic allocations

2 years agoprune raw pointer read and write methods from Miri backtraces
Ralf Jung [Wed, 20 Jul 2022 20:42:20 +0000 (16:42 -0400)]
prune raw pointer read and write methods from Miri backtraces

2 years agomiri: prune some atomic operation details from stacktrace
Ralf Jung [Wed, 20 Jul 2022 20:34:24 +0000 (16:34 -0400)]
miri: prune some atomic operation details from stacktrace

2 years agoAdd map_continue and continue_value combinators to ControlFlow
benluelo [Tue, 19 Jul 2022 07:16:07 +0000 (03:16 -0400)]
Add map_continue and continue_value combinators to ControlFlow

Fix type error

Fix continue_value doc comment

2 years agoAuto merge of #99520 - matthiaskrgr:rollup-05uuv5s, r=matthiaskrgr
bors [Wed, 20 Jul 2022 19:37:17 +0000 (19:37 +0000)]
Auto merge of #99520 - matthiaskrgr:rollup-05uuv5s, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #99212 (introduce `implied_by` in `#[unstable]` attribute)
 - #99352 (Use `typeck_results` to avoid duplicate `ast_ty_to_ty` call)
 - #99355 (better error for bad depth parameter on macro metavar expr)
 - #99480 (Diagnostic width span is not added when '0$' is used as width in format strings)
 - #99488 (compiletest: Allow using revisions with debuginfo tests.)
 - #99489 (rustdoc UI fixes)
 - #99508 (Avoid `Symbol` to `String` conversions)
 - #99510 (adapt assembly/static-relocation-model test for LLVM change)
 - #99516 (Use new tracking issue for proc_macro::tracked_*.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix the stable version of `AsFd for Arc<T>` and `Box<T>`
Josh Stone [Wed, 20 Jul 2022 19:09:49 +0000 (12:09 -0700)]
Fix the stable version of `AsFd for Arc<T>` and `Box<T>`

These merged in #97437 for 1.64.0, apart from the main `io_safety`
feature that stabilized in 1.63.0.

2 years agoFix hack that remaps env constness.
Deadbeef [Wed, 20 Jul 2022 17:33:45 +0000 (17:33 +0000)]
Fix hack that remaps env constness.

WARNING: might have perf implications.

Are there any more problems with having a constness
in the `ParamEnv` now? :)

2 years agoimplement literal_from_str (poorly)
Amos Wenger [Wed, 20 Jul 2022 17:23:25 +0000 (19:23 +0200)]
implement literal_from_str (poorly)

2 years agoAdd literal/ident conversion, tests pass
Amos Wenger [Wed, 20 Jul 2022 17:13:06 +0000 (19:13 +0200)]
Add literal/ident conversion, tests pass

2 years agostub missing APIs
Amos Wenger [Wed, 20 Jul 2022 16:43:59 +0000 (18:43 +0200)]
stub missing APIs

2 years agoFix imports, delete removed interfaces
Amos Wenger [Wed, 20 Jul 2022 16:36:10 +0000 (18:36 +0200)]
Fix imports, delete removed interfaces

2 years agoMove token_stream to separate module
Amos Wenger [Wed, 20 Jul 2022 16:32:27 +0000 (18:32 +0200)]
Move token_stream to separate module

2 years agoAdd sysroot-abi feature, copy 1.64 ABI fo rnow
Amos Wenger [Wed, 20 Jul 2022 16:27:58 +0000 (18:27 +0200)]
Add sysroot-abi feature, copy 1.64 ABI fo rnow

2 years agoRollup merge of #99516 - m-ou-se:proc-macro-tracked-tracking-issue, r=Mark-Simulacrum
Matthias Krüger [Wed, 20 Jul 2022 16:58:22 +0000 (18:58 +0200)]
Rollup merge of #99516 - m-ou-se:proc-macro-tracked-tracking-issue, r=Mark-Simulacrum

Use new tracking issue for proc_macro::tracked_*.

2 years agoRollup merge of #99510 - krasimirgg:movb, r=nikic
Matthias Krüger [Wed, 20 Jul 2022 16:58:21 +0000 (18:58 +0200)]
Rollup merge of #99510 - krasimirgg:movb, r=nikic

adapt assembly/static-relocation-model test for LLVM change

After https://github.com/llvm/llvm-project/commit/f0dd12ec5c0169ba5b4363b62d59511181cf954a LLVM emits `movzbl` instead. Adapted this test case accordingly.

Discovered in our experimental rust + llvm at head ci:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12104#0182195b-8791-4f88-853c-bb23a1e4b54c

2 years agoRollup merge of #99508 - TaKO8Ki:avoid-symbol-to-string-conversion-in-BuiltinLintDiag...
Matthias Krüger [Wed, 20 Jul 2022 16:58:20 +0000 (18:58 +0200)]
Rollup merge of #99508 - TaKO8Ki:avoid-symbol-to-string-conversion-in-BuiltinLintDiagnostics, r=compiler-errors

Avoid `Symbol` to `String` conversions

follow-up to #99342

2 years agoRollup merge of #99489 - GuillaumeGomez:gui-fixes, r=notriddle
Matthias Krüger [Wed, 20 Jul 2022 16:58:19 +0000 (18:58 +0200)]
Rollup merge of #99489 - GuillaumeGomez:gui-fixes, r=notriddle

rustdoc UI fixes

The first commit fixes this bug:

![Screenshot from 2022-07-20 02-54-26](https://user-images.githubusercontent.com/3050060/179879053-fc34f27a-6248-4f5c-9fcb-80adbfc1598c.png)
![Screenshot from 2022-07-20 03-00-03](https://user-images.githubusercontent.com/3050060/179879056-1c0973a0-d535-44e7-a48e-bad692034467.png)

The second one fixes the missing change of border color when the search input is focused.

cc `@jsha`
r? `@notriddle`

2 years agoRollup merge of #99488 - luqmana:debuginfo-revisions, r=tmiasko
Matthias Krüger [Wed, 20 Jul 2022 16:58:18 +0000 (18:58 +0200)]
Rollup merge of #99488 - luqmana:debuginfo-revisions, r=tmiasko

compiletest: Allow using revisions with debuginfo tests.

A small wart that came up in https://github.com/rust-lang/rust/pull/95685#issuecomment-1089184951.

2 years agoRollup merge of #99480 - miam-miam100:arg-format, r=oli-obk
Matthias Krüger [Wed, 20 Jul 2022 16:58:17 +0000 (18:58 +0200)]
Rollup merge of #99480 - miam-miam100:arg-format, r=oli-obk

Diagnostic width span is not added when '0$' is used as width in format strings

When the following code is run rustc does not add diagnostic spans for the width argument. Such spans are necessary for a clippy lint that I am currently writing.

```rust
println!("Hello {1:0$}!", 5, "x");
//                 ^^
// Should have a span here
```

2 years agoRollup merge of #99355 - compiler-errors:macro-metavar-less-than-zero, r=petrochenkov
Matthias Krüger [Wed, 20 Jul 2022 16:58:16 +0000 (18:58 +0200)]
Rollup merge of #99355 - compiler-errors:macro-metavar-less-than-zero, r=petrochenkov

better error for bad depth parameter on macro metavar expr

Fixes #99060

2 years agoRollup merge of #99352 - compiler-errors:tighter-spans-on-generic-call, r=spastorino
Matthias Krüger [Wed, 20 Jul 2022 16:58:15 +0000 (18:58 +0200)]
Rollup merge of #99352 - compiler-errors:tighter-spans-on-generic-call, r=spastorino

Use `typeck_results` to avoid duplicate `ast_ty_to_ty` call

Comes with a bunch of improvements in spans :heart_eyes:

2 years agoRollup merge of #99212 - davidtwco:partial-stability-implies, r=michaelwoerister
Matthias Krüger [Wed, 20 Jul 2022 16:58:14 +0000 (18:58 +0200)]
Rollup merge of #99212 - davidtwco:partial-stability-implies, r=michaelwoerister

introduce `implied_by` in `#[unstable]` attribute

Requested by the library team [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/better.20support.20for.20partial.20stabilizations/near/285581519).

If part of a feature is stabilized and a new feature is added for the remaining parts, then the `implied_by` meta-item can be added to `#[unstable]` to indicate which now-stable feature was used previously.

```diagnostic
error: the feature `foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `foobar`
  --> $DIR/stability-attribute-implies-using-unstable.rs:3:12
   |
LL | #![feature(foo)]
   |            ^^^
   |
note: the lint level is defined here
  --> $DIR/stability-attribute-implies-using-stable.rs:2:9
   |
LL | #![deny(stable_features)]
   |         ^^^^^^^^^^^^^^^
help: if you are using features which are still unstable, change to using `foobar`
   |
LL | #![feature(foobar)]
   |            ~~~~~~
help: if you are using features which are now stable, remove this line
   |
LL - #![feature(foo)]
   |
```

When a `#![feature(..)]` attribute still exists for the now-stable attribute, then there this has two effects:

- There will not be an stability error for uses of items from the implied feature which are still unstable (until the `#![feature(..)]` is removed or updated to the new feature).
- There will be an improved diagnostic for the remaining use of the feature attribute for the now-stable feature.

```rust
        /// If part of a feature is stabilized and a new feature is added for the remaining parts,
        /// then the `implied_by` attribute is used to indicate which now-stable feature previously
        /// contained a item.
        ///
        /// ```pseudo-Rust
        /// #[unstable(feature = "foo", issue = "...")]
        /// fn foo() {}
        /// #[unstable(feature = "foo", issue = "...")]
        /// fn foobar() {}
        /// ```
        ///
        /// ...becomes...
        ///
        /// ```pseudo-Rust
        /// #[stable(feature = "foo", since = "1.XX.X")]
        /// fn foo() {}
        /// #[unstable(feature = "foobar", issue = "...", implied_by = "foo")]
        /// fn foobar() {}
        /// ```
```

In the Zulip discussion, this was envisioned as `implies` on `#[stable]` but I went with `implied_by` on `#[unstable]` because it means that only the unstable attribute needs to be changed in future, not the new stable attribute, which seems less error-prone. It also isn't particularly feasible for me to detect whether items from the implied feature are used and then only suggest updating _or_ removing the `#![feature(..)]` as appropriate, so I always do both.

There's some new information in the cross-crate metadata as a result of this change, that's a little unfortunate, but without requiring that the `#[unstable]` and `#[stable]` attributes both contain the implication information, it's necessary:

```rust
    /// This mapping is necessary unless both the `#[stable]` and `#[unstable]` attributes should
    /// specify their implications (both `implies` and `implied_by`). If only one of the two
    /// attributes do (as in the current implementation, `implied_by` in `#[unstable]`), then this
    /// mapping is necessary for diagnostics. When a "unnecessary feature attribute" error is
    /// reported, only the `#[stable]` attribute information is available, so the map is necessary
    /// to know that the feature implies another feature. If it were reversed, and the `#[stable]`
    /// attribute had an `implies` meta item, then a map would be necessary when avoiding a "use of
    /// unstable feature" error for a feature that was implied.
```

I also change some comments to documentation comments in the compiler, add a helper for going from a `Span` to a `Span` for the entire line, and fix a incorrect part of the pre-existing stability attribute diagnostics.

cc `@yaahc`

2 years agoAuto merge of #99472 - RalfJung:provenance, r=oli-obk
bors [Wed, 20 Jul 2022 16:56:31 +0000 (16:56 +0000)]
Auto merge of #99472 - RalfJung:provenance, r=oli-obk

interpret: rename Tag/PointerTag to Prov/Provenance

We were pretty inconsistent with calling this the "tag" vs the "provenance" of the pointer; I think we should consistently call it "provenance".

r? `@oli-obk`

2 years agoAuto merge of #12834 - fasterthanlime:proc-macro-test-toolchain, r=Veykril
bors [Wed, 20 Jul 2022 16:04:23 +0000 (16:04 +0000)]
Auto merge of #12834 - fasterthanlime:proc-macro-test-toolchain, r=Veykril

Add PROC_MACRO_TEST_TOOLCHAIN environment variable

This allows overriding the toolchain used to run `proc-macro-srv` tests.

---

Sample usage.

Testing the current ABI (variable unset/empty):

```shell
amos@tails ~/bearcove/rust-analyzer/crates/proc-macro-srv proc-macro-test-toolchain*
❯ PROC_MACRO_TEST_TOOLCHAIN="" cargo test --quiet

running 16 tests
................
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
```

Testing an older ABI:

```shell
amos@tails ~/bearcove/rust-analyzer/crates/proc-macro-srv proc-macro-test-toolchain*
❯ PROC_MACRO_TEST_TOOLCHAIN="1.58" cargo test --quiet

running 16 tests
................
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
```

Testing current nightly ABI:

```shell
❯ rustc +nightly --version
rustc 1.64.0-nightly (f8588549c 2022-07-18)

❯ PROC_MACRO_TEST_TOOLCHAIN="nightly" cargo test --quiet

running 16 tests
................
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
```

Testing future ABI (`rust-lang/rust` master):

```shell
amos@tails ~/bearcove/rust-analyzer/crates/proc-macro-srv proc-macro-test-toolchain
❯ PROC_MACRO_TEST_TOOLCHAIN="stage1" cargo test --quiet

running 16 tests
..........thread '<unnamed>' panicked at 'range end index 216221164920373249 out of range for slice of length 18', library/core/src/slice/index.rs:73:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
....F.
failures:

---- tests::test_fn_like_macro2 stdout ----
thread 'tests::test_fn_like_macro2' panicked at 'called `Result::unwrap()` on an `Err` value: "range end index 216221164920373249 out of range for slice of length 18"', crates/proc-macro-srv/src/tests/utils.rs:38:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    tests::test_fn_like_macro2

test result: FAILED. 15 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass '--lib
```

---

Tagging `@jonas-schievink:` this might be helpful when updating versioned ABIs later on.

2 years agoAdd PROC_MACRO_TEST_TOOLCHAIN environment variable
Amos Wenger [Wed, 20 Jul 2022 15:43:45 +0000 (17:43 +0200)]
Add PROC_MACRO_TEST_TOOLCHAIN environment variable

This allows overriding the toolchain used to run `proc-macro-srv` tests.

2 years agoUse new tracking issue for proc_macro::tracked_*.
Mara Bos [Wed, 20 Jul 2022 15:35:06 +0000 (17:35 +0200)]
Use new tracking issue for proc_macro::tracked_*.

2 years agoAuto merge of #12833 - fasterthanlime:literal-tests, r=Veykril
bors [Wed, 20 Jul 2022 15:33:19 +0000 (15:33 +0000)]
Auto merge of #12833 - fasterthanlime:literal-tests, r=Veykril

Add proc-macro-srv integration test that clones literals

This exercises some of the upcoming proc_macro bridge changes. It should also pass for all supported ABIs, with the older-style bridge.

This changed is tracked in:

  * https://github.com/rust-lang/rust-analyzer/issues/12818

2 years agoAuto merge of #12831 - fasterthanlime:proc-macro-test-in-tmp-dir, r=fasterthanlime
bors [Wed, 20 Jul 2022 15:21:03 +0000 (15:21 +0000)]
Auto merge of #12831 - fasterthanlime:proc-macro-test-in-tmp-dir, r=fasterthanlime

Build proc-macro-test-impl out-of-tree

Building it in-place fails in rust CI because the source directory is read-only. This changes `proc-macro-test`'s build script to first
copy `imp` under `OUT_DIR` (which is read-write).

It also prints stdout/stderr for the nested cargo invocation, should it fail. (I've seen failures in rust CI that I couldn't explain, and
when they take 25 minutes to reproduce, you want to have that info)

This change is tracked in:

  * https://github.com/rust-lang/rust-analyzer/issues/12818

Maintainer impact: none.

2 years agoTest codegen of atomic compare-exchange with additional memory orderings
Tomasz Miąsko [Mon, 18 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Test codegen of atomic compare-exchange with additional memory orderings

* Add a test for atomic operations introduced in #97423 & #98383.
* Add a test for fallback code generation strategy used on LLVM 12
  introduced in #98385. Use a separate test case instead of a revision
  system since test will be gone once LLVM 12 is no longer supported.

2 years agoUpdate crates/proc-macro-test/build.rs
Amos Wenger [Wed, 20 Jul 2022 14:56:30 +0000 (16:56 +0200)]
Update crates/proc-macro-test/build.rs

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2 years agoUpdate crates/proc-macro-test/build.rs
Amos Wenger [Wed, 20 Jul 2022 14:56:25 +0000 (16:56 +0200)]
Update crates/proc-macro-test/build.rs

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2 years agopasses: check implied feature exists
David Wood [Wed, 20 Jul 2022 13:52:23 +0000 (14:52 +0100)]
passes: check implied feature exists

Add a check confirming that features referenced in `implied_by` meta
items actually exist.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoAdd proc-macro-srv integration test that clones literals
Amos Wenger [Wed, 20 Jul 2022 14:40:02 +0000 (16:40 +0200)]
Add proc-macro-srv integration test that clones literals

This exercises some of the upcoming proc_macro bridge changes. It
should also pass for all supported ABIs, with the older-style bridge.

2 years agoDon't copy the Cargo.lock
Amos Wenger [Wed, 20 Jul 2022 14:30:08 +0000 (16:30 +0200)]
Don't copy the Cargo.lock

2 years agoproc-macro-test build script: wipe before, be more verbose
Amos Wenger [Wed, 20 Jul 2022 14:22:48 +0000 (16:22 +0200)]
proc-macro-test build script: wipe before, be more verbose

2 years agoBuild proc-macro-test-impl out-of-tree
Amos Wenger [Wed, 20 Jul 2022 14:14:53 +0000 (16:14 +0200)]
Build proc-macro-test-impl out-of-tree

Building it in-place fails in rust CI because the source directory
is read-only. This changes `proc-macro-test`'s build script to first
copy `imp` under `OUT_DIR` (which is read-write).

It also prints stdout/stderr for the nested cargo invocation, should
it fail. (I've seen failures in rust CI that I couldn't explain, and
when they take 25 minutes to reproduce, you want to have that info)

2 years agoowner is not micro (correct typo)
joboet [Wed, 20 Jul 2022 14:11:31 +0000 (16:11 +0200)]
owner is not micro (correct typo)

2 years agoAuto merge of #12829 - fasterthanlime:in-rust-tree-feature, r=Veykril
bors [Wed, 20 Jul 2022 14:02:49 +0000 (14:02 +0000)]
Auto merge of #12829 - fasterthanlime:in-rust-tree-feature, r=Veykril

Remove `check_merge_commits` test

Due to the way "git subtree" works, the `check_merge_commits` test _will_ find merge commits and fail, so we simply skip it.

This changed is tracked in:

  * https://github.com/rust-lang/rust-analyzer/issues/12818

Maintainer impact: none

2 years agoRemove in-rust-tree feature
Amos Wenger [Wed, 20 Jul 2022 13:58:56 +0000 (15:58 +0200)]
Remove in-rust-tree feature

Since it's unused for now -it'll be re-introduced along with the
upcoming `proc-macro-srv/sysroot` feature.

2 years agoRemove check_merge_commits test altogether
Amos Wenger [Wed, 20 Jul 2022 13:57:13 +0000 (15:57 +0200)]
Remove check_merge_commits test altogether

Rationale: Merge commits will probably end up in
`rust-lang/rust-analyzer` when doing "rust=>ra" syncs anyway.

It could be changed to only check for merge commits in non-sync PRs,
but it's "probably not worth the hassle"

2 years agopasses: improved partial stabilization diagnostic
David Wood [Wed, 13 Jul 2022 14:10:19 +0000 (15:10 +0100)]
passes: improved partial stabilization diagnostic

Improves the diagnostic when a feature attribute is specified
unnecessarily but the feature implies another (i.e. it was partially
stabilized) to refer to the implied feature.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agospan: add `span_extend_to_line` helper
David Wood [Wed, 13 Jul 2022 14:02:23 +0000 (15:02 +0100)]
span: add `span_extend_to_line` helper

Adds a simple helper function to the `SourceMap` for extending a `Span`
to encompass the entire line it is on - useful for suggestions where
removing a line is the suggested action.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomiddle: add `implies_by` to `#[unstable]`
David Wood [Wed, 13 Jul 2022 12:10:37 +0000 (13:10 +0100)]
middle: add `implies_by` to `#[unstable]`

If part of a feature is stabilized and a new feature is added for the
remaining parts, then the `implied_by` attribute can be used to indicate
which now-stable feature previously contained a item. If the now-stable
feature is still active (if the user has only just updated rustc, for
example) then there will not be an stability error for uses of the item
from the implied feature.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoAuto merge of #12828 - fasterthanlime:proc-macro-srv-naming, r=Veykril
bors [Wed, 20 Jul 2022 13:50:28 +0000 (13:50 +0000)]
Auto merge of #12828 - fasterthanlime:proc-macro-srv-naming, r=Veykril

Rename proc macro server from 'Rustc' to 'RustAnalyzer'

Related to:

  * https://github.com/rust-lang/rust-analyzer/issues/12818

This is mostly a courtesy PR for the sake of rustc maintainers. When they looked at `proc-macro-srv`, they noticed the server was named `Rustc` — probably because of historical copy-paste. Only rustc's proc macro server should be named `Rustc`, ra's can be named `RustAnalyzer`.

Maintainer impact: There's no semantic changes in this PR, only naming. One test snapshot was updated since "proc macro server types" were used to test traits somewhere else and I renamed those too, why not.

2 years agoAllow merge commits when 'in-rust-tree' feature is enabled
Amos Wenger [Wed, 20 Jul 2022 13:49:40 +0000 (15:49 +0200)]
Allow merge commits when 'in-rust-tree' feature is enabled

This adds an `in-rust-tree` feature that will be enabled when
rust-analyzer is built from `rust-lang/rust`. Due to the way
"git subtree" works, that test _will_ find merge commits and
fail, so we simply skip it.

2 years agoAdd ShadowCallStack Support
Ivan Lozano [Fri, 17 Jun 2022 18:14:58 +0000 (14:14 -0400)]
Add ShadowCallStack Support

Adds support for the LLVM ShadowCallStack sanitizer.

2 years agoRename proc macro server from 'Rustc' to 'RustAnalyzer'
Amos Wenger [Wed, 20 Jul 2022 13:40:23 +0000 (15:40 +0200)]
Rename proc macro server from 'Rustc' to 'RustAnalyzer'

2 years agoAuto merge of #99506 - Dylan-DPC:rollup-q3msucx, r=Dylan-DPC
bors [Wed, 20 Jul 2022 13:36:59 +0000 (13:36 +0000)]
Auto merge of #99506 - Dylan-DPC:rollup-q3msucx, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #98101 (stdlib support for Apple WatchOS)
 - #99345 (Do not allow typeck children items to constrain outer RPITs)
 - #99383 (Formalize defining_use_anchor)
 - #99436 (Add flag to configure `noalias` on `Box<T>`)
 - #99483 (Fix a numerical underflow in tuple wrap suggestion)
 - #99485 (Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations)
 - #99486 (Refactor: remove a string comparison between types in `check_str_addition`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAuto merge of #12826 - fasterthanlime:in-tree-warnings, r=Veykril
bors [Wed, 20 Jul 2022 13:14:36 +0000 (13:14 +0000)]
Auto merge of #12826 - fasterthanlime:in-tree-warnings, r=Veykril

Enable (and fix) extra lint groups required for in-tree build

This enables 3 lint groups that are required to build rust-analyzer as an "in-tree" (git subtree) tool in `rust-lang/rust`, and fixes all relevant diagnostics.

This change is tracked in:

  * https://github.com/rust-lang/rust-analyzer/issues/12818

Maintainer impact: more warnings, should be easy enough to fix them (it's mostly looking out for "rust-2015-isms", the lint group is poorly named). If you forget some, they'll show up during a `ra=>rust` sync.

2 years agointernal: Don't eagerly construct `AstIdMap`s
Lukas Wirth [Wed, 20 Jul 2022 13:12:00 +0000 (15:12 +0200)]
internal: Don't eagerly construct `AstIdMap`s

2 years agoRun cargo fmt
Amos Wenger [Wed, 20 Jul 2022 13:06:15 +0000 (15:06 +0200)]
Run cargo fmt

2 years agoFix last few warnings manually
Amos Wenger [Wed, 20 Jul 2022 13:05:02 +0000 (15:05 +0200)]
Fix last few warnings manually

2 years agoRun cargo fix --edition-idioms
Amos Wenger [Wed, 20 Jul 2022 13:02:08 +0000 (15:02 +0200)]
Run cargo fix --edition-idioms

2 years agoEnable extra warnings required by rust-lang/rust
Amos Wenger [Wed, 20 Jul 2022 12:59:42 +0000 (14:59 +0200)]
Enable extra warnings required by rust-lang/rust

2 years agoadapt assembly/static-relocation-model test for LLVM change
Krasimir Georgiev [Wed, 20 Jul 2022 12:56:42 +0000 (12:56 +0000)]
adapt assembly/static-relocation-model test for LLVM change

After
https://github.com/llvm/llvm-project/commit/f0dd12ec5c0169ba5b4363b62d59511181cf954a,
LLVM emits `movzbl` instead. Adapted this test case accordingly.

Discovered in our experimental rust + llvm at head ci:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12104#0182195b-8791-4f88-853c-bb23a1e4b54c

2 years agoFix off by one error and add ui test.
miam-miam100 [Wed, 20 Jul 2022 12:40:45 +0000 (13:40 +0100)]
Fix off by one error and add ui test.

2 years agoAdd diagnostic width span when '0$' is used as width.
miam-miam100 [Tue, 19 Jul 2022 21:25:26 +0000 (22:25 +0100)]
Add diagnostic width span when '0$' is used as width.

2 years agoAuto merge of #12825 - Veykril:trait-assoc-search, r=Veykril
bors [Wed, 20 Jul 2022 12:00:14 +0000 (12:00 +0000)]
Auto merge of #12825 - Veykril:trait-assoc-search, r=Veykril

fix: Fix search for associated trait items being inconsistent

2 years agofix: Fix search for associated trait items being inconsistent
Lukas Wirth [Wed, 20 Jul 2022 11:59:31 +0000 (13:59 +0200)]
fix: Fix search for associated trait items being inconsistent

2 years agoRemove unused StableMap and StableSet types from rustc_data_structures
Michael Woerister [Fri, 8 Jul 2022 16:06:18 +0000 (18:06 +0200)]
Remove unused StableMap and StableSet types from rustc_data_structures

2 years agoAuto merge of #12646 - lowr:fix/11897, r=lowr
bors [Wed, 20 Jul 2022 10:51:31 +0000 (10:51 +0000)]
Auto merge of #12646 - lowr:fix/11897, r=lowr

fix: escape receiver texts in completion

This PR fixes #11897 by escaping '\\' and '$' in the text of the receiver position expression. See [here](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax) for the specification of the snippet syntax (especially [this section](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#grammar) discusses escaping).

Although not all occurrences of '\\' and '$' have to be replaced, I chose to replace all as that's simpler and easier to understand. There *are* more clever ways to implement it, but I thought they were premature optimization for the time being (maybe I should put FIXME notes?).

2 years agoRollup merge of #99486 - TaKO8Ki:remove-type-string-comparison-in-check-str-addition...
Dylan DPC [Wed, 20 Jul 2022 10:47:23 +0000 (16:17 +0530)]
Rollup merge of #99486 - TaKO8Ki:remove-type-string-comparison-in-check-str-addition, r=compiler-errors

Refactor: remove a string comparison between types in `check_str_addition`

This patch removes remove a string of types comparison.

2 years agoRollup merge of #99485 - mdholloway:unused-qualifications-in-derive, r=oli-obk
Dylan DPC [Wed, 20 Jul 2022 10:47:22 +0000 (16:17 +0530)]
Rollup merge of #99485 - mdholloway:unused-qualifications-in-derive, r=oli-obk

Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations

Currently, the `#[derive]` attribute always injects an `#[allow(unused_qualifications)]` attribute in the generated implementation. This results in an error when a derive is used in combination with `#![forbid(unused_qualifications)]`, because the `forbid` rule by definition cannot be overridden by `allow`.

It appears that the original issue that prompted the inclusion of `#[allow(unused_qualifications)]` (#19102) is no longer present in the current stable release, and the associated [test case](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-19102.rs) still passes, so the `allow` is simply removed here.

Fixes #71898.

2 years agoRollup merge of #99483 - compiler-errors:issue-99482, r=jyn514
Dylan DPC [Wed, 20 Jul 2022 10:47:21 +0000 (16:17 +0530)]
Rollup merge of #99483 - compiler-errors:issue-99482, r=jyn514

Fix a numerical underflow in tuple wrap suggestion

Fixes #99482

I'm a clown, I rewrote the arg mismatch algo to use well-typed indices to avoid things like this, but then I added my own indexing bug, lol.

2 years agoRollup merge of #99436 - Nilstrieb:toggle-box-noalias, r=fee1-dead
Dylan DPC [Wed, 20 Jul 2022 10:47:20 +0000 (16:17 +0530)]
Rollup merge of #99436 - Nilstrieb:toggle-box-noalias, r=fee1-dead

Add flag to configure `noalias` on `Box<T>`

The aliasing rules of `Box<T>` are still not decided, but currently, `Box<T>` is unique and gets `noalias`. To aid making an informed decision about the future of `Box<T>`, this PR adds a flag `-Zbox-noalias` to configure `noalias` for `Box<T>` (for example, for benchmarking). The same flag already exists for `&mut T` `noalias`, where it was added because it was the problem of various miscompilations in LLVM.

For more information, see rust-lang/unsafe-code-guidelines#326

2 years agoRollup merge of #99383 - ouz-a:issue_57961, r=oli-obk
Dylan DPC [Wed, 20 Jul 2022 10:47:19 +0000 (16:17 +0530)]
Rollup merge of #99383 - ouz-a:issue_57961, r=oli-obk

Formalize defining_use_anchor

This tackles issue #57961

Introduces new enum called `DefiningAnchor` that replaces `Option<LocalDefId>` of `defining_use_anchor`. Now every use of it is explicit and exhaustively matched, catching errors like one in the linked issue. This is not a perfect fix but it's a step in the right direction.

r? `@oli-obk`

2 years agoRollup merge of #99345 - compiler-errors:issue-99073-redux, r=oli-obk
Dylan DPC [Wed, 20 Jul 2022 10:47:18 +0000 (16:17 +0530)]
Rollup merge of #99345 - compiler-errors:issue-99073-redux, r=oli-obk

Do not allow typeck children items to constrain outer RPITs

Fixes #99073 in a simpler and more conservative way than #99079. Simply raise a mismatched types error if we try to constrain an RPIT in an item that isn't the RPIT's parent.

r? `@oli-obk`

2 years agoRollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomcc
Dylan DPC [Wed, 20 Jul 2022 10:47:17 +0000 (16:17 +0530)]
Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomcc

stdlib support for Apple WatchOS

This is a follow-up to https://github.com/rust-lang/rust/pull/95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS.

`@deg4uss3r`
`@nagisa`

2 years agoUse FxIndexMap instead of otherwise unused StableMap for WEAK_ITEMS_REFS.
Michael Woerister [Fri, 8 Jul 2022 15:45:55 +0000 (17:45 +0200)]
Use FxIndexMap instead of otherwise unused StableMap for WEAK_ITEMS_REFS.

2 years agoAuto merge of #99495 - oli-obk:revert_98582, r=oli-obk
bors [Wed, 20 Jul 2022 10:34:42 +0000 (10:34 +0000)]
Auto merge of #99495 - oli-obk:revert_98582, r=oli-obk

Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r…

…=estebank"

This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing
changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.

r? `@ghost`

rebase of https://github.com/rust-lang/rust/pull/99368

2 years agoattr: fix expected meta-item for `#[stable]`
David Wood [Wed, 13 Jul 2022 09:36:12 +0000 (10:36 +0100)]
attr: fix expected meta-item for `#[stable]`

When an unexpected meta item is provided to `#[stable]`, the diagnostic
lists "since" and "note" as expected meta-items, however the surrounding
code actually expects "feature" and "since".

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoattr/passes: comment -> doc comment
David Wood [Wed, 13 Jul 2022 09:09:37 +0000 (10:09 +0100)]
attr/passes: comment -> doc comment

Change some regular comments into documentation comments.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoAdd GUI tests for search input border color
Guillaume Gomez [Wed, 20 Jul 2022 01:52:16 +0000 (03:52 +0200)]
Add GUI tests for search input border color

2 years agoRemove CSS transition for search input border-color
Guillaume Gomez [Wed, 20 Jul 2022 10:19:17 +0000 (12:19 +0200)]
Remove CSS transition for search input border-color

2 years agoAdd comments
Ryo Yoshida [Wed, 20 Jul 2022 10:10:52 +0000 (19:10 +0900)]
Add comments

2 years agouse def_id
ouz-a [Wed, 20 Jul 2022 09:51:07 +0000 (12:51 +0300)]
use def_id

2 years agoclippy::perf fixes
Matthias Krüger [Wed, 20 Jul 2022 09:48:11 +0000 (11:48 +0200)]
clippy::perf fixes

2 years agotake opaq types
ouz-a [Sat, 2 Jul 2022 13:37:49 +0000 (16:37 +0300)]
take opaq types

2 years agoavoid `&str` to String conversions
Takayuki Maeda [Wed, 20 Jul 2022 09:19:57 +0000 (18:19 +0900)]
avoid `&str` to String conversions

2 years agoavoid a `Symbol` to `String` conversion
Takayuki Maeda [Wed, 20 Jul 2022 09:19:25 +0000 (18:19 +0900)]
avoid a `Symbol` to `String` conversion

2 years agoLibrary changes for Apple WatchOS
Vladimir Michael Eatwell [Wed, 23 Mar 2022 16:05:01 +0000 (16:05 +0000)]
Library changes for Apple WatchOS

2 years agoRevert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
Oli Scherer [Wed, 20 Jul 2022 07:55:58 +0000 (07:55 +0000)]
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"

This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing
changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.

2 years agocompiletest: dedup revision line logic.
Luqman Aden [Wed, 20 Jul 2022 02:13:33 +0000 (19:13 -0700)]
compiletest: dedup revision line logic.

2 years agoUse revision support to remove near identical debuginfo test.
Luqman Aden [Wed, 20 Jul 2022 01:30:12 +0000 (18:30 -0700)]
Use revision support to remove near identical debuginfo test.

2 years agocompiletest: allow using revisions with debuginfo tests
Luqman Aden [Wed, 20 Jul 2022 01:27:33 +0000 (18:27 -0700)]
compiletest: allow using revisions with debuginfo tests

2 years agoAuto merge of #99493 - Dylan-DPC:rollup-lli4gcx, r=Dylan-DPC
bors [Wed, 20 Jul 2022 07:03:54 +0000 (07:03 +0000)]
Auto merge of #99493 - Dylan-DPC:rollup-lli4gcx, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98784 (Suggest returning local on "expected `ty`, found `()`" due to expr-less block)
 - #98916 (Windows: Use `FindFirstFileW` for getting the metadata of locked system files)
 - #99433 (Erase regions before comparing signatures of foreign fns.)
 - #99452 (int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc)
 - #99481 (Add regression test for #71547)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAuto merge of #12811 - TopGunSnake:12790, r=Veykril
bors [Wed, 20 Jul 2022 06:29:06 +0000 (06:29 +0000)]
Auto merge of #12811 - TopGunSnake:12790, r=Veykril

fix: Insert `pub(crate)` after doc comments and attribute macros

Fixes #12790

Original behavior was to insert `pub(crate)` at the `first_child_or_token`, which for an item with a comment or attribute macro, would put the visibility marker before the comment or macro, instead of after.

This merge request alters the call to find the node with appropriate `SyntaxKind` in the `children_or_tokens`. It also adds a test case to the module to verify the behavior. Test case verifies function, module, records, enum, impl, trait, and type cases.

2 years agoAuto merge of #12821 - SpecialMike:fix-partial-eq-default, r=Veykril
bors [Wed, 20 Jul 2022 06:20:21 +0000 (06:20 +0000)]
Auto merge of #12821 - SpecialMike:fix-partial-eq-default, r=Veykril

fix: Correctly generate default `PartialEq::ne`

Fixes #12779

For the `Generate default members` assist on the `PartialEq` trait, the assist will now give the default implementation instead of generating a function.

2 years agoRollup merge of #99481 - JohnTitor:issue-71547, r=compiler-errors
Dylan DPC [Wed, 20 Jul 2022 05:59:41 +0000 (11:29 +0530)]
Rollup merge of #99481 - JohnTitor:issue-71547, r=compiler-errors

Add regression test for #71547

Closes #71547
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2 years agoRollup merge of #99452 - Stargateur:fix/typo, r=JohnTitor
Dylan DPC [Wed, 20 Jul 2022 05:59:40 +0000 (11:29 +0530)]
Rollup merge of #99452 - Stargateur:fix/typo, r=JohnTitor

int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc

typo in doc [here](https://doc.rust-lang.org/std/primitive.isize.html#method.from_ne_bytes) "returns" => "takes"

`@rustbot` label +T-rustdoc

2 years agoRollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors
Dylan DPC [Wed, 20 Jul 2022 05:59:39 +0000 (11:29 +0530)]
Rollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors

Erase regions before comparing signatures of foreign fns.

Fixes https://github.com/rust-lang/rust/issues/99276

The version with explicit lifetimes is probably tracked in another bug, but I could not find it.

2 years agoRollup merge of #98916 - ChrisDenton:hiberfil.sys, r=thomcc
Dylan DPC [Wed, 20 Jul 2022 05:59:38 +0000 (11:29 +0530)]
Rollup merge of #98916 - ChrisDenton:hiberfil.sys, r=thomcc

Windows: Use `FindFirstFileW` for getting the metadata of locked system files

Fixes #96980

Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory.

Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI.

r? rust-lang/libs

2 years agoRollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebank
Dylan DPC [Wed, 20 Jul 2022 05:59:37 +0000 (11:29 +0530)]
Rollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebank

Suggest returning local on "expected `ty`, found `()`" due to expr-less block

Putting this up for _initial_ review. Notably, this doesn't consider if the value has possibly been moved, or whether the type is `Copy`. It also provides a structured suggestion if there's one "preferred" binding that matches the type (i.e. one binding in the block or its parent), otherwise it just points them out if there's fewer than 4 of them.

Fixes #98177

r? `@estebank`

2 years agoFix generated `PartialEq::ne`
Michael Chisolm [Wed, 20 Jul 2022 04:26:50 +0000 (00:26 -0400)]
Fix generated `PartialEq::ne`