]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoStop emitting lints during lowering.
Camille GILLOT [Sat, 31 Jul 2021 20:50:43 +0000 (22:50 +0200)]
Stop emitting lints during lowering.

2 years agoStore next_disambiguator in Definitions.
Camille GILLOT [Fri, 2 Apr 2021 14:47:08 +0000 (16:47 +0200)]
Store next_disambiguator in Definitions.

2 years agoRemove mutability in ResolverAstLowering.
Camille GILLOT [Thu, 1 Apr 2021 17:05:14 +0000 (19:05 +0200)]
Remove mutability in ResolverAstLowering.

2 years agoAuto merge of #95506 - Dylan-DPC:rollup-b6kxzjc, r=Dylan-DPC
bors [Thu, 31 Mar 2022 05:12:45 +0000 (05:12 +0000)]
Auto merge of #95506 - Dylan-DPC:rollup-b6kxzjc, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95130 (Stabilize thread::is_finished)
 - #95263 (Restore `impl Future<Output = Type>` to async blocks)
 - #95471 (Don't ICE when opaque types get their hidden type constrained again.)
 - #95491 (Stabilize feature vec_retain_mut on Vec and VecDeque)
 - #95497 (Spellchecking compiler comments)

Failed merges:

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

2 years agoRollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errors
Dylan DPC [Thu, 31 Mar 2022 02:57:28 +0000 (04:57 +0200)]
Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errors

Spellchecking compiler comments

This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.

2 years agoRollup merge of #95491 - faern:stabilize-vec_retain_mut, r=yaahc
Dylan DPC [Thu, 31 Mar 2022 02:57:27 +0000 (04:57 +0200)]
Rollup merge of #95491 - faern:stabilize-vec_retain_mut, r=yaahc

Stabilize feature vec_retain_mut on Vec and VecDeque

Closes #90829

2 years agoRollup merge of #95471 - oli-obk:tait_ice, r=estebank
Dylan DPC [Thu, 31 Mar 2022 02:57:26 +0000 (04:57 +0200)]
Rollup merge of #95471 - oli-obk:tait_ice, r=estebank

Don't ICE when opaque types get their hidden type constrained again.

Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them.

Fixes #89312 (for real this time)

2 years agoRollup merge of #95263 - compiler-errors:async-block-pretty, r=jackh726
Dylan DPC [Thu, 31 Mar 2022 02:57:25 +0000 (04:57 +0200)]
Rollup merge of #95263 - compiler-errors:async-block-pretty, r=jackh726

Restore `impl Future<Output = Type>` to async blocks

I was sad when I undid some of the code I wrote in #91096 in the PR #95225, so I fixed it here to not print `[async output]`.

This PR "manually" normalizes the associated type `<[generator] as Generator>::Return` type which appears very frequently in `impl Future` types that result from async block desugaring.

2 years agoRollup merge of #95130 - workingjubilee:stably-finished, r=m-ou-se
Dylan DPC [Thu, 31 Mar 2022 02:57:25 +0000 (04:57 +0200)]
Rollup merge of #95130 - workingjubilee:stably-finished, r=m-ou-se

Stabilize thread::is_finished

Closes #90470.

r? `@m-ou-se`

2 years agoRestore `impl Future<Output = Type>` to async blocks
Michael Goulet [Thu, 31 Mar 2022 02:26:35 +0000 (19:26 -0700)]
Restore `impl Future<Output = Type>` to async blocks

2 years agoAuto merge of #95501 - Dylan-DPC:rollup-arx6sdc, r=Dylan-DPC
bors [Thu, 31 Mar 2022 00:29:54 +0000 (00:29 +0000)]
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

2 years agoRollup merge of #95298 - jhorstmann:fix-double-drop-of-allocator-in-vec-into-iter...
Dylan DPC [Wed, 30 Mar 2022 22:26:32 +0000 (00:26 +0200)]
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.

2 years agoRollup merge of #95251 - GrishaVar:hashes-u16-to-u8, r=dtolnay
Dylan DPC [Wed, 30 Mar 2022 22:26:31 +0000 (00:26 +0200)]
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)

