Commit Graph

164373 Commits

Author SHA1 Message Date
Dylan DPC
bb8274ad36
Rollup merge of #94819 - jonhoo:configure-empty-list, r=Mark-Simulacrum
configure: don't serialize empty array elements

Before this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = ['']

After this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = []
2022-03-11 03:32:05 +01:00
Dylan DPC
6d66020594
Rollup merge of #94765 - m-ou-se:is-some-and, r=Dylan-DPC
Rename is_{some,ok,err}_with to is_{some,ok,err}_and.

This renames `is_{some,ok,err}_with` to `is_{some,ok,err}_and`. This was discussed on the [tracking issue](https://github.com/rust-lang/rust/issues/93050).
2022-03-11 03:32:04 +01:00
Dylan DPC
ab851653a5
Rollup merge of #94356 - Thomasdezeeuw:stabilize_unix_socket_creation, r=dtolnay
Rename unix::net::SocketAddr::from_path to from_pathname and stabilize it

Stabilizes `unix_socket_creation`.

Closes https://github.com/rust-lang/rust/issues/93423
r? `@m-ou-se`
2022-03-11 03:32:03 +01:00
Dylan DPC
d58c69ae96
Rollup merge of #93293 - nvzqz:nonzero-min-max, r=joshtriplett
Implement `MIN`/`MAX` constants for non-zero integers

This adds the associated [`MIN`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MIN)/[`MAX`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MAX) constants to `NonZero{U,I}{8,16,32,64,128,size}`, requested in #89065.

This reimplements #89077 due that PR being stagnant for 4 months. I am fine with closing this in favor of that one if the author revisits it. If so, I'd like to see that PR have the docs link to the `$Int`'s constants.
2022-03-11 03:32:02 +01:00
Nicholas Nethercote
ca5525d564 Improve AdtDef interning.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
2022-03-11 13:31:24 +11:00
bors
c5a43b8d39 Auto merge of #94276 - scottmcm:primitive-clone, r=oli-obk
mir-opt: Replace clone on primitives with copy

We can't do it for everything, but it would be nice to at least stop making calls to clone methods in debug from things like derived-clones.

r? `@ghost`
2022-03-11 01:51:49 +00:00
Ralf Jung
63ed8e41ce adjust offset_from logic: check that both pointers are in-bounds 2022-03-10 18:59:58 -05:00
Maik Allgöwer
229e01d11f Improve doc wording for retain on some collections 2022-03-11 00:29:43 +01:00
bors
352e621368 Auto merge of #94824 - Dylan-DPC:rollup-iamc09j, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #93950 (Use modern formatting for format! macros)
 - #94274 (Treat unstable lints as unknown)
 - #94368 ([1/2] Implement macro meta-variable expressions)
 - #94719 (Statically compile libstdc++ everywhere if asked)
 - #94728 (Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST)
 - #94790 (enable portable-simd doctests in Miri)
 - #94811 (Update browser-ui-test version)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-10 23:10:59 +00:00
Nikolai Vazquez
ecb7927050 Move note about 0 gap to signed integers
Was accidentally placed on unsigned integers, where it is not relevant.
2022-03-10 17:52:48 -05:00
Dylan DPC
456135c9c2
Rollup merge of #94811 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version

It should help with #93784 (the important PR helping in this regard is https://github.com/GuillaumeGomez/browser-UI-test/pull/273).

r? `@notriddle`
2022-03-10 23:13:02 +01:00
Dylan DPC
3979e150cc
Rollup merge of #94790 - RalfJung:portable-simd-miri, r=Dylan-DPC
enable portable-simd doctests in Miri

With https://github.com/rust-lang/miri/pull/2013 we shouldn't need to disable these tests any more. :)
2022-03-10 23:13:01 +01:00
Dylan DPC
b18b2d1bcd
Rollup merge of #94728 - compiler-errors:box-allocator-zst-meta, r=michaelwoerister
Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST

Basically copy the change in #94043, but for debuginfo.

r? ``@michaelwoerister``

Fixes #94725
2022-03-10 23:13:00 +01:00
Dylan DPC
1cf879355b
Rollup merge of #94719 - jonhoo:enable-static-lld, r=Mark-Simulacrum
Statically compile libstdc++ everywhere if asked

PR #93918 made it so that `-static-libstdc++` was only set in one place,
and was only set during linking, but accidentally also made it so that
it is no longer passed when building LLD, only when building LLVM
itself. This moves the logic for setting `-static-libstdc++` in the
linker flags to `configure_cmake` so that it takes effect for all CMake
invocations in `native.rs`.

As a side-effect, this also causes libstdc++ to be statically compiled
into sanitizers, whereas previously the `llvm-static-stdcpp` flag had no
effect on sanitizers. It also makes it so that LLD will be compiled
statically if `llvm-tools-enabled` is set, even though previously it was
only linked statically if `llvm-static-stdcpp` was set explicitly. Both
of these seem like they match expected behavior than what was there
prior to #93918.
2022-03-10 23:12:59 +01:00
Dylan DPC
634a6b0d25
Rollup merge of #94368 - c410-f3r:metaaaaaaaaaaaaaaaaaaaaaaaaaaa, r=petrochenkov
[1/2] Implement macro meta-variable expressions

See https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295

The logic behind `length`, `index` and `count` was removed but the parsing code is still present, i.e., everything is simply ignored like `ignored`.

r? ``@petrochenkov``
2022-03-10 23:12:58 +01:00
Dylan DPC
1ed2a94fd2
Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandry
Treat unstable lints as unknown

This change causes unstable lints to be ignored if the `unknown_lints`
lint is allowed. To achieve this, it also changes lints to apply as soon
as they are processed. Previously, lints in the same set were processed
as a batch and then all simultaneously applied.

Implementation of https://github.com/rust-lang/compiler-team/issues/469
2022-03-10 23:12:57 +01:00
Dylan DPC
5a7f09d9a3
Rollup merge of #93950 - T-O-R-U-S:use-modern-formatting-for-format!-macros, r=Mark-Simulacrum
Use modern formatting for format! macros

This updates the standard library's documentation to use the new format_args syntax.
The documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.

A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).

