Commit graph

165523 commits

Author SHA1 Message Date
Eric Huss
307df1612f Update cargo 2022-03-30 21:28:18 -07:00
bors
a39ac5ae17 Auto merge of #95501 - Dylan-DPC:rollup-arx6sdc, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #93901 (Stabilize native library modifier syntax and the `whole-archive` modifier specifically)
 - #94806 (Fix `cargo run tidy`)
 - #94869 (Add the generic_associated_types_extended feature)
 - #95011 (async: Give predictable name to binding generated from .await expressions.)
 - #95251 (Reduce max hash in raw strings from u16 to u8)
 - #95298 (Fix double drop of allocator in IntoIter impl of Vec)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-31 00:29:54 +00:00
Dylan DPC
d6c959c680
Rollup merge of #95298 - jhorstmann:fix-double-drop-of-allocator-in-vec-into-iter, r=oli-obk
Fix double drop of allocator in IntoIter impl of Vec

Fixes #95269

The `drop` impl of `IntoIter` reconstructs a `RawVec` from `buf`, `cap` and `alloc`, when that `RawVec` is dropped it also drops the allocator. To avoid dropping the allocator twice we wrap it in `ManuallyDrop` in the `InttoIter` struct.

Note this is my first contribution to the standard library, so I might be missing some details or a better way to solve this.
2022-03-31 00:26:32 +02:00
Dylan DPC
86388f6171
Rollup merge of #95251 - GrishaVar:hashes-u16-to-u8, r=dtolnay
Reduce max hash in raw strings from u16 to u8