2 years agoRollup merge of #95011 - michaelwoerister:awaitee_field, r=tmandry
Dylan DPC [Wed, 30 Mar 2022 22:26:30 +0000 (00:26 +0200)]
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````

2 years agoRollup merge of #94869 - jackh726:gats_extended, r=compiler-errors
Dylan DPC [Wed, 30 Mar 2022 22:26:29 +0000 (00:26 +0200)]
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`

2 years agoRollup merge of #94806 - jyn514:cargo-run-tidy, r=Mark-Simulacrum
Dylan DPC [Wed, 30 Mar 2022 22:26:28 +0000 (00:26 +0200)]
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).

2 years agoRollup merge of #93901 - petrochenkov:linkmod, r=wesleywiser
Dylan DPC [Wed, 30 Mar 2022 22:26:28 +0000 (00:26 +0200)]
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

2 years agoAuto merge of #95436 - cjgillot:static-mut, r=oli-obk
bors [Wed, 30 Mar 2022 22:09:56 +0000 (22:09 +0000)]
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.

2 years agoAdd the generic_associated_types_extended feature
Jack Huey [Fri, 11 Mar 2022 23:46:49 +0000 (18:46 -0500)]
Add the generic_associated_types_extended feature

2 years agoa few mode feedback fixes per @bjorn3
Yuri Astrakhan [Wed, 30 Mar 2022 21:28:19 +0000 (17:28 -0400)]
a few mode feedback fixes per @bjorn3

2 years agoAddressed comments by @compiler-errors and @bjorn3
Yuri Astrakhan [Wed, 30 Mar 2022 21:04:46 +0000 (17:04 -0400)]
Addressed comments by @compiler-errors and @bjorn3

2 years agoStabilize native library modifier syntax and the `whole-archive` modifier specifically
Vadim Petrochenkov [Fri, 11 Feb 2022 07:08:35 +0000 (15:08 +0800)]
Stabilize native library modifier syntax and the `whole-archive` modifier specifically

2 years agoRemove bad rustdoc trailing backslash
Yuri Astrakhan [Wed, 30 Mar 2022 19:50:27 +0000 (15:50 -0400)]
Remove bad rustdoc trailing backslash

2 years agoSpellchecking compiler comments
Yuri Astrakhan [Wed, 30 Mar 2022 19:14:15 +0000 (15:14 -0400)]
Spellchecking compiler comments

This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.

2 years agoAuto merge of #95425 - nnethercote:yet-more-parse_tt-improvements, r=petrochenkov
bors [Wed, 30 Mar 2022 19:08:01 +0000 (19:08 +0000)]
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`

2 years agoStabilize feature vec_retain_mut on Vec and VecDeque
Linus Färnstrand [Wed, 30 Mar 2022 05:48:48 +0000 (07:48 +0200)]
Stabilize feature vec_retain_mut on Vec and VecDeque

2 years agoUpdate error message & remove outdated test comment
Grisha Vartanyan [Wed, 30 Mar 2022 16:20:30 +0000 (18:20 +0200)]
Update error message & remove outdated test comment

2 years agoAuto merge of #95458 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright
bors [Wed, 30 Mar 2022 15:57:58 +0000 (15:57 +0000)]
Auto merge of #95458 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright

Sync rustfmt subtree

r? `@calebcartwright`

2 years agoDon't ICE when opaque types get their hidden type constrained again.
Oli Scherer [Wed, 30 Mar 2022 13:17:46 +0000 (13:17 +0000)]
Don't ICE when opaque types get their hidden type constrained again.

Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them.

2 years agoAuto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se
bors [Wed, 30 Mar 2022 12:28:50 +0000 (12:28 +0000)]
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.

2 years agoDon't stabilize ScopedJoinHandle::is_finished yet.
Mara Bos [Wed, 30 Mar 2022 11:59:27 +0000 (13:59 +0200)]
Don't stabilize ScopedJoinHandle::is_finished yet.

