Commit Graph

13868 Commits

Author SHA1 Message Date
Dylan DPC
640019ba6e
Rollup merge of #97812 - TaKO8Ki:suggest-to-swap-struct-and-trait, r=estebank
Suggest to swap a struct and a trait in trait impls

closes #89590
2022-06-11 07:42:14 +02:00
Dylan DPC
59c2ff532d
Rollup merge of #97703 - lcnr:post-89862, r=estebank
some additional `need_type_info.rs` cleanup

also fixes #97698, fixes #97806

cc `@estebank`
2022-06-11 07:42:13 +02:00
Dylan DPC
f1f44b9e4d
Rollup merge of #96868 - nrc:turbo-stable, r=jhpratt,nbdd0121,nagisa
Stabilize explicit_generic_args_with_impl_trait

This is a stabilisation PR for `explicit_generic_args_with_impl_trait`.

* [tracking issue](https://github.com/rust-lang/rust/issues/83701)
  - [Stabilisation report](https://github.com/rust-lang/rust/issues/83701#issuecomment-1109949897)
  - [FCP entered](https://github.com/rust-lang/rust/issues/83701#issuecomment-1120285703)
* [implementation PR](https://github.com/rust-lang/rust/pull/86176)
* [Reference PR](https://github.com/rust-lang/reference/pull/1212)
* There is no mention of using the turbofish operator in the book (other than an entry in the operator list in the appendix), so there is no documentation to change/add there, unless we felt like we should add a section on using turbofish, but that seems orthogonal to `explicit_generic_args_with_impl_trait`
2022-06-11 07:42:12 +02:00
bors
75307c22f3 Auto merge of #97648 - lcnr:bound-var-replacer, r=jackh726
cleanup bound variable handling

each commit should be pretty self-contained and hopefully straightforward to review.

I've added 677ec23a8dbf8ff5f1c03ccebd46f8b85e5ec1fc so that we can stop returning the region map from `replace_bound_vars_with_fresh_vars` in the following commit.

r? `@nikomatsakis` or `@jackh726`
2022-06-11 01:39:43 +00:00
Matthias Krüger
4ea862f953
Rollup merge of #97941 - CorinJG:error_naming_conventions, r=compiler-errors
nit: Fixed several error_codes/Exxxx.md messages which used UpperCamelCase…

… instead of snake_case for module names
2022-06-10 22:32:32 +02:00
Matthias Krüger
35ba4dc031
Rollup merge of #97928 - hoodmane:emscripten-no-assertions, r=tlively
Removes debug settings from wasm32_unknown_emscripten default link args

This is a debug setting. We should only make debug builds if user requests
a debug build. Currently this is inserted in release builds.

Furthermore, it would be better to insert these settings in --pre-link-args
because then it would be possible to override them if appropriate. Because
these are inserted at the end, it is necessary to patch emscripten to remove
them.

``@sbc100``
2022-06-10 22:32:30 +02:00
Matthias Krüger
07771137eb
Rollup merge of #93331 - pnkfelix:refactor-write-output-file, r=oli-obk
refactor write_output_file to merge two invocation paths into one.

this is a trivial refactor I did while I was investigating issue #91671.
2022-06-10 22:32:29 +02:00
CorinJG
6227d89d6a E0577 fixed Sea struct CamelCase/sea module snake_case 2022-06-10 14:21:40 +01:00
lcnr
efdf948f43 use FxHashMap instead of BTreeMap 2022-06-10 14:24:36 +02:00
CorinJG
20e166eab4 Fixed several error_codes/Exxxx.md messages which used UpperCamelCase instead of snake_case for module names 2022-06-10 11:25:47 +01:00
bors
f19ccc2e8d Auto merge of #97939 - JohnTitor:rollup-79pxupb, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #97718 (Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383))
 - #97876 (update docs for `std::future::IntoFuture`)
 - #97888 (Don't use __gxx_personality_v0 in panic_unwind on emscripten target)
 - #97922 (Remove redundant calls to reserve in impl Write for VecDeque)
 - #97927 (Do not introduce bindings for types and consts in HRTB.)
 - #97937 (Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-10 09:05:50 +00:00
Yuki Okushi
c2355a615d
Rollup merge of #97927 - cjgillot:issue-97836, r=petrochenkov
Do not introduce bindings for types and consts in HRTB.

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

r? `@petrochenkov`
2022-06-10 17:22:32 +09:00
Yuki Okushi
18404540d7
Rollup merge of #97718 - xFrednet:95540-delayed-good-path-ice-for-expect, r=wesleywiser
Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383)

Fixes a small ICE with the `delayed_good_path_bug` check.

---

r? ``@wesleywiser``

cc: ``@eddyb`` this might be interesting, since you've added a `FIXME` comment above the modified check which kind of discusses a case like this

closes: https://github.com/rust-lang/rust/issues/95540

cc: https://github.com/rust-lang/rust/issues/85549
2022-06-10 17:22:28 +09:00
lcnr
3d26f5a000 eagerly check whether we replace any bound vars 2022-06-10 10:09:50 +02:00
lcnr
e61807c6bf update higher_ranked_sub docs 2022-06-10 10:09:50 +02:00
lcnr
54fac386a4 don't always cache bound lts 2022-06-10 10:09:50 +02:00
lcnr
cc013e05b4 bound_vars -> infer: don't return lt map 2022-06-10 10:09:50 +02:00
lcnr
543ca7d9e7 replace bound vars: make caching explicit 2022-06-10 10:09:50 +02:00
lcnr
434c7da6ea only expect lb lt for fn calls in mir typeck 2022-06-10 10:09:50 +02:00
lcnr
8a0cb6ae7d BoundVarReplacer remove Option 2022-06-10 10:09:50 +02:00
bors
3dea0033f7 Auto merge of #95818 - petrochenkov:stabundle, r=wesleywiser
Stabilize the `bundle` native library modifier

And remove the legacy `static-nobundle` linking kind.

Stabilization report - https://github.com/rust-lang/rust/pull/95818#issuecomment-1120470945.

cc #81490
Closes #37403
2022-06-10 06:25:02 +00:00
Hood Chatham
b32238ae6f Clean up 2022-06-09 14:07:08 -07:00
Hood Chatham
9f305d3fa5 Remove ERROR_ON_UNDEFINED_SYMBOLS according to sbc100's comments 2022-06-09 13:37:38 -07:00
Hood Chatham
db14d81098 Remove -sASSERTIONS=1 from wasm32_unknown_emscripten default link args
This is a debug setting. We should only make debug builds if user requests
a debug build. Currently this is inserted in release builds.

Furthermore, it would be better to insert these settings in --pre-link-args
because then it would be possible to override them if appropriate. Because
these are inserted at the end, it is necessary to patch emscripten to remove
them.
2022-06-09 12:54:17 -07:00
Camille GILLOT
4d871a25bf Do not introduce bindings for types and consts in HRTB. 2022-06-09 21:49:14 +02:00
Vadim Petrochenkov
a8ee1f3a4f Stabilize the bundle native library modifier 2022-06-09 23:12:58 +04:00
bors
420c970cb1 Auto merge of #97911 - dtolnay:numcpu, r=Mark-Simulacrum
Revert "remove num_cpus dependency" in rustc and update cargo

Fixes #97549. This PR reverts #94524 and does a Cargo update to pull in rust-lang/cargo#10737.

Rust 1.61.0 has a regression in which it misidentifies the number of available CPUs in some environments, leading to enormously increased memory usage and failing builds. In between Rust 1.60 and 1.61 both rustc and cargo replaced some uses of `num_cpus` with `available_parallelism`, which eliminated support for cgroupv1, still apparently in common use. This PR switches both rustc and cargo back to using `num_cpus` in order to support environments where the available parallelism is controlled by cgroupv1. Both can use `available_parallism` again once it handles cgroupv1 (if ever).

I have confirmed that the rustc part of this PR fixes the memory usage regression in my non-Cargo environment, and others have confirmed in #97549 that the Cargo regression was at fault for the memory usage regression in their environments.
2022-06-09 18:20:08 +00:00
Felix S. Klock II
927de94316 refactor write_output_file to merge two invocation paths into one. 2022-06-09 13:10:25 -04:00
Yuki Okushi
141b0a4d5b
Rollup merge of #97874 - lcnr:combine-comment, r=davidtwco
rewrite combine doc comment

it was from 2014 and somewhat outdated
2022-06-09 19:19:57 +09:00
Yuki Okushi
5d81f91a3b
Rollup merge of #97843 - overdrivenpotato:psp-lto, r=michaelwoerister
Relax mipsel-sony-psp's linker script

Previously, the linker script forcefully kept all `.lib.stub` sections, unnecessarily bloating the binary. Now, the script is LTO and `--gc-sections` friendly.

`--nmagic` was also added to the linker, because page alignment is not required on the PSP. This further reduces binary size.

Accompanying changes for the `psp` crate are found in: https://github.com/overdrivenpotato/rust-psp/pull/118
2022-06-09 19:19:56 +09:00
Yuki Okushi
afa2edbe42
Rollup merge of #95860 - c410-f3r:stabilize-meta, r=joshtriplett
Stabilize `$$` in Rust 1.63.0

# Stabilization proposal

This PR proposes the stabilization of a subset of `#![feature(macro_metavar_expr)]` or more specifically, the stabilization of dollar-dollar (`$$`).

Tracking issue: #83527
Version: 1.63 (2022-06-28 => beta, 2022-08-11 => stable).

## What is stabilized

```rust
macro_rules! foo {
    () => {
        macro_rules! bar {
            ( $$( $$any:tt )* ) => { $$( $$any )* };
        }
    };
}

fn main() {
    foo!();
}
```

## Motivation

For more examples, see the [RFC](https://github.com/markbt/rfcs/blob/macro_metavar_expr/text/0000-macro-metavar-expr.md).

Users must currently resort to a tricky and not so well-known hack to declare nested macros with repetitions.

```rust
macro_rules! foo {
    ($dollar:tt) => {
        macro_rules! bar {
            ( $dollar ( $any:tt )* ) => { $dollar ( $any )* };
        }
    };
}
fn main() {
    foo!($);
}
```

As seen above, such hack is fragile and makes work with declarative macros much more unpleasant. Dollar-dollar (`$$`), on the other hand, makes nested macros more intuitive.

## What isn't stabilized

`count`, `ignore`, `index` and `length` are not being stabilized due to the lack of consensus.

## History

* 2021-02-22, [RFC: Declarative macro metavariable expressions](https://github.com/rust-lang/rfcs/pull/3086)
* 2021-03-26, [Tracking Issue for RFC 3086: macro metavariable expressions](https://github.com/rust-lang/rust/issues/83527)
* 2022-02-01, [Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/93545)
* 2022-02-25, [[1/2] Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/94368)
* 2022-03-11, [[2/2] Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/94833)
* 2022-03-12, [Fix remaining meta-variable expression TODOs](https://github.com/rust-lang/rust/pull/94884)
* 2019-03-21, [[macro-metavar-expr] Fix generated tokens hygiene](https://github.com/rust-lang/rust/pull/95188)
* 2022-04-07, [Kickstart the inner usage of macro_metavar_expr](https://github.com/rust-lang/rust/pull/95761)
* 2022-04-07, [[macro_metavar_expr] Add tests to ensure the feature requirement](https://github.com/rust-lang/rust/pull/95764)

## Non-stabilized expressions

https://github.com/rust-lang/rust/issues/83527 lists several concerns about some characteristics of `count`, `index` and `length` that effectively make their stabilization unfeasible. `$$` and `ignore`, however, are not part of any discussion and thus are suitable for stabilization.

It is not in the scope of this PR to detail each concern or suggest any possible converging solution. Such thing should be restrained in this tracking issue.

## Tests

This list is a subset of https://github.com/rust-lang/rust/tree/master/src/test/ui/macros/rfc-3086-metavar-expr

* [Ensures that nested macros have correct behavior](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs)

* [Compares produced tokens to assert expected outputs](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs)

* [Checks the declarations of the feature](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/required-feature.rs)

* [Verifies all possible errors that can occur due to incorrect user input](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs)

## Possible future work

Once consensus is achieved, other nightly expressions can be stabilized.

Thanks ``@markbt`` for creating the RFC and thanks to ``@petrochenkov`` and ``@mark-i-m`` for reviewing the implementations.
2022-06-09 19:19:55 +09:00
David Tolnay
1ae4b25826
Revert "Remove num_cpus dependency from bootstrap, build-manifest and rustc_session"
This reverts commit 2d854f9c34.
2022-06-09 03:10:15 -07:00
Takayuki Maeda
5639e52ae1 move suggestions to its own method 2022-06-09 17:52:10 +09:00
lcnr
36a4490271 rewrite combine doc comment 2022-06-09 10:45:41 +02:00
bors
6dc598a01b Auto merge of #97862 - SparrowLii:superset, r=lcnr
optimize `superset` method of `IntervalSet`

Given that intervals in the `IntervalSet` are sorted and strictly separated( it means the `end` of the previous interval will not be equal to the `start` of the next interval), we can reduce the complexity of the `superset` method from O(NMlogN) to O(2N) (N is the number of intervals and M is the length of each interval)
2022-06-09 07:13:46 +00:00
bors
282445a288 Auto merge of #97740 - RalfJung:ctfe-cycle-spans, r=lcnr
use precise spans for recursive const evaluation

This fixes https://github.com/rust-lang/rust/issues/73283 by using a `TyCtxtAt` with a more precise span when the interpreter recursively calls itself. Hopefully such calls are sufficiently rare that this does not cost us too much performance.

(In theory, cycles can also arise through layout computation, as layout can depend on consts -- but layout computation happens all the time so we'd have to do something to not make this terrible for performance.)
2022-06-09 01:52:15 +00:00
Michael Goulet
f12a1c23bc
Rollup merge of #97857 - ChayimFriedman2:box-identifier-help, r=compiler-errors
Suggest escaping `box` as identifier

Fixes #97810.
2022-06-08 13:32:21 -07:00
Michael Goulet
e0409200d9
Rollup merge of #97856 - compiler-errors:bad-let-suggestions, r=estebank
Don't suggest adding `let` in certain `if` conditions

Avoid being too eager to suggest `let` in an `if` condition with an `=`, namely when the LHS of the `=` isn't even valid as a pattern (to a first degree approximation).

This heustic I came up with kinda sucks. Let me know if it needs to be refined.
2022-06-08 13:32:20 -07:00
Michael Goulet
1922f0b980
Rollup merge of #97557 - compiler-errors:arg-mismatch-mini, r=jackh726
Fix indices and remove some unwraps in arg mismatch algorithm

This is a more conservative fix than #97542, addressing some indices which were used incorectly and unwraps which are bound to panic (e.g. when the provided and expected arg counts differ). Beta nominating this as it's quite easy to cause ICEs -- I wrote a fuzzer and found hundreds of examples of ICEs.

cc `@jackh726` as author of #92364, and `@estebank` as reviewer of that PR.
fixes #97484
r? `@jackh726` this should be _much_ easier to review than the other PR 😅
2022-06-08 13:32:18 -07:00
Matthias Krüger
c374529cb5
Rollup merge of #97880 - ChayimFriedman2:patch-2, r=lcnr
Fix typo: fo->for
2022-06-08 18:15:06 +02:00
Matthias Krüger
8a2aedc6e3
Rollup merge of #97813 - antoyo:sync_from_cg_gcc, r=petrochenkov
Sync rustc_codegen_gcc
2022-06-08 18:15:02 +02:00
lcnr
d6b28f377c add test + don't warn on Res::SelfTy 2022-06-08 18:00:08 +02:00
SparrowLii
726b35bd70 correct the test if IntervalSet 2022-06-08 22:44:26 +08:00
SparrowLii
65a5b082bc fix the impl error in insert_all 2022-06-08 22:09:26 +08:00
Chayim Refael Friedman
f4ba14d290
Fix typo: fo->for 2022-06-08 16:40:02 +03:00
SparrowLii
7e1901537c add check_invariants method 2022-06-08 21:39:04 +08:00
bors
09d52bc5d4 Auto merge of #97873 - Dylan-DPC:rollup-g6ptsdq, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #97276 (Stabilize `const_intrinsic_copy`)
 - #97763 (Allow ptr_from_addr_cast to fail)
 - #97846 (Specify DWARF alignment in bits, not bytes.)
 - #97848 (Impl Traits lowering minor refactors)
 - #97865 (remove `BorrowckMode`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-08 13:20:45 +00:00
Dylan DPC
5d1a3669ee
Rollup merge of #97865 - lcnr:bb-BorrowckMode, r=Dylan-DPC
remove `BorrowckMode`

dead code after #95565
2022-06-08 13:43:21 +02:00
Dylan DPC
770583cc6d
Rollup merge of #97848 - spastorino:universal-lowering-refactor-1, r=cjgillot
Impl Traits lowering minor refactors

This are unrelated changes on my RPIT refactor that may be better to merge before opening the main PR.

r? `@cjgillot`

cc `@nikomatsakis`
2022-06-08 13:43:20 +02:00
Dylan DPC
82a1d79dff
Rollup merge of #97846 - pcwalton:align-bits, r=michaelwoerister
Specify DWARF alignment in bits, not bytes.

In DWARF, alignment of types is specified in bits, as is made clear by the
parameter name `AlignInBits`. However, `rustc` was incorrectly passing a byte
alignment. This commit fixes that.

This was noticed in upstream LLVM when I tried to check in a test consisting of
LLVM IR generated from `rustc` and it triggered assertions [1].

[1]: https://reviews.llvm.org/D126835
2022-06-08 13:43:19 +02:00