[Relevant discussion](https://rust-lang.zulipchat.com/#narrow/stream/237824-t-lang.2Fdoc/topic/Max.20raw.20string.20delimiters)
2022-03-31 00:26:31 +02:00
Dylan DPC
1c3657b20d
Rollup merge of #95011 - michaelwoerister:awaitee_field, r=tmandry
async: Give predictable name to binding generated from .await expressions.

This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns.

This will be useful for async stack traces, as discussed in https://internals.rust-lang.org/t/async-debugging-logical-stack-traces-setting-goals-collecting-examples/15547.

I don't know if this needs some discussion by ````@rust-lang/compiler,```` e.g. about the name of the binding (`__awaitee`) or about the fact that this PR introduces a (soft) guarantee about a compiler generated name. Although, regarding the later, I think the same reasoning applies here as it does for debuginfo in general.

r? ````@tmandry````
2022-03-31 00:26:30 +02:00
Dylan DPC
e08ab08a2e
Rollup merge of #94869 - jackh726:gats_extended, r=compiler-errors
Add the generic_associated_types_extended feature

Right now, this only ignore obligations that reference new placeholders in `poly_project_and_unify_type`. In the future, this might do other things, like allowing object-safe GATs.

**This feature is *incomplete* and quite likely unsound. This is mostly just for testing out potential future APIs using a "relaxed" set of rules until we figure out *proper* rules.**

Also drive by cleanup of adding a `ProjectAndUnifyResult` enum instead of using a `Result<Result<Option>>`.

r? `@nikomatsakis`
2022-03-31 00:26:29 +02:00
Dylan DPC
943ea7fae5
Rollup merge of #94806 - jyn514:cargo-run-tidy, r=Mark-Simulacrum
Fix `cargo run tidy`

When I implemented rust-only bootstrapping in https://github.com/rust-lang/rust/pull/92260,
I neglected to test stage0 tools - it turns out they were broken because
they couldn't find the sysroot of the initial bootstrap compiler.

This fixes stage0 tools by using `rustc --print sysroot` instead of assuming rustc is already in a
sysroot and hard-coding the relative directory.

Fixes https://github.com/rust-lang/rust/issues/94797 (properly, without having to change rustup).
2022-03-31 00:26:28 +02:00
Dylan DPC
b75f384d0b
Rollup merge of #93901 - petrochenkov:linkmod, r=wesleywiser
Stabilize native library modifier syntax and the `whole-archive` modifier specifically

Stabilization report: https://github.com/rust-lang/rust/pull/93901#issuecomment-1041325522

cc https://github.com/rust-lang/rust/issues/81490
2022-03-31 00:26:28 +02:00
bors
a40c595695 Auto merge of #95436 - cjgillot:static-mut, r=oli-obk
Remember mutability in `DefKind::Static`.

This allows to compute the `BodyOwnerKind` from `DefKind` only, and
removes a direct dependency of some MIR queries onto HIR.

As a side effect, it also simplifies metadata, since we don't need 4
flavours of `EntryKind::*Static` any more.
2022-03-30 22:09:56 +00:00
Jack Huey
4e570a68a1 Add the generic_associated_types_extended feature 2022-03-30 17:41:11 -04:00
Vadim Petrochenkov
1004783ef9 Stabilize native library modifier syntax and the whole-archive modifier specifically 2022-03-30 23:53:21 +03:00
bors
c5cf08d37b Auto merge of #95425 - nnethercote:yet-more-parse_tt-improvements, r=petrochenkov
Yet more `parse_tt` improvements

Including lots of comment improvements, and an overhaul of how `matches` work that gives big speedups.

r? `@petrochenkov`
2022-03-30 19:08:01 +00:00
Grisha Vartanyan
759d1e6af8 Update error message & remove outdated test comment 2022-03-30 18:20:30 +02:00
bors
bb5c437a2c Auto merge of #95458 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright
Sync rustfmt subtree

r? `@calebcartwright`
2022-03-30 15:57:58 +00:00
bors
3e7514670d Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se
allow arbitrary inherent impls for builtin types in core

Part of https://github.com/rust-lang/compiler-team/issues/487. Slightly adjusted after some talks with `@m-ou-se` about the requirements of `t-libs-api`.

This adds a crate attribute `#![rustc_coherence_is_core]` which allows arbitrary impls for builtin types in core.

For other library crates impls for builtin types should be avoided if possible. We do have to allow the existing stable impls however. To prevent us from accidentally adding more of these in the future, there is a second attribute `#[rustc_allow_incoherent_impl]` which has to be added to **all impl items**. This only supports impls for builtin types but can easily be extended to additional types in a future PR.

This implementation does not check for overlaps in these impls. Perfectly checking that requires us to check the coherence of these incoherent impls in every crate, as two distinct dependencies may add overlapping methods. It should be easy enough to detect if it goes wrong and the attribute is only intended for use inside of std.

The first two commits are mostly unrelated cleanups.
2022-03-30 12:28:50 +00:00
bors
e50ff9b452 Auto merge of #95241 - Gankra:cleaned-provenance, r=workingjubilee
Strict Provenance MVP

This patch series examines the question: how bad would it be if we adopted
an extremely strict pointer provenance model that completely banished all
int<->ptr casts.

The key insight to making this approach even *vaguely* pallatable is the

ptr.with_addr(addr) -> ptr

function, which takes a pointer and an address and creates a new pointer
with that address and the provenance of the input pointer. In this way
the "chain of custody" is completely and dynamically restored, making the
model suitable even for dynamic checkers like CHERI and Miri.

This is not a formal model, but lots of the docs discussing the model
have been updated to try to the *concept* of this design in the hopes
that it can be iterated on.

See #95228
2022-03-30 10:09:10 +00:00
lcnr
46340f2049 clippy: nameres for primitive type impls 2022-03-30 11:57:53 +02:00
lcnr
01d4e835c1 typo 2022-03-30 11:24:26 +02:00
lcnr
00cf7af44a rework error messages for incorrect inherent impls 2022-03-30 11:23:58 +02:00
lcnr
ee62514b16 fix rustdoc wrt builtin impls switch 2022-03-30 11:23:58 +02:00
lcnr
a6153e8218 get clippy to compile again 2022-03-30 11:23:58 +02:00
lcnr
260f17eafd fix rustdoc 2022-03-30 11:23:58 +02:00
lcnr
36a3ebde96 fix behavior for empty impls 2022-03-30 11:23:58 +02:00
lcnr
0d0d9cd718 update rustdoc 2022-03-30 11:23:58 +02:00
lcnr
afbecc0f68 remove now unnecessary lang items 2022-03-30 11:23:58 +02:00
lcnr
983c12f7f6 update ui tests 2022-03-30 11:23:58 +02:00
lcnr
bef6f3e895 rework implementation for inherent impls for builtin types 2022-03-30 11:23:58 +02:00
lcnr
4558a125b6 remove NoMatchData::new 2022-03-30 11:23:58 +02:00
lcnr
975162d1be update comment 2022-03-30 11:23:58 +02:00
Michael Woerister
78e27e2c7a async: Give predictable, reserved name to binding generated from .await expressions.
This name makes it to debuginfo and allows debuggers to identify such bindings and
their captured versions in suspended async fns.
2022-03-30 11:12:45 +02:00
bors
05142a7e44 Auto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95294 (Document Linux kernel handoff in std::io::copy and std::fs::copy)
 - #95443 (Clarify how `src/tools/x` searches for python)
 - #95452 (fix since field version for termination stabilization)
 - #95460 (Spellchecking compiler code)
 - #95461 (Spellchecking some comments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-30 07:45:42 +00:00
Dylan DPC
03b3993ae8
Rollup merge of #95461 - nyurik:spelling, r=lcnr
Spellchecking some comments

This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30 09:10:07 +02:00
Dylan DPC
a629b2ac68
Rollup merge of #95460 - nyurik:spelling-str, r=lcnr
Spellchecking compiler code

Address some spelling mistakes in strings, private function names, and function params.
2022-03-30 09:10:06 +02:00
Dylan DPC
abb02d40a4
Rollup merge of #95452 - yaahc:termination-version-correction, r=ehuss
fix since field version for termination stabilization

fixes incorrect version fields in stabilization of https://github.com/rust-lang/rust/pull/93840

r? `@ehuss`
2022-03-30 09:10:05 +02:00
Dylan DPC
33730c857f
Rollup merge of #95443 - jyn514:clarify-python-search-logic, r=Dylan-DPC
Clarify how `src/tools/x` searches for python

Before, it confusingly looked like `python` was chosen last instead of first.
2022-03-30 09:10:04 +02:00
Dylan DPC
e332f3b45e
Rollup merge of #95294 - sourcefrog:doc-copy, r=dtolnay
Document Linux kernel handoff in std::io::copy and std::fs::copy
2022-03-30 09:10:04 +02:00
Yuri Astrakhan
a9cc3f6564 Spellchecking compiler code
Address some spelling mistakes in strings, private function names, and function params.
2022-03-30 01:42:10 -04:00
Yuri Astrakhan
7e8201ae0a Spellchecking some comments
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30 01:39:38 -04:00
bors
f132bcf3bd Auto merge of #94081 - oli-obk:lazy_tait_take_two, r=nikomatsakis
Lazy type-alias-impl-trait take two

### user visible change 1: RPIT inference from recursive call sites

Lazy TAIT has an insta-stable change. The following snippet now compiles, because opaque types can now have their hidden type set from wherever the opaque type is mentioned.

```rust
fn bar(b: bool) -> impl std::fmt::Debug {
    if b {
        return 42
    }
    let x: u32 = bar(false); // this errors on stable
    99
}
```

The return type of `bar` stays opaque, you can't do `bar(false) + 42`, you need to actually mention the hidden type.

### user visible change 2: divergence between RPIT and TAIT in return statements

Note that `return` statements and the trailing return expression are special with RPIT (but not TAIT). So

```rust
#![feature(type_alias_impl_trait)]
type Foo = impl std::fmt::Debug;

fn foo(b: bool) -> Foo {
    if b {
        return vec![42];
    }
    std::iter::empty().collect() //~ ERROR `Foo` cannot be built from an iterator
}

fn bar(b: bool) -> impl std::fmt::Debug {
    if b {
        return vec![42]
    }
    std::iter::empty().collect() // Works, magic (accidentally stabilized, not intended)
}
```

But when we are working with the return value of a recursive call, the behavior of RPIT and TAIT is the same:

```rust
type Foo = impl std::fmt::Debug;

fn foo(b: bool) -> Foo {
    if b {
        return vec![];
    }
    let mut x = foo(false);
    x = std::iter::empty().collect(); //~ ERROR `Foo` cannot be built from an iterator
    vec![]
}

fn bar(b: bool) -> impl std::fmt::Debug {
    if b {
        return vec![];
    }
    let mut x = bar(false);
    x = std::iter::empty().collect(); //~ ERROR `impl Debug` cannot be built from an iterator
    vec![]
}
```

### user visible change 3: TAIT does not merge types across branches

In contrast to RPIT, TAIT does not merge types across branches, so the following does not compile.

```rust
type Foo = impl std::fmt::Debug;

fn foo(b: bool) -> Foo {
    if b {
        vec![42_i32]
    } else {
        std::iter::empty().collect()
        //~^ ERROR `Foo` cannot be built from an iterator over elements of type `_`
    }
}
```

It is easy to support, but we should make an explicit decision to include the additional complexity in the implementation (it's not much, see a721052457cf513487fb4266e3ade65c29b272d2 which needs to be reverted to enable this).

### PR formalities

previous attempt: #92007

This PR also includes #92306 and #93783, as they were reverted along with #92007 in #93893

fixes #93411
fixes #88236
fixes #89312
fixes #87340
fixes #86800
fixes #86719
fixes #84073
fixes #83919
fixes #82139
fixes #77987
fixes #74282
fixes #67830
fixes #62742
fixes #54895
2022-03-30 05:04:45 +00:00
Caleb Cartwright
419df99e18 Merge commit '5ff7b632a95bac6955611d85040859128902c580' into sync-rustfmt-subtree 2022-03-29 23:17:30 -05:00
David Tolnay
5ff7b632a9 Preserve semicolon after macro call inside foreign mod 2022-03-29 22:20:11 -05:00
David Tolnay
8e94761a94 Add test of macro calls inside extern block 2022-03-29 22:20:11 -05:00
Martin Pool
cfee2ed8cb Warn that platform-specific behavior may change 2022-03-29 19:49:15 -07:00
Aria Beingessner
e3a3afe050 fix unix typedef 2022-03-29 22:45:31 -04:00
bors
1446d17b8f Auto merge of #95455 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/95357
r? `@ghost`
2022-03-30 02:41:44 +00:00
Ralf Jung
9a0c28d1bd update miri 2022-03-29 22:13:33 -04:00
Aria Beingessner
37d4753776 fixup feature position in liballoc 2022-03-29 20:18:29 -04:00
Aria Beingessner
a91a9eefff clarify that WASM has address spaces 2022-03-29 20:18:28 -04:00
Aria Beingessner
075c576182 fix doc link 2022-03-29 20:18:28 -04:00
Aria Beingessner
378ed259d9 refine the definition of temporal provenance 2022-03-29 20:18:28 -04:00