`eprintln!("{}", e)` becomes `eprintln!("{e}")`, but `eprintln!("{}", e.kind())` remains untouched.
2022-03-10 23:12:57 +01:00
Jon Gjengset
7c20a29af8 configure: don't serialize empty array elements
Before this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = ['']

After this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = []
2022-03-10 12:39:34 -08:00
Yoshua Wuyts
3f2cb6eba1 Rename IntoFuture::Future to IntoFuture::IntoFuture 2022-03-10 20:51:52 +01:00
bors
5f4e067719 Auto merge of #94814 - matthiaskrgr:rollup-a5sk366, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #94440 (Better error for normalization errors from parent crates that use `#![feature(generic_const_exprs)]`)
 - #94587 (Document new recommended use of `FromIterator::from_iter`)
 - #94644 (Fix soundness issue in scoped threads.)
 - #94740 (Unify impl blocks by wrapping them into a div)
 - #94753 (Improve rustdoc book)
 - #94796 (Allow `cargo run` instead of `cargo run -p bootstrap`)
 - #94805 (Revert accidental stabilization)
 - #94809 (RustWrapper: add missing include)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-10 18:28:45 +00:00
Matthias Krüger
07e4fbde5a
Rollup merge of #94809 - durin42:llvm-15-modulepass, r=nikic
RustWrapper: add missing include

This is required after LLVM change 3c4410dfcaaf (aka
https://reviews.llvm.org/D121168) did some includes cleanup.

r? nikic
2022-03-10 19:00:12 +01:00
Matthias Krüger
af35dc2a95
Rollup merge of #94805 - oli-obk:drop_box, r=pnkfelix
Revert accidental stabilization

fixes #94804
2022-03-10 19:00:11 +01:00
Matthias Krüger
fa685a5499
Rollup merge of #94796 - jyn514:cargo-run-bootstrap, r=Mark-Simulacrum
Allow `cargo run` instead of `cargo run -p bootstrap`

This was part of `@Mark-Simulacrum` 's original PR in ecb424f129,
but I missed it when writing #92260.

This also has the side effect of allowing `cargo build --bins` instead of `cargo build -p bootstrap --bins`. I'm not sure when you would want to run cargo build/check/test without going through bootstrap, but this still allows you to do so as long as you pass `-p` for all the crates you want to build.
2022-03-10 19:00:10 +01:00
Matthias Krüger
ec99104414
Rollup merge of #94753 - Urgau:rustdoc-book-improvements, r=GuillaumeGomez
Improve rustdoc book

This pull-request improves the `rustdoc` book by doing some (light) cleanup, by merging some stuff, by adding some missing stuff (like tracking issues links, for those who had one) and also by moving some chapter's into sub-chapter's to improve the flow of the book.

~~Note that I locally tested with `mdbook-lintcheck` that no links became accidentally broken.~~ (Not enough, ;-))

