]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoRemove commented lines
IQuant [Wed, 24 Aug 2022 14:09:07 +0000 (17:09 +0300)]
Remove commented lines

22 months agoUse `IntoDiagnosticArg` where it makes sense
Nikita Tomashevich [Wed, 24 Aug 2022 12:46:29 +0000 (15:46 +0300)]
Use `IntoDiagnosticArg` where it makes sense

22 months agoFix formating in infer.ftl to make tidy happy
Nikita Tomashevich [Tue, 23 Aug 2022 12:33:06 +0000 (15:33 +0300)]
Fix formating in infer.ftl to make tidy happy

22 months agoMigrate note_region_origin function
Nikita Tomashevich [Tue, 23 Aug 2022 10:48:14 +0000 (13:48 +0300)]
Migrate note_region_origin function

22 months agoUse GeneratorKind::descr() instead of it's Display impl
Nikita Tomashevich [Sun, 21 Aug 2022 21:17:46 +0000 (00:17 +0300)]
Use GeneratorKind::descr() instead of it's Display impl

Those are basically the same but the first one seems to fit better

22 months agoActually migrate OpaqueHiddenType
Nikita Tomashevich [Sun, 21 Aug 2022 19:39:46 +0000 (22:39 +0300)]
Actually migrate OpaqueHiddenType

22 months agoMigrate OpaqueHiddenType, E0282, E0283, E0284, E0698
Nikita Tomashevich [Sun, 21 Aug 2022 17:56:00 +0000 (20:56 +0300)]
Migrate OpaqueHiddenType, E0282, E0283, E0284, E0698

22 months agoAuto merge of #100782 - thomcc:fix-android-sigaddset, r=Mark-Simulacrum
bors [Tue, 23 Aug 2022 08:09:19 +0000 (08:09 +0000)]
Auto merge of #100782 - thomcc:fix-android-sigaddset, r=Mark-Simulacrum

Align android `sigaddset` impl with the reference impl from Bionic

In https://github.com/rust-lang/rust/pull/100737 I noticed we were treating the sigset_t as an array of bytes, while referencing code from android (https://github.com/aosp-mirror/platform_bionic/blob/ad8dcd6023294b646e5a8288c0ed431b0845da49/libc/include/android/legacy_signal_inlines.h) which treats it as an array of unsigned long.

That said, the behavior difference is so subtle here that it's not hard to see why nobody noticed. This fixes the implementation to be equivalent to the one in bionic.

22 months agoAuto merge of #100904 - matthiaskrgr:rollup-z3yzivj, r=matthiaskrgr
bors [Tue, 23 Aug 2022 05:22:05 +0000 (05:22 +0000)]
Auto merge of #100904 - matthiaskrgr:rollup-z3yzivj, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #100382 (Make the GATS self outlives error take into GATs in the inputs)
 - #100565 (Suggest adding a missing semicolon before an item)
 - #100641 (Add the armv4t-none-eabi target to the supported_targets)
 - #100789 (Use separate infcx to solve obligations during negative coherence)
 - #100832 (Some small bootstrap cleanup)
 - #100861 (fix ICE with extra-const-ub-checks)
 - #100862 (tidy: remove crossbeam-utils)
 - #100887 (Refactor part of codegen_call_terminator)
 - #100893 (Remove out-of-context comment in `mem::MaybeUninit` documentation)

Failed merges:

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

22 months agoRollup merge of #100893 - thinety:master, r=scottmcm
Matthias Krüger [Tue, 23 Aug 2022 04:55:31 +0000 (06:55 +0200)]
Rollup merge of #100893 - thinety:master, r=scottmcm

Remove out-of-context comment in `mem::MaybeUninit` documentation

Reverted the comment to an earlier version to avoid confusion: neither raw pointer assignment nor `ptr::write` is used inside the for loop.

22 months agoRollup merge of #100887 - eholk:codegen_call_terminator-cleanup, r=fee1-dead
Matthias Krüger [Tue, 23 Aug 2022 04:55:30 +0000 (06:55 +0200)]
Rollup merge of #100887 - eholk:codegen_call_terminator-cleanup, r=fee1-dead

Refactor part of codegen_call_terminator

I was reading through this code and found the chain of `if let` and a nested match on the same value that was matched in the `if let` to be kind of hard to follow. This PR cleans it up by flattening the `if let` chain and nested match into a single `match` expression.

22 months agoRollup merge of #100862 - ehuss:tidy-crossbeam, r=Mark-Simulacrum
Matthias Krüger [Tue, 23 Aug 2022 04:55:29 +0000 (06:55 +0200)]
Rollup merge of #100862 - ehuss:tidy-crossbeam, r=Mark-Simulacrum

tidy: remove crossbeam-utils

crossbeam-utils is no longer needed now that scoped threads are available in 1.63.

22 months agoRollup merge of #100861 - RalfJung:const-ice, r=oli-obk
Matthias Krüger [Tue, 23 Aug 2022 04:55:28 +0000 (06:55 +0200)]
Rollup merge of #100861 - RalfJung:const-ice, r=oli-obk