2 years agoAuto merge of #95241 - Gankra:cleaned-provenance, r=workingjubilee
bors [Wed, 30 Mar 2022 10:09:10 +0000 (10:09 +0000)]
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

2 years agoclippy: nameres for primitive type impls
lcnr [Wed, 30 Mar 2022 09:57:53 +0000 (11:57 +0200)]
clippy: nameres for primitive type impls

2 years agotypo
lcnr [Wed, 30 Mar 2022 09:24:26 +0000 (11:24 +0200)]
typo

2 years agorework error messages for incorrect inherent impls
lcnr [Tue, 29 Mar 2022 07:47:32 +0000 (09:47 +0200)]
rework error messages for incorrect inherent impls

2 years agofix rustdoc wrt builtin impls switch
lcnr [Fri, 18 Mar 2022 16:02:32 +0000 (17:02 +0100)]
fix rustdoc wrt builtin impls switch

2 years agoget clippy to compile again
lcnr [Fri, 18 Mar 2022 12:33:40 +0000 (13:33 +0100)]
get clippy to compile again

2 years agofix rustdoc
lcnr [Fri, 18 Mar 2022 10:45:00 +0000 (11:45 +0100)]
fix rustdoc

2 years agofix behavior for empty impls
lcnr [Fri, 18 Mar 2022 10:44:55 +0000 (11:44 +0100)]
fix behavior for empty impls

2 years agoupdate rustdoc
lcnr [Tue, 15 Mar 2022 15:56:46 +0000 (16:56 +0100)]
update rustdoc

2 years agoremove now unnecessary lang items
lcnr [Tue, 15 Mar 2022 15:56:28 +0000 (16:56 +0100)]
remove now unnecessary lang items

2 years agoupdate ui tests
lcnr [Tue, 15 Mar 2022 15:32:52 +0000 (16:32 +0100)]
update ui tests

2 years agorework implementation for inherent impls for builtin types
lcnr [Tue, 15 Mar 2022 15:30:30 +0000 (16:30 +0100)]
rework implementation for inherent impls for builtin types

2 years agoremove `NoMatchData::new`
lcnr [Fri, 11 Mar 2022 11:20:27 +0000 (12:20 +0100)]
remove `NoMatchData::new`

2 years agoupdate comment
lcnr [Fri, 11 Mar 2022 10:59:40 +0000 (11:59 +0100)]
update comment

2 years agoasync: Give predictable, reserved name to binding generated from .await expressions.
Michael Woerister [Wed, 16 Mar 2022 14:52:21 +0000 (15:52 +0100)]
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.

2 years agoAuto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPC
bors [Wed, 30 Mar 2022 07:45:42 +0000 (07:45 +0000)]
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

2 years agoRollup merge of #95461 - nyurik:spelling, r=lcnr
Dylan DPC [Wed, 30 Mar 2022 07:10:07 +0000 (09:10 +0200)]
Rollup merge of #95461 - nyurik:spelling, r=lcnr

Spellchecking some comments

This PR attempts to clean up some minor spelling mistakes in comments

2 years agoRollup merge of #95460 - nyurik:spelling-str, r=lcnr
Dylan DPC [Wed, 30 Mar 2022 07:10:06 +0000 (09:10 +0200)]
Rollup merge of #95460 - nyurik:spelling-str, r=lcnr

Spellchecking compiler code

Address some spelling mistakes in strings, private function names, and function params.