r? `````@GuillaumeGomez`````
2022-03-10 19:00:09 +01:00
Matthias Krüger
82215ce646
Rollup merge of #94740 - GuillaumeGomez:unify-impl-blocks, r=notriddle
Unify impl blocks by wrapping them into a div

The blanket and "auto traits" sections are wrapped into a `div` with an ID. This PR fixes this incoherence by wrapping each impl section (the "deref impl" and the "inherent impl" sections were missing it). It'll also make some tests simpler to write.

r? `````@notriddle`````
2022-03-10 19:00:08 +01:00
Matthias Krüger
f1a677789a
Rollup merge of #94644 - m-ou-se:scoped-threads-drop-soundness, r=joshtriplett
Fix soundness issue in scoped threads.

This was discovered in https://github.com/rust-lang/rust/pull/94559#discussion_r820116323

The `scope()` function returns when all threads are finished, but I accidentally considered a thread 'finished' before dropping their panic payload or ignored return value.

So if a thread returned (or panics with) something that in its `Drop` implementation still uses borrowed stuff, it goes wrong.

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=2a1f19ac4676cdabe43e24e536ff9358
2022-03-10 19:00:07 +01:00
Matthias Krüger
b5127202b2
Rollup merge of #94587 - JKAnderson409:issue-90107-fix, r=scottmcm
Document new recommended use of `FromIterator::from_iter`

#90107
Most of the added prose was paraphrased from the links provided in the issue. The suggested `VecDeque` example seemed to make the point well enough so I just used that.
2022-03-10 19:00:06 +01:00
Matthias Krüger
b41374598f
Rollup merge of #94440 - compiler-errors:issue-94282, r=lcnr
Better error for normalization errors from parent crates that use `#![feature(generic_const_exprs)]`

This PR implements a somewhat rudimentary heuristic to suggest using `#![feature(generic_const_exprs)]` in a child crate when a function from a foreign crate (that may have used `#![feature(generic_const_exprs)]`) fails to normalize during codegen.

cc: #79018
cc: #94287
2022-03-10 19:00:05 +01:00
Guillaume Gomez
5d830f4804 Update browser-ui-test version 2022-03-10 17:49:50 +01:00
Augie Fackler
185e3b95ca RustWrapper: add missing include
This is required after LLVM change 3c4410dfcaaf (aka
https://reviews.llvm.org/D121168) did some includes cleanup.
2022-03-10 11:16:33 -05:00
T-O-R-U-S
72a25d05bf Use implicit capture syntax in format_args
This updates the standard library's documentation to use the new syntax. The
documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.

A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).
2022-03-10 10:23:40 -05:00
Oli Scherer
5f7ca55df6 Revert accidental stabilization 2022-03-10 14:36:51 +00:00
Martin Gammelsæter
c62ab422d0 Inline <EscapeDefault as Iterator>::next 2022-03-10 15:35:22 +01:00
bors
ba14a836c7 Auto merge of #94802 - matthiaskrgr:rollup-4plu0fi, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #92150 (Improve suggestion when casting usize to (possibly) wide pointer)
 - #94635 (Merge `#[deprecated]` and `#[rustc_deprecated]`)
 - #94657 (Constify `Index{,Mut}` for `[T]`, `str`, and `[T; N]`)
 - #94746 (diagnostics: use rustc_on_unimplemented to recommend `[].iter()`)
 - #94788 (Account for suggestions for complete removal of lines)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-10 12:32:01 +00:00
Matthias Krüger
6bbaca7d03
Rollup merge of #94788 - estebank:removal-suggestion, r=petrochenkov
Account for suggestions for complete removal of lines

Fix  #94192.
2022-03-10 12:20:54 +01:00
Matthias Krüger
e7281d08de
Rollup merge of #94746 - notriddle:notriddle/method-rustc-on-unimplemented, r=davidtwco
diagnostics: use rustc_on_unimplemented to recommend `[].iter()`

To make this work, the `#[rustc_on_unimplemented]` data needs to be used to
report method resolution errors, which is most of what this commit does.

Fixes #94581
2022-03-10 12:20:53 +01:00
Matthias Krüger
fe034cb43b
Rollup merge of #94657 - fee1-dead:const_slice_index, r=oli-obk
Constify `Index{,Mut}` for `[T]`, `str`, and `[T; N]`

Several panic functions were rewired (via `const_eval_select`) to simpler implementations that do not require formatting for compile-time usage.

r? ```@oli-obk```
2022-03-10 12:20:52 +01:00
Matthias Krüger
313a668234
Rollup merge of #94635 - jhpratt:merge-deprecated-attrs, r=davidtwco
Merge `#[deprecated]` and `#[rustc_deprecated]`