fix ICE with extra-const-ub-checks

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

22 months agoRollup merge of #100832 - ehuss:bootstrap-cleanup, r=jyn514
Matthias Krüger [Tue, 23 Aug 2022 04:55:27 +0000 (06:55 +0200)]
Rollup merge of #100832 - ehuss:bootstrap-cleanup, r=jyn514

Some small bootstrap cleanup

This is a collection of a few small cleanups. See commits for more details.

* Remove some unused fields from the tool_extended macro.
* Remove rustfmt from publish_toolstate.
* Remove Steve from toolstate failure notices.
* Don't allow rustfmt to fail on dist.

22 months agoRollup merge of #100789 - compiler-errors:issue-99662, r=spastorino
Matthias Krüger [Tue, 23 Aug 2022 04:55:26 +0000 (06:55 +0200)]
Rollup merge of #100789 - compiler-errors:issue-99662, r=spastorino

Use separate infcx to solve obligations during negative coherence

I feel like I fixed this already but I may have fixed it then forgot to push the branch...

Also fixes up some redundant param-envs being passed around (since they're already passed around in the `Obligation`)

Fixes #99662

r? ``@spastorino``

22 months agoRollup merge of #100641 - corwinkuiper:add-armv4t-target, r=oli-obk
Matthias Krüger [Tue, 23 Aug 2022 04:55:25 +0000 (06:55 +0200)]
Rollup merge of #100641 - corwinkuiper:add-armv4t-target, r=oli-obk

Add the armv4t-none-eabi target to the supported_targets

This target was added in #100244 but forgot to add it to the macro in the `mod.rs` file.

``@Lokathor``

22 months agoRollup merge of #100565 - TaKO8Ki:suggest-adding-missing-semicolon-before-item, r...
Matthias Krüger [Tue, 23 Aug 2022 04:55:24 +0000 (06:55 +0200)]
Rollup merge of #100565 - TaKO8Ki:suggest-adding-missing-semicolon-before-item, r=compiler-errors

Suggest adding a missing semicolon before an item

fixes #100533

22 months agoRollup merge of #100382 - jackh726:gat-self-outlives-input, r=compiler-errors
Matthias Krüger [Tue, 23 Aug 2022 04:55:23 +0000 (06:55 +0200)]
Rollup merge of #100382 - jackh726:gat-self-outlives-input, r=compiler-errors

Make the GATS self outlives error take into GATs in the inputs

Before, the reasoning was that outlives should factor in to the outlives error, because that value is produced and inputs aren't. However, this is potentially confusing, and we can just require this for now and relax it later if we need. GATs in where clauses still don't count for the self outlives error, and I've added a test for that.

This now errors:
```rust
trait Input {
    type Item<'a>;
    //~^ missing required
    fn takes_item<'a>(&'a self, item: Self::Item<'a>);
}
```

I've also added a test that this does not:
```rust
trait WhereClause {
    type Item<'a>;
    fn takes_item<'a>(&'a self) where Self::Item<'a>: ;
}
```

r? ``@compiler-errors``

22 months agoAuto merge of #100678 - GuillaumeGomez:improve-rustdoc-json-tests, r=aDotInTheVoid
bors [Tue, 23 Aug 2022 02:40:52 +0000 (02:40 +0000)]
Auto merge of #100678 - GuillaumeGomez:improve-rustdoc-json-tests, r=aDotInTheVoid

Improve rustdoc json tests

Fixes #100588.

r? `@aDotInTheVoid`

22 months agoAuto merge of #99963 - cjgillot:iter-submodule, r=compiler-errors
bors [Mon, 22 Aug 2022 23:09:35 +0000 (23:09 +0000)]
Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errors

Simplify implementation for par_for_each_module

22 months agoRemove out-of-context comment in `mem::MaybeUninit` documentation
Thiago Trannin [Mon, 22 Aug 2022 23:03:53 +0000 (20:03 -0300)]
Remove out-of-context comment in `mem::MaybeUninit` documentation

22 months agoAuto merge of #99762 - Nilstrieb:unreachable-prop, r=oli-obk
bors [Mon, 22 Aug 2022 20:28:16 +0000 (20:28 +0000)]
Auto merge of #99762 - Nilstrieb:unreachable-prop, r=oli-obk

UnreachableProp: Preserve unreachable branches for multiple targets

Before, UnreachablePropagation removed all unreachable branches. This was a pessimization, as it removed information about reachability that was used later in the optimization pipeline.

For example, this code
```rust
pub enum Two { A, B }
pub fn identity(x: Two) -> Two {
    match x {
        Two::A => Two::A,
        Two::B => Two::B,
    }
}
```

basically has `switchInt() -> [0: 0, 1: 1, otherwise: unreachable]` for the match. This allows it to be transformed into a simple `x`. If we remove the unreachable branch, the transformation becomes illegal.

This was the problem keeping `UnreachablePropagation` from being enabled, so we can enable it now.

Something similar already happened in #77800, but it did not show a perf improvement there. Let's try it again anyways!

Fixes #68105, although that issue has been fixed for a long time (see #77680).

22 months agoRefactor part of codegen_call_terminator
Eric Holk [Mon, 22 Aug 2022 18:25:56 +0000 (11:25 -0700)]
Refactor part of codegen_call_terminator

22 months agoAuto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPC
bors [Mon, 22 Aug 2022 17:46:57 +0000 (17:46 +0000)]
Auto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #98200 (Expand potential inner `Or` pattern for THIR)
 - #99770 (Make some const prop mir-opt tests `unit-test`s)
 - #99957 (Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase)
 - #100331 (Guarantee `try_reserve` preserves the contents on error)
 - #100336 (Fix two const_trait_impl issues)
 - #100713 (Convert diagnostics in parser/expr to SessionDiagnostic)
 - #100820 (Use pointer `is_aligned*` methods)
 - #100872 (Add guarantee that Vec::default() does not alloc)

Failed merges:

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

22 months agoRollup merge of #100872 - JanBeh:PR_vec_default_alloc_doc, r=fee1-dead
Dylan DPC [Mon, 22 Aug 2022 15:04:16 +0000 (20:34 +0530)]
Rollup merge of #100872 - JanBeh:PR_vec_default_alloc_doc, r=fee1-dead

Add guarantee that Vec::default() does not alloc

Currently `Vec::new()` is guaranteed to not allocate until elements are pushed onto the `Vec`, but such a guarantee is missing for `Vec`'s implementation of `Default::default`.

This adds such a guarantee for `Vec::default()` to the API reference.

See also [this discussion on URLO](https://users.rust-lang.org/t/guarantee-that-vec-default-does-not-allocate/79903).

22 months agoRollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=scottmcm
Dylan DPC [Mon, 22 Aug 2022 15:04:15 +0000 (20:34 +0530)]
Rollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=scottmcm

Use pointer `is_aligned*` methods

This PR replaces some manual alignment checks with calls to `pointer::{is_aligned, is_aligned_to}` and removes a useless pointer cast.

r? `@scottmcm`

_split off from #100746_

22 months agoRollup merge of #100713 - Xiretza:parser-expr-session-diagnostics, r=estebank
Dylan DPC [Mon, 22 Aug 2022 15:04:14 +0000 (20:34 +0530)]
Rollup merge of #100713 - Xiretza:parser-expr-session-diagnostics, r=estebank

Convert diagnostics in parser/expr to SessionDiagnostic

This migrates all the easy cases in `rustc_parse::parser::expr` to `SessionDiagnostic`s, I've left things such as `multipart_suggestion`s out for now in the hopes of a derive API being developed soon.

22 months agoRollup merge of #100336 - fee1-dead-contrib:fix-wf-const-trait, r=oli-obk
Dylan DPC [Mon, 22 Aug 2022 15:04:13 +0000 (20:34 +0530)]
Rollup merge of #100336 - fee1-dead-contrib:fix-wf-const-trait, r=oli-obk

Fix two const_trait_impl issues

r? ``@oli-obk``

Fixes #100222.
Fixes #100543.

22 months agoRollup merge of #100331 - lo48576:try-reserve-preserve-on-failure, r=thomcc
Dylan DPC [Mon, 22 Aug 2022 15:04:12 +0000 (20:34 +0530)]
Rollup merge of #100331 - lo48576:try-reserve-preserve-on-failure, r=thomcc

Guarantee `try_reserve` preserves the contents on error

Update doc comments to make the guarantee explicit. However, some
implementations does not have the statement though.

* `HashMap`, `HashSet`: require guarantees on hashbrown side.
* `PathBuf`: simply redirecting to `OsString`.

Fixes #99606.

22 months agoRollup merge of #99957 - chotchki:ip-globally-reachable_rebase, r=Mark-Simulacrum
Dylan DPC [Mon, 22 Aug 2022 15:04:10 +0000 (20:34 +0530)]
Rollup merge of #99957 - chotchki:ip-globally-reachable_rebase, r=Mark-Simulacrum

Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase

Rebasing of pull request #86634 off of master to try and get the feature "ip" stabilized.

I also found a test failure in the rebase that is_global was considering the benchmark space to be globally reachable.

This is related to my other rebasing pull request #99947

22 months agoRollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obk
Dylan DPC [Mon, 22 Aug 2022 15:04:09 +0000 (20:34 +0530)]
Rollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obk

Make some const prop mir-opt tests `unit-test`s

Most of these have no or only tiny diffs beyond line numbers being changed (would it make sense to not have line numbers in mir-opt tests?). Some things changed a bit, but I think it should all be fine, not sure though.

22 months agoRollup merge of #98200 - ouz-a:issue-98177, r=oli-obk
Dylan DPC [Mon, 22 Aug 2022 15:04:08 +0000 (20:34 +0530)]
Rollup merge of #98200 - ouz-a:issue-98177, r=oli-obk

Expand potential inner `Or` pattern for THIR

Code assumed there wouldn't be a deeper `Or` pattern inside expanded `PatStack` this fixes it by looking for the `Or` pattern inside expanded `PatStack`.

A more ideal solution would be recursively doing this but I haven't found a good way to do that.
_fixes #97898_

22 months agoAuto merge of #99908 - Nilstrieb:mir-opt-span, r=oli-obk
bors [Mon, 22 Aug 2022 14:59:21 +0000 (14:59 +0000)]
Auto merge of #99908 - Nilstrieb:mir-opt-span, r=oli-obk

Show absolute line numbers if span is outside relative span

In the MIR pretty printing, it can sometimes happen that the span of the statement is outside the span of the body (for example through inlining). In this case, don't display a relative span but an absolute span. This will make the mir-opt-tests a little more prone to diffs again, but the impact should be small.

Fixes #99854

r? `@oli-obk`

22 months agobless mir-opt tests
Nilstrieb [Fri, 29 Jul 2022 16:52:38 +0000 (18:52 +0200)]
bless mir-opt tests

22 months agobless ui tests
Nilstrieb [Fri, 29 Jul 2022 16:52:04 +0000 (18:52 +0200)]
bless ui tests

22 months agoFix span for consts in mir builder
Nilstrieb [Fri, 29 Jul 2022 16:49:27 +0000 (18:49 +0200)]
Fix span for consts in mir builder

22 months agoShow absolute line numbers if span is outside relative span
Nilstrieb [Fri, 29 Jul 2022 14:34:06 +0000 (16:34 +0200)]
Show absolute line numbers if span is outside relative span

In the MIR pretty printing, it can sometimes happen that the span of the
statement is outside the span of the body (for example through
inlining). In this case, don't display a relative span but an absolute
span. This will make the mir-opt-tests a little more prone to diffs
again, but the impact should be small.

22 months agofix tidy
Deadbeef [Mon, 22 Aug 2022 11:41:38 +0000 (11:41 +0000)]
fix tidy

22 months agoAuto merge of #99702 - SparrowLii:transtive_relation, r=oli-obk
bors [Mon, 22 Aug 2022 11:39:53 +0000 (11:39 +0000)]
Auto merge of #99702 - SparrowLii:transtive_relation, r=oli-obk

get rid of `RefCell` in `TransitiveRelation`

This is one of the jobs in `Pending refactorings` in #48685. The parallel-compiler's work has been suspended for quite some time, but I think I can pick it up gradually. I think this PR should be a start.

Regarding the refactoring of `TransitiveRelation`, `@nikomatsakis`  has proposed [two(three?) schemes](https://github.com/rust-lang/rust/pull/48587#issuecomment-369336651). In order to satisfy both compilation efficiency and robustness, I think adding the `freeze` method may be the best solution, although it requires relatively more code changes.

22 months agoOverhaul 100222 test; wf always remap to nonconst
Deadbeef [Mon, 22 Aug 2022 11:28:01 +0000 (11:28 +0000)]
Overhaul 100222 test; wf always remap to nonconst

22 months agoremove stray comment
Deadbeef [Mon, 22 Aug 2022 11:06:07 +0000 (11:06 +0000)]
remove stray comment

22 months agoFix wf check on `#[const_trait]` return types
Deadbeef [Tue, 9 Aug 2022 17:41:49 +0000 (17:41 +0000)]
Fix wf check on `#[const_trait]` return types

22 months agoAdd guarantee that Vec::default() does not alloc
Jan Behrens [Mon, 22 Aug 2022 10:36:44 +0000 (12:36 +0200)]
Add guarantee that Vec::default() does not alloc

Currently `Vec::new()` is guaranteed to not allocate until elements are
pushed onto the `Vec`, but such a guarantee is missing for `Vec`'s
implementation of `Default::default`. This adds such a guarantee for
`Vec::default()` to the API reference.

22 months agore-base and use `OutlivesEnvironment::with_bounds`
SparrowLii [Mon, 22 Aug 2022 10:36:02 +0000 (18:36 +0800)]
re-base and use `OutlivesEnvironment::with_bounds`

22 months agouse type alias impl trait in `outlives_bounds::InferCtxtExt`
SparrowLii [Mon, 1 Aug 2022 02:23:09 +0000 (10:23 +0800)]
use type alias impl trait in `outlives_bounds::InferCtxtExt`

22 months agoadd `with_bounds` to `OutlivesEnvironment` and `implied_bounds_tys` to `outlives_boun...
SparrowLii [Fri, 29 Jul 2022 07:08:50 +0000 (15:08 +0800)]
add `with_bounds` to `OutlivesEnvironment` and `implied_bounds_tys` to `outlives_bounds::InferCtxtExt`

22 months agoget rid of `RefCell` in `TransitiveRelation`
SparrowLii [Mon, 25 Jul 2022 03:06:22 +0000 (11:06 +0800)]
get rid of `RefCell` in `TransitiveRelation`

22 months agoAuto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPC
bors [Mon, 22 Aug 2022 08:32:41 +0000 (08:32 +0000)]
Auto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #93162 (Std module docs improvements)
 - #99386 (Add tests that check `Vec::retain` predicate execution order.)
 - #99915 (Recover keywords in trait bounds)
 - #100694 (Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part))
 - #100757 (Catch overflow early)

Failed merges:

 - #99917 (Move Error trait into core)

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

22 months agoRollup merge of #100757 - ouz-a:issue-95134, r=jackh726
Dylan DPC [Mon, 22 Aug 2022 06:15:45 +0000 (11:45 +0530)]
Rollup merge of #100757 - ouz-a:issue-95134, r=jackh726

Catch overflow early

Although this code should raise an overflow error, it didn't because [check_recursion_limit](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/select/struct.SelectionContext.html#method.check_recursion_limit) it checks for `depth = 128` but not for `129` which should have triggered the overflow error. Anyways this catches that error early.

Fixes #95134

22 months agoRollup merge of #100694 - finalchild:ast-passes-diag, r=TaKO8Ki
Dylan DPC [Mon, 22 Aug 2022 06:15:44 +0000 (11:45 +0530)]
Rollup merge of #100694 - finalchild:ast-passes-diag, r=TaKO8Ki

Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)

Doing a full migration of the `rustc_ast_passes` crate.
Making a draft here since there's not yet a tracking issue for the migrations going on.

`@rustbot` label +A-translation

22 months agoRollup merge of #99915 - WaffleLapkin:recover_keyword_bounds, r=compiler-errors
Dylan DPC [Mon, 22 Aug 2022 06:15:42 +0000 (11:45 +0530)]
Rollup merge of #99915 - WaffleLapkin:recover_keyword_bounds, r=compiler-errors

Recover keywords in trait bounds

(_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_)

Recover keywords in trait bound, motivational example:
```rust
fn f(_: impl fn()) {} // mistyped, meant `Fn`
```

<details><summary>Current nightly (3 needless and confusing errors!)</summary>
<p>

```text
error: expected identifier, found keyword `fn`
 --> ./t.rs:1:15
  |
1 | fn _f(_: impl fn()) {}
  |               ^^ expected identifier, found keyword
  |
help: escape `fn` to use it as an identifier
  |
1 | fn _f(_: impl r#fn()) {}
  |               ++

error: expected one of `:` or `|`, found `)`
 --> ./t.rs:1:19
  |
1 | fn _f(_: impl fn()) {}
  |                   ^ expected one of `:` or `|`

error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found keyword `fn`
 --> ./t.rs:1:15
  |
1 | fn _f(_: impl fn()) {}
  |              -^^ expected one of 9 possible tokens
  |              |
  |              help: missing `,`

error: at least one trait must be specified
 --> ./t.rs:1:10
  |
1 | fn _f(_: impl fn()) {}
  |          ^^^^
```

</p>
</details>

This PR:
```text
error: expected identifier, found keyword `fn`
 --> ./t.rs:1:15
  |
1 | fn _f(_: impl fn()) {}
  |               ^^ expected identifier, found keyword
  |
help: escape `fn` to use it as an identifier
  |
1 | fn _f(_: impl r#fn()) {}
  |               ++

error[E0405]: cannot find trait `r#fn` in this scope
  --> ./t.rs:1:15
   |
1  | fn _f(_: impl fn()) {}
   |               ^^ help: a trait with a similar name exists (notice the capitalization): `Fn`
   |
  ::: /home/waffle/projects/repos/rust/library/core/src/ops/function.rs:74:1
   |
74 | pub trait Fn<Args>: FnMut<Args> {
   | ------------------------------- similarly named trait `Fn` defined here
```

It would be nice to have suggestion in the first error like "have you meant `Fn` trait", instead of a separate error, but the recovery is deep inside ident parsing, which makes it a lot harder to do.

r? `@compiler-errors`

22 months agoRollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor
Dylan DPC [Mon, 22 Aug 2022 06:15:41 +0000 (11:45 +0530)]
Rollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor

Add tests that check `Vec::retain` predicate execution order.

This behaviour is documented for `Vec::retain` which means that there is code that rely on that but there weren't tests about that.

22 months agoRollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum
Dylan DPC [Mon, 22 Aug 2022 06:15:40 +0000 (11:45 +0530)]
Rollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum

Std module docs improvements

My primary goal is to create a cleaner separation between primitive types and primitive type helper modules (fixes #92777). I also changed a few header lines in other top-level std modules (seen at https://doc.rust-lang.org/std/) for consistency.

Some conventions used/established:

 * "The \`Box\<T>` type for heap allocation." - if a module mainly provides a single type, name it and summarize its purpose in the module header
 * "Utilities for the _ primitive type." - this wording is used for the header of helper modules
 * Documentation for primitive types themselves are removed from helper modules
 * provided-by-core functionality of primitive types is documented in the primitive type instead of the helper module (such as the "Iteration" section in the slice docs)

I wonder if some content in `std::ptr` should be in `pointer` but I did not address this.

22 months agoAuto merge of #100676 - lcnr:implied-bounds-yay, r=nikomatsakis
bors [Mon, 22 Aug 2022 06:10:26 +0000 (06:10 +0000)]
Auto merge of #100676 - lcnr:implied-bounds-yay, r=nikomatsakis

implied bounds: explicitly state which types are assumed to be wf

Adds a new query which maps each definition to the types which that definition assumes to be well formed. The intent is to make it easier to reason about implied bounds.

This change should not influence the user-facing behavior of rustc. Notably, `borrowck` still only assumes that the function signature of associated functions is well formed while `wfcheck` assumes that the both the function signature and the impl trait ref is well formed. Not sure if that by itself can trigger UB or whether it's just annoying.

As a next step, we can add `WellFormed` predicates to `predicates_of` of these items and can stop adding the wf bounds at each place which uses them. I also intend to move the computation from `assumed_wf_types` to `implied_bounds` into the `param_env` computation. This requires me to take a deeper look at `compare_predicate_entailment` which is currently somewhat weird wrt implied bounds so I am not touching this here.

r? `@nikomatsakis`

22 months agoAuto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
bors [Mon, 22 Aug 2022 03:02:50 +0000 (03:02 +0000)]
Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco

tidy: check fluent files for style

Inspired by https://github.com/rust-lang/rust/pull/100651#discussion_r947600576

There were a lot of line length violations, so I've excepted that lint - I'm not sure if fluent files can be formatted to avoid long lines at all.

22 months agoAuto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorino
bors [Mon, 22 Aug 2022 00:34:02 +0000 (00:34 +0000)]
Auto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorino

Use `AttrVec` more

In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.

r? `@spastorino`

22 months agotidy: remove crossbeam-utils
Eric Huss [Mon, 22 Aug 2022 00:11:51 +0000 (17:11 -0700)]
tidy: remove crossbeam-utils

22 months agofix ICE with extra-const-ub-checks
Ralf Jung [Mon, 22 Aug 2022 00:00:38 +0000 (20:00 -0400)]
fix ICE with extra-const-ub-checks

22 months agoAuto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank
bors [Sun, 21 Aug 2022 21:52:56 +0000 (21:52 +0000)]
Auto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank

Rework "point at arg" suggestions to be more accurate

Fixes #100560

Introduce a new set of `ObligationCauseCode`s which have additional bookeeping for what expression caused the obligation, and which predicate caused the obligation. This allows us to look at the _unsubstituted_ signature to find out which parameter or generic type argument caused an obligaton to fail.

This means that (in most cases) we significantly improve the likelihood of pointing out the right argument that causes a fulfillment error. Also, since this logic isn't happening in just the `select_where_possible_and_mutate_fulfillment()` calls in the argument checking code, but instead during all trait selection in `FnCtxt`, we are also able to point out the correct argument even if inference means that we don't know whether an obligation has failed until well after a call expression has been checked.

r? `@ghost`

22 months agoUse `AttrVec` in more places.
Nicholas Nethercote [Wed, 17 Aug 2022 02:34:33 +0000 (12:34 +1000)]
Use `AttrVec` in more places.

In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::thin_vec::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.

22 months agobless mir-opt tests
Nilstrieb [Tue, 26 Jul 2022 13:17:02 +0000 (15:17 +0200)]
bless mir-opt tests

22 months agoEnable UnreachablePropagation under mir-opt-level >= 2
Nilstrieb [Tue, 26 Jul 2022 13:15:07 +0000 (15:15 +0200)]
Enable UnreachablePropagation under mir-opt-level >= 2

It was disabled because of pathological behaviour of LLVM in some
benchmarks. As of #77680, this has been fixed. The problem there was
that it caused pessimizations in some cases. These have now been fixed
as well.

22 months agoUnreachableProp: Preserve unreachable branches for multiple targets
Nilstrieb [Tue, 26 Jul 2022 13:11:12 +0000 (15:11 +0200)]
UnreachableProp: Preserve unreachable branches for multiple targets

Before, UnreachablePropagation removed all unreachable branches.
This was a pessimization, as it removed information about
reachability that was used later in the optimization pipeline.

For example, this code
```rust
pub enum Two { A, B }
pub fn identity(x: Two) -> Two {
    match x {
        Two::A => Two::A,
        Two::B => Two::B,
    }
}
```

basically has `switchInt() -> [0: 0, 1: 1, otherwise: unreachable]` for the match.
This allows it to be transformed into a simple `x`. If we remove the
unreachable branch, the transformation becomes illegal.

22 months agoAuto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr
bors [Sun, 21 Aug 2022 19:05:18 +0000 (19:05 +0000)]
Auto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #100556 (Clamp Function for f32 and f64)
 - #100663 (Make slice::reverse const)
 - #100697 ( Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`)
 - #100760 (update test for LLVM change)
 - #100761 (some general mir typeck cleanup)
 - #100775 (rustdoc: Merge source code pages HTML elements together v2)
 - #100813 (Add `/build-rust-analyzer/` to .gitignore)
 - #100821 (Make some docs nicer wrt pointer offsets)
 - #100822 (Replace most uses of `pointer::offset` with `add` and `sub`)
 - #100839 (Make doc for stdin field of process consistent)
 - #100842 (Add diagnostics lints to `rustc_transmute` module (zero diags))

Failed merges:

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

22 months agoAuto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez
bors [Sun, 21 Aug 2022 16:40:26 +0000 (16:40 +0000)]
Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez

rustdoc: strategic boxing to reduce the size of ItemKind and Type

The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`.

This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.

22 months agoReplace #[error(..)] etc. to #[diag(..)]
finalchild [Sun, 21 Aug 2022 16:24:47 +0000 (01:24 +0900)]
Replace #[error(..)] etc. to #[diag(..)]

22 months agoFix incorrect return type of emit_fatal
Park Jaeon [파차] [Sat, 20 Aug 2022 17:22:05 +0000 (02:22 +0900)]
Fix incorrect return type of emit_fatal

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
22 months agoRemove redundant clone
finalchild [Thu, 18 Aug 2022 18:36:43 +0000 (03:36 +0900)]
Remove redundant clone

22 months agoMigrate forbidden_default and *_without_body
finalchild [Thu, 18 Aug 2022 17:43:01 +0000 (02:43 +0900)]
Migrate forbidden_default and *_without_body

22 months agoFix `build_format` not unescaping braces properly
finalchild [Thu, 18 Aug 2022 17:21:35 +0000 (02:21 +0900)]
Fix `build_format` not unescaping braces properly

Co-authored-by: RanolP <public.ranolp@gmail.com>
22 months agoSupport #[fatal(..)]
finalchild [Thu, 18 Aug 2022 12:20:50 +0000 (21:20 +0900)]
Support #[fatal(..)]

22 months agoMigrate fn_param_forbidden_self and rename others to have prefix fn_param_
finalchild [Thu, 18 Aug 2022 09:20:14 +0000 (18:20 +0900)]
Migrate fn_param_forbidden_self and rename others to have prefix fn_param_

22 months agoRename c_var_args_without_named_arg to c_var_args_is_sole_param
finalchild [Thu, 18 Aug 2022 08:53:59 +0000 (17:53 +0900)]
Rename c_var_args_without_named_arg to c_var_args_is_sole_param

22 months agoMigrate doc_comment_on_fn_param, forbidden_attr_on_fn_param
finalchild [Thu, 18 Aug 2022 08:46:01 +0000 (17:46 +0900)]
Migrate doc_comment_on_fn_param, forbidden_attr_on_fn_param

22 months agoMigrate forbidden_lifetime_bound, forbidden_non_lifetime_param, too_many_params,...
finalchild [Thu, 18 Aug 2022 08:38:11 +0000 (17:38 +0900)]
Migrate forbidden_lifetime_bound, forbidden_non_lifetime_param, too_many_params, c_var_args_without_named_arg, c_var_args_not_last

22 months agoMigrate trait_fn_const
finalchild [Thu, 18 Aug 2022 07:57:25 +0000 (16:57 +0900)]
Migrate trait_fn_const

22 months agoMigrate trait_fn_async
finalchild [Thu, 18 Aug 2022 07:49:52 +0000 (16:49 +0900)]
Migrate trait_fn_async

22 months agoTidy
finalchild [Thu, 18 Aug 2022 06:23:00 +0000 (15:23 +0900)]
Tidy

22 months agoMigrate deprecated_where_clause_location, forbidden_assoc_constraint, keyword_lifetim...
finalchild [Wed, 17 Aug 2022 19:36:57 +0000 (04:36 +0900)]
Migrate deprecated_where_clause_location, forbidden_assoc_constraint, keyword_lifetime, invalid_label, invalid_visibility

22 months agoUse DiagnosticMessage for BufferedEarlyLint.msg
finalchild [Wed, 17 Aug 2022 14:52:16 +0000 (23:52 +0900)]
Use DiagnosticMessage for BufferedEarlyLint.msg

22 months agoMigrate forbidden_let
finalchild [Wed, 17 Aug 2022 14:51:01 +0000 (23:51 +0900)]
Migrate forbidden_let

22 months agoRollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki
Matthias Krüger [Sun, 21 Aug 2022 14:54:09 +0000 (16:54 +0200)]
Rollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki

Add diagnostics lints to `rustc_transmute` module (zero diags)

Module is complete because it has zero diagnostics.

22 months agoRollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc
Matthias Krüger [Sun, 21 Aug 2022 14:54:08 +0000 (16:54 +0200)]
Rollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc

Make doc for stdin field of process consistent

The other fields use this format and example.

22 months agoRollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:07 +0000 (16:54 +0200)]
Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm

Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_

22 months agoRollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:06 +0000 (16:54 +0200)]
Rollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm

Make some docs nicer wrt pointer offsets

This PR replaces `pointer::offset` with `pointer::add` and similarly `.cast().wrapping_add().cast()` with `.wrapping_byte_add()` **in docs**.

r? ``````@scottmcm``````

_split off from #100746_

22 months agoRollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum
Matthias Krüger [Sun, 21 Aug 2022 14:54:05 +0000 (16:54 +0200)]
Rollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum

Add `/build-rust-analyzer/` to .gitignore

To avoid rust-analyzer and rustc having to wait for each other, the [dev guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc) mentions using another build directory for RA.

We should also put this into the .gitignore, just like the normal `build`.

22 months agoRollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle
Matthias Krüger [Sun, 21 Aug 2022 14:54:04 +0000 (16:54 +0200)]
Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle

rustdoc: Merge source code pages HTML elements together v2

This is the follow-up of https://github.com/rust-lang/rust/pull/100429.

I strongly recommend to review it one commit at a time because otherwise it's a lot at once.

For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. I also added the "starting point" because it's quite nice to see how much the page was reduced thanks to these two PRs.

| file name | before #100429 | before this PR | with this PR | diff |
|-|-|-|-|-|
| std/lib.rs.html (source link on std crate page) | 3455 | 2332 | 1772 | 24% |
| alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 5982 | 5833 | 2.5% |
| alloc/string.rs.html (source on String type page) | 10800 | 6010 | 5822 | 3.2% |
| std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2041 | 2038 | 0.1% |

So unsurprisingly, the more attributes you have, the bigger the difference.

You can test it [here](https://rustdoc.crud.net/imperio/reduce-span-v2/src/std/lib.rs.html).

cc ``````@jsha``````
r? ``````@notriddle``````

22 months agoRollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors
Matthias Krüger [Sun, 21 Aug 2022 14:54:04 +0000 (16:54 +0200)]
Rollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors

some general mir typeck cleanup

this pr contains the parts of #95763 which already work correctly.

the remaining commits of that PR have some issues which are more complex to fix.

r? types

22 months agoRollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic
Matthias Krüger [Sun, 21 Aug 2022 14:54:03 +0000 (16:54 +0200)]
Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic

update test for LLVM change

LLVM commit https://github.com/llvm/llvm-project/commit/c2a38887932e3a46aa3bee35f3f5568ac68282f4 updates the PIC level version selection. Updated an affected rust test to work under both the old and new behaviors.

Detected by our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12829#0182b368-a405-47a2-b3da-9c79cb907bfe/701-709

22 months agoRollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors
Matthias Krüger [Sun, 21 Aug 2022 14:54:02 +0000 (16:54 +0200)]
Rollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors

 Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`

I noticed the code examples on this function weren't formatted as code, and also the that the syntax for trait objects was out of date (or just incorrect). This should bring it up to date.

22 months agoRollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:01 +0000 (16:54 +0200)]
Rollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm

Make slice::reverse const

I remember this not being doable for some reason before, but decided to try it again and everything worked out in the tests.

22 months agoRollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:01 +0000 (16:54 +0200)]
Rollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm

Clamp Function for f32 and f64

I thought the clamp function could use a little improvement for readability purposes. The function now returns early in order to skip the extra bound checks.

If there was a reason for binding `self` to `x` or if this code is incorrect, please correct me :)

22 months agoAuto merge of #100841 - RalfJung:miri, r=RalfJung
bors [Sun, 21 Aug 2022 13:54:06 +0000 (13:54 +0000)]
Auto merge of #100841 - RalfJung:miri, r=RalfJung

update Miri

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

22 months agoADD - diagnostic lints to rustc_transmute
Jhonny Bill Mena [Sun, 21 Aug 2022 13:17:09 +0000 (09:17 -0400)]
ADD - diagnostic lints to rustc_transmute

Module is complete because it has zero diagnostics.

22 months agoupdate Miri
Ralf Jung [Sun, 21 Aug 2022 12:57:07 +0000 (08:57 -0400)]
update Miri

22 months agoMigrate diagnostics in parser/expr to SessionDiagnostic
Xiretza [Wed, 17 Aug 2022 17:05:49 +0000 (19:05 +0200)]
Migrate diagnostics in parser/expr to SessionDiagnostic

22 months agoMake use of `pointer::is_aligned[_to]`
Maybe Waffle [Fri, 19 Aug 2022 09:26:37 +0000 (13:26 +0400)]
Make use of `pointer::is_aligned[_to]`

22 months agorecover `const Tr` bounds (no `~`)
Maybe Waffle [Sun, 21 Aug 2022 10:58:42 +0000 (14:58 +0400)]
recover `const Tr` bounds (no `~`)

22 months agoAuto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors
bors [Sun, 21 Aug 2022 10:04:42 +0000 (10:04 +0000)]
Auto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors

Kind-less SessionDiagnostic derive

From https://github.com/rust-lang/rust/pull/100730#discussion_r949712629:

> Hm, maybe we should expose some `sess.struct_$SOMETHING` (like `struct_diagnostic`?) that is generic over `EmissionGuarantee`, then make the `SessionDiagnostic` derive generic, i.e.
>
> ```rust
> impl<'tcx> SessionDiagnostic for UnusedGenericParams {
>   fn into_diagnostic<T: EmissionGuarantee>( .. ) -> DiagnosticBuilder<'tcx, T> {
>     let mut diag = sess.struct_diagnostic(rustc_errors:..);
>     ..
>   }
> }
> ```

Discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20translation.20-.20kind-less.20derive).

22 months agoMake doc for stdin field of process consistent
Nelson Chen [Sun, 21 Aug 2022 08:56:26 +0000 (01:56 -0700)]
Make doc for stdin field of process consistent

The other fields use this format and example.