2 years agoRollup merge of #95452 - yaahc:termination-version-correction, r=ehuss
Dylan DPC [Wed, 30 Mar 2022 07:10:05 +0000 (09:10 +0200)]
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`

2 years agoRollup merge of #95443 - jyn514:clarify-python-search-logic, r=Dylan-DPC
Dylan DPC [Wed, 30 Mar 2022 07:10:04 +0000 (09:10 +0200)]
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.

2 years agoRollup merge of #95294 - sourcefrog:doc-copy, r=dtolnay
Dylan DPC [Wed, 30 Mar 2022 07:10:04 +0000 (09:10 +0200)]
Rollup merge of #95294 - sourcefrog:doc-copy, r=dtolnay

Document Linux kernel handoff in std::io::copy and std::fs::copy

2 years agoSpellchecking compiler code
Yuri Astrakhan [Wed, 30 Mar 2022 05:42:10 +0000 (01:42 -0400)]
Spellchecking compiler code

Address some spelling mistakes in strings, private function names, and function params.

2 years agoSpellchecking some comments
Yuri Astrakhan [Wed, 30 Mar 2022 05:39:38 +0000 (01:39 -0400)]
Spellchecking some comments

This PR attempts to clean up some minor spelling mistakes in comments

2 years agoAuto merge of #94081 - oli-obk:lazy_tait_take_two, r=nikomatsakis
bors [Wed, 30 Mar 2022 05:04:45 +0000 (05:04 +0000)]
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

2 years agoMerge commit '5ff7b632a95bac6955611d85040859128902c580' into sync-rustfmt-subtree
Caleb Cartwright [Wed, 30 Mar 2022 04:17:30 +0000 (23:17 -0500)]
Merge commit '5ff7b632a95bac6955611d85040859128902c580' into sync-rustfmt-subtree

2 years agoPreserve semicolon after macro call inside foreign mod
David Tolnay [Tue, 29 Mar 2022 19:59:07 +0000 (12:59 -0700)]
Preserve semicolon after macro call inside foreign mod

2 years agoAdd test of macro calls inside extern block
David Tolnay [Tue, 29 Mar 2022 20:09:28 +0000 (13:09 -0700)]
Add test of macro calls inside extern block

2 years agoWarn that platform-specific behavior may change
Martin Pool [Wed, 30 Mar 2022 02:43:40 +0000 (19:43 -0700)]
Warn that platform-specific behavior may change

2 years agofix unix typedef
Aria Beingessner [Wed, 30 Mar 2022 02:45:31 +0000 (22:45 -0400)]
fix unix typedef

2 years agoAuto merge of #95455 - RalfJung:miri, r=RalfJung
bors [Wed, 30 Mar 2022 02:41:44 +0000 (02:41 +0000)]
Auto merge of #95455 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/95357
r? `@ghost`

2 years agoupdate miri
Ralf Jung [Wed, 30 Mar 2022 02:13:33 +0000 (22:13 -0400)]
update miri

2 years agofixup feature position in liballoc
Aria Beingessner [Tue, 29 Mar 2022 21:45:54 +0000 (17:45 -0400)]
fixup feature position in liballoc

2 years agoclarify that WASM has address spaces
Aria Beingessner [Mon, 28 Mar 2022 18:26:24 +0000 (14:26 -0400)]
clarify that WASM has address spaces

2 years agofix doc link
Aria Beingessner [Mon, 28 Mar 2022 18:06:16 +0000 (14:06 -0400)]
fix doc link

2 years agorefine the definition of temporal provenance
Aria Beingessner [Mon, 28 Mar 2022 17:16:04 +0000 (13:16 -0400)]
refine the definition of temporal provenance

2 years agomark FIXMES for all the places found that are probably offset_from
Aria Beingessner [Mon, 28 Mar 2022 04:43:18 +0000 (00:43 -0400)]
mark FIXMES for all the places found that are probably offset_from

2 years agomore review fixes to ptr docs
Aria Beingessner [Mon, 28 Mar 2022 04:37:28 +0000 (00:37 -0400)]
more review fixes to ptr docs

2 years agoAdd even more details to top-level pointer docs
Aria Beingessner [Sun, 27 Mar 2022 19:06:06 +0000 (15:06 -0400)]
Add even more details to top-level pointer docs

2 years agocleanup some of the less terrifying library code
Aria Beingessner [Sat, 26 Mar 2022 21:03:40 +0000 (17:03 -0400)]
cleanup some of the less terrifying library code

2 years agoclean up pointer docs
Aria Beingessner [Sat, 26 Mar 2022 19:55:05 +0000 (15:55 -0400)]
clean up pointer docs

2 years agorevert changes that cast functions to raw pointers, portability hazard
Aria Beingessner [Wed, 23 Mar 2022 16:38:04 +0000 (12:38 -0400)]
revert changes that cast functions to raw pointers, portability hazard

2 years agoMake some linux/unix APIs better conform to strict provenance.
Alexis Beingessner [Wed, 23 Mar 2022 01:29:38 +0000 (21:29 -0400)]
Make some linux/unix APIs better conform to strict provenance.

This largely makes the stdlib conform to strict provenance on Ubuntu.
Some hairier things have been left alone for now.

2 years agoMake some rustc code conform to strict provenance.
Aria Beingessner [Tue, 22 Mar 2022 20:21:33 +0000 (16:21 -0400)]
Make some rustc code conform to strict provenance.

There's some really bad stuff around `ty` and pointer tagging stuff that
was too much work to handle here.

2 years agoMake the stdlib largely conform to strict provenance.
Aria Beingessner [Tue, 22 Mar 2022 05:24:55 +0000 (01:24 -0400)]
Make the stdlib largely conform to strict provenance.

Some things like the unwinders and system APIs are not fully conformant,
this only covers a lot of low-hanging fruit.

2 years agoIntroduce experimental APIs for conforming to "strict provenance".
Aria Beingessner [Tue, 22 Mar 2022 05:27:28 +0000 (01:27 -0400)]
Introduce experimental APIs for conforming to "strict provenance".

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.

2 years agofix since field version for termination stabilization
Jane Lusby [Wed, 30 Mar 2022 00:10:49 +0000 (17:10 -0700)]
fix since field version for termination stabilization

2 years agoPre-allocate an empty `Lrc<NamedMatchVec>`.
Nicholas Nethercote [Tue, 29 Mar 2022 23:54:57 +0000 (10:54 +1100)]
Pre-allocate an empty `Lrc<NamedMatchVec>`.

This avoids some allocations.

2 years agoOverhaul how matches are recorded.
Nicholas Nethercote [Mon, 28 Mar 2022 06:13:56 +0000 (17:13 +1100)]
Overhaul how matches are recorded.

Currently, matches within a sequence are recorded in a new empty
`matches` vector. Then when the sequence finishes the matches are merged
into the `matches` vector of the parent.

This commit changes things so that a sequence mp inherits the matches
made so far. This means that additional matches from the sequence don't
need to be merged into the parent. `push_match` becomes more
complicated, and the current sequence depth needs to be tracked. But
it's a sizeable performance win because it avoids one or more
`push_match` calls on every iteration of a sequence.

The commit also removes `match_hi`, which is no longer necessary.

2 years agoImprove comments and rename many things for consistency.
Nicholas Nethercote [Fri, 25 Mar 2022 05:20:39 +0000 (16:20 +1100)]
Improve comments and rename many things for consistency.

In particular:
- Replace use of "item" with "matcher position/"mp".
- Replace use of "repetition" with "sequence".
- Replace `ms` with `matcher`.

2 years agoClarify comments about doc comments in macros.
Nicholas Nethercote [Tue, 29 Mar 2022 02:27:59 +0000 (13:27 +1100)]
Clarify comments about doc comments in macros.

2 years agoSimplify and rename `count_names`.
Nicholas Nethercote [Fri, 25 Mar 2022 05:23:26 +0000 (16:23 +1100)]
Simplify and rename `count_names`.

2 years agoAuto merge of #95448 - Dylan-DPC:rollup-wpj5yto, r=Dylan-DPC
bors [Tue, 29 Mar 2022 21:01:45 +0000 (21:01 +0000)]
Auto merge of #95448 - Dylan-DPC:rollup-wpj5yto, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #93840 (Stabilize Termination and ExitCode)
 - #95256 (Ensure io::Error's bitpacked repr doesn't accidentally impl UnwindSafe)
 - #95386 (Suggest wrapping patterns in enum variants)
 - #95437 (diagnostics: regression test for derive bounds)

Failed merges:

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

2 years agoRollup merge of #95437 - notriddle:notriddle/issue-79076, r=compiler-errors
Dylan DPC [Tue, 29 Mar 2022 20:46:36 +0000 (22:46 +0200)]
Rollup merge of #95437 - notriddle:notriddle/issue-79076, r=compiler-errors

diagnostics: regression test for derive bounds

Closes #79076

2 years agoRollup merge of #95386 - compiler-errors:try-wrapping, r=oli-obk
Dylan DPC [Tue, 29 Mar 2022 20:46:34 +0000 (22:46 +0200)]
Rollup merge of #95386 - compiler-errors:try-wrapping, r=oli-obk

Suggest wrapping patterns in enum variants

Structured suggestion to wrap a pattern in a single-field enum or struct:

```diff
 struct A;

 enum B {
   A(A),
 }

 fn main(b: B) {
   match b {
-    A => {}
+    B::A(A) => {}
   }
 }