The first commit makes "reason" an alias for "note" in `#[rustc_deprecated]`, while still prohibiting it in `#[deprecated]`.

The second commit changes "suggestion" to not just be a feature of `#[rustc_deprecated]`. This is placed behind the new `deprecated_suggestion` feature. This needs a tracking issue; let me know if this PR will be approved and I can create one.

The third commit is what permits `#[deprecated]` to be used when `#![feature(staged_api)]` is enabled. This isn't yet used in stdlib (only tests), as it would require duplicating all deprecation attributes until a bootstrap occurs. I intend to submit a follow-up PR that replaces all uses and removes the remaining `#[rustc_deprecated]` code after the next bootstrap.

`@rustbot` label +T-libs-api +C-feature-request +A-attributes +S-waiting-on-review
2022-03-10 12:20:51 +01:00
Matthias Krüger
7473750b13
Rollup merge of #92150 - compiler-errors:better_usize_to_wide_ptr_cast, r=petrochenkov
Improve suggestion when casting usize to (possibly) wide pointer

I thought #92125 was a wonderful idea, so I went ahead and took a stab at it. Not sure if my approach is the best going forward, but I'm happy with the improvement in the error message.

Iwill definitely address any changes if people are more opinionated with the wordings or want more features.

Also, do I need to add a new error code?

(Fixes #92125)
2022-03-10 12:20:50 +01:00
Scott McMurray
705b8807d5 The Clone::clone call is now a ConstantKind::Val, not a ConstantKind::Ty 2022-03-10 01:50:47 -08:00
Scott McMurray
697464a487 Disable the test on wasm32
Since the expected output has unwind targets
2022-03-10 01:19:02 -08:00
Scott McMurray
54408f0963 short-circuit the easy cases in is_copy_modulo_regions
This change is somewhat extensive, since it affects MIR -- since this is called to determine Copy vs Move -- so any test that's `no_core` needs to actually have the normal `impl`s it uses.
2022-03-10 01:19:02 -08:00
Scott McMurray
b5a54d8777 Move is_trivially_pure_clone_copy onto Ty instead 2022-03-10 01:19:02 -08:00
Scott McMurray
0d4a3f11e2 mir-opt: Replace clone on primitives with copy
We can't do it for everything, but it would be nice to at least stop making calls to clone methods in debug from things like derived-clones.
2022-03-10 01:19:02 -08:00
bors
282778aee2 Auto merge of #94764 - nikic:update-llvm-3, r=nagisa
Update LLVM submodule

This merges upstream changes from the 14.x release branch.

Fixes #89609.
Fixes #93923.
Fixes #94032.
2022-03-10 08:56:02 +00:00
JmPotato
2f18fa801b Use MaybeUninit in VecDeque to remove the undefined behavior of slice
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2022-03-10 14:14:25 +08:00
bors
d7b282b886 Auto merge of #94059 - b-naber:constantkind-val-transformation, r=lcnr
Treat constant values as mir::ConstantKind::Val

Another step that is necessary for the introduction of Valtrees: we don't want to treat `ty::Const` instances of kind `ty::ConstKind::Value` as `mir::ConstantKind::Ty` anymore.

r? `@oli-obk`
2022-03-10 05:53:59 +00:00
Joshua Nelson
687e53ebfe Allow cargo run instead of cargo run -p bootstrap
This was part of Mark's original PR in ecb424f129,
but I missed it when writing #92260.
2022-03-09 22:37:44 -06:00
Joshua Nelson
4d56f09650 Fallback to top-level config.toml if not present in current directory
This also preserves the behavior where x.py will only give a hard error on a missing config file
if it was configured through `--config` or RUST_BOOTSTRAP_CONFIG.
It also removes the top-level fallback for everything except the default path.
2022-03-09 22:35:43 -06:00
bors
01ad0ad653 Auto merge of #94787 - matthiaskrgr:rollup-yyou15f, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #91804 (Make some `Clone` impls `const`)
 - #92541 (Mention intent of `From` trait in its docs)
 - #93057 (Add Iterator::collect_into)
 - #94739 (Suggest `if let`/`let_else` for refutable pat in `let`)
 - #94754 (Warn users about `||` in let chain expressions)
 - #94763 (Add documentation about lifetimes to thread::scope.)
 - #94768 (Ignore `close_read_wakes_up` test on SGX platform)
 - #94772 (Add miri to the well known conditional compilation names and values)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-10 02:38:43 +00:00