```

Half of #94942, the other half I'm not exactly sure how to fix.

Also includes two drive-by changes (that I am open to splitting out into another PR, but thought they could be rolled up into this one):
07776c111f07b887cd46b752870cd3fd76b2ba7c: Makes sure not to suggest wrapping if it doesn't have tuple field constructor (i.e. has named fields)
8f2bbb18fd53e5008bb488302dbd354577698ede: Also suggest wrapping expressions in a tuple struct (not just enum variants)

2 years agoRollup merge of #95256 - thomcc:fix-unwind-safe, r=m-ou-se
Dylan DPC [Tue, 29 Mar 2022 20:46:33 +0000 (22:46 +0200)]
Rollup merge of #95256 - thomcc:fix-unwind-safe, r=m-ou-se

Ensure io::Error's bitpacked repr doesn't accidentally impl UnwindSafe

Sadly, I'm not sure how to easily test that we don't impl a trait, though (or can libstd use `where io::Error: !UnwindSafe` or something).

Fixes #95203

2 years agoRollup merge of #93840 - yaahc:termination-stabilization-celebration-station, r=josht...
Dylan DPC [Tue, 29 Mar 2022 20:46:31 +0000 (22:46 +0200)]
Rollup merge of #93840 - yaahc:termination-stabilization-celebration-station, r=joshtriplett

Stabilize Termination and ExitCode

From https://github.com/rust-lang/rust/issues/43301

This PR stabilizes the Termination trait and associated ExitCode type. It also adjusts the ExitCode feature flag to replace the placeholder flag with a more permanent name, as well as splitting off the `to_i32` method behind its own permanently unstable feature flag.

This PR stabilizes the termination trait with the following signature:

```rust
pub trait Termination {
    fn report(self) -> ExitCode;
}
```

The existing impls of `Termination` are effectively already stable due to the prior stabilization of `?` in main.

This PR also stabilizes the following APIs on exit code

```rust
#[derive(Clone, Copy, Debug)]
pub struct ExitCode(_);

impl ExitCode {
    pub const SUCCESS: ExitCode;
    pub const FAILURE: ExitCode;
}

impl From<u8> for ExitCode { /* ... */ }
```

---

All of the previous blockers have been resolved. The main ones that were resolved recently are:

* The trait's name: We decided against changing this since none of the alternatives seemed particularly compelling. Instead we decided to end the bikeshedding and stick with the current name. ([link to the discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Termination.2FExit.20Status.20Stabilization/near/269793887))
* Issues around platform specific representations: We resolved this issue by changing the return type of `report` from `i32` to the opaque type `ExitCode`. That way we can change the underlying representation without affecting the API, letting us offer full support for platform specific exit code APIs in the future.
* Custom exit codes: We resolved this by adding `From<u8> for ExitCode`. We choose to only support u8 initially because it is the least common denominator between the sets of exit codes supported by our current platforms. In the future we anticipate adding platform specific extension traits to ExitCode for constructors from larger or negative numbers, as needed.

2 years agoClarify how `src/tools/x` searches for python
Joshua Nelson [Tue, 29 Mar 2022 18:50:17 +0000 (13:50 -0500)]
Clarify how `src/tools/x` searches for python

2 years agoIndicate the correct error code in the `compile_fail` block.
Thom Chiovoloni [Tue, 29 Mar 2022 18:45:49 +0000 (11:45 -0700)]
Indicate the correct error code in the `compile_fail` block.

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2 years agoAuto merge of #95433 - Dylan-DPC:rollup-xdfit9h, r=Dylan-DPC
bors [Tue, 29 Mar 2022 17:48:40 +0000 (17:48 +0000)]
Auto merge of #95433 - Dylan-DPC:rollup-xdfit9h, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #94566 (Show ignore message in console and json output)
 - #95415 (diagnostics: regression test for HashMap iter_mut suggestion)
 - #95422 (Refactor: Use `format-args-capture` and remove an unnecessary nested block)
 - #95424 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agodiagnostics: regression test for derive bounds
Michael Howell [Tue, 29 Mar 2022 17:17:27 +0000 (10:17 -0700)]
diagnostics: regression test for derive bounds

Closes #79076

2 years agoRemember mutability in `DefKind::Static`.
Camille GILLOT [Tue, 29 Mar 2022 15:11:12 +0000 (17:11 +0200)]
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.

2 years agoAuto merge of #94566 - yanganto:show-ignore-message, r=m-ou-se
bors [Tue, 29 Mar 2022 15:18:57 +0000 (15:18 +0000)]
Auto merge of #94566 - yanganto:show-ignore-message, r=m-ou-se

Show ignore message in console and json output

- Provide ignore the message in console and JSON output
- Modify the ignore message style in the log file

related: #92714

2 years agoRollup merge of #95424 - lnicola:rust-analyzer-2022-03-29, r=lnicola
Dylan DPC [Tue, 29 Mar 2022 15:11:55 +0000 (17:11 +0200)]
Rollup merge of #95424 - lnicola:rust-analyzer-2022-03-29, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoRollup merge of #95422 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesti...
Dylan DPC [Tue, 29 Mar 2022 15:11:54 +0000 (17:11 +0200)]
Rollup merge of #95422 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesting-in-rustc-typeck, r=petrochenkov

Refactor: Use `format-args-capture` and remove an unnecessary nested block

2 years agoRollup merge of #95415 - notriddle:notriddle/issue-82081, r=Dylan-DPC
Dylan DPC [Tue, 29 Mar 2022 15:11:52 +0000 (17:11 +0200)]
Rollup merge of #95415 - notriddle:notriddle/issue-82081, r=Dylan-DPC

diagnostics: regression test for HashMap iter_mut suggestion

Closes #82081

2 years agoRollup merge of #94566 - yanganto:show-ignore-message, r=m-ou-se
Dylan DPC [Tue, 29 Mar 2022 15:11:51 +0000 (17:11 +0200)]
Rollup merge of #94566 - yanganto:show-ignore-message, r=m-ou-se

Show ignore message in console and json output

- Provide ignore the message in console and JSON output
- Modify the ignore message style in the log file

related: #92714

2 years agoRemove unnecessary .as_ref().
Mara Bos [Tue, 29 Mar 2022 13:53:09 +0000 (15:53 +0200)]
Remove unnecessary .as_ref().

2 years agoAuto merge of #95096 - GuillaumeGomez:rm-header-fn-field, r=camelid
bors [Tue, 29 Mar 2022 12:49:03 +0000 (12:49 +0000)]
Auto merge of #95096 - GuillaumeGomez:rm-header-fn-field, r=camelid

Remove header field from clean::Function

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

This is another take on https://github.com/rust-lang/rust/issues/89673 (compared to https://github.com/rust-lang/rust/pull/91217) but very different on the approach: I moved the header call in one place but still require to have the `clean::Item` so I can use the `DefId` to get what is missing.

cc `@jyn514` (you reviewed the original so maybe you want to take a look?)
r? `@camelid`

2 years agoRefactor after review
Antonio Yang [Tue, 29 Mar 2022 11:41:16 +0000 (19:41 +0800)]
Refactor after review

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>