]> git.lizzy.rs Git - rust.git/log
rust.git
16 months agoRollup merge of #107432 - notriddle:notriddle/has-srclink, r=GuillaumeGomez
Matthias Krüger [Sun, 29 Jan 2023 19:03:39 +0000 (20:03 +0100)]
Rollup merge of #107432 - notriddle:notriddle/has-srclink, r=GuillaumeGomez

rustdoc: remove unused class `has-srclink`

Stopped being used in CSS with 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0.

16 months agoRollup merge of #107431 - notriddle:notriddle/colon, r=thomcc
Matthias Krüger [Sun, 29 Jan 2023 19:03:38 +0000 (20:03 +0100)]
Rollup merge of #107431 - notriddle:notriddle/colon, r=thomcc

docs: remove colon from time header

It's not used anywhere else; the inconsistency is weird.

16 months agoRollup merge of #107169 - albertlarsan68:lock-in-pre-push, r=Mark-Simulacrum
Matthias Krüger [Sun, 29 Jan 2023 19:03:38 +0000 (20:03 +0100)]
Rollup merge of #107169 - albertlarsan68:lock-in-pre-push, r=Mark-Simulacrum

Pass `--locked` to the x test tidy call

This allows to fail the push when the `Cargo.lock` file needs to be updated.

16 months agoRollup merge of #107078 - ehuss:invalid_doc_attributes-docs, r=jackh726
Matthias Krüger [Sun, 29 Jan 2023 19:03:37 +0000 (20:03 +0100)]
Rollup merge of #107078 - ehuss:invalid_doc_attributes-docs, r=jackh726

Update wording of invalid_doc_attributes docs.

There was a typo in the original docs for `invalid_doc_attributes`. I felt it could use a little rewording to try to clarify the reasoning for the lint. Also, this adds the future-incompatible notice.

16 months agoRollup merge of #107006 - b-naber:thir-tree, r=jackh726
Matthias Krüger [Sun, 29 Jan 2023 19:03:37 +0000 (20:03 +0100)]
Rollup merge of #107006 - b-naber:thir-tree, r=jackh726

Output tree representation on thir-tree

The current output of `-Zunpretty=thir-tree` is really cumbersome to work with, using an actual tree representation should make it easier to see what the thir looks like.

16 months agoRollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum
Matthias Krüger [Sun, 29 Jan 2023 19:03:36 +0000 (20:03 +0100)]
Rollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum

Implement `signum` with `Ord`

Rather than needing to do things like #105840 for `signum` too, might as well just implement that method using `Ord`, since it's doing the same "I need `-1`/`0`/`+1`" behaviour that `cmp` is already doing.

This also seems to slightly improve the assembly: <https://rust.godbolt.org/z/5oEEqbxK1>

16 months agoRollup merge of #106769 - lenko-d:libtest-print_why_a_test_was_ignored_if_its_the_onl...
Matthias Krüger [Sun, 29 Jan 2023 19:03:36 +0000 (20:03 +0100)]
Rollup merge of #106769 - lenko-d:libtest-print_why_a_test_was_ignored_if_its_the_only_test_specified, r=Mark-Simulacrum

libtest: Print why a test was ignored if it's the only test specified.

Fixes [#106659](https://github.com/rust-lang/rust/issues/106659)
Needed by [106763](https://github.com/rust-lang/rust/pull/106763)

16 months agoRollup merge of #106763 - lenko-d:106659-Print_why_a_test_was_ignored_if_its_the_only...
Matthias Krüger [Sun, 29 Jan 2023 19:03:35 +0000 (20:03 +0100)]
Rollup merge of #106763 - lenko-d:106659-Print_why_a_test_was_ignored_if_its_the_only_test_specified, r=Mark-Simulacrum

print why a test was ignored if its the only test specified

Fixes [#106659](https://github.com/rust-lang/rust/issues/106659)

16 months agoRollup merge of #106540 - lowr:patch/remove-paren-whitespace, r=cjgillot
Matthias Krüger [Sun, 29 Jan 2023 19:03:35 +0000 (20:03 +0100)]
Rollup merge of #106540 - lowr:patch/remove-paren-whitespace, r=cjgillot

Insert whitespace to avoid ident concatenation in suggestion

This PR tweaks the suggestion of removing misplaced parentheses around trait bounds so as to avoid concatenating two identifiers. Although subtle, this should make outputs less surprising especially when applying the `MachineApplicable` suggestions automatically.

16 months agoRollup merge of #96763 - Abdur-rahmaanJ:patch-1, r=Mark-Simulacrum
Matthias Krüger [Sun, 29 Jan 2023 19:03:34 +0000 (20:03 +0100)]
Rollup merge of #96763 - Abdur-rahmaanJ:patch-1, r=Mark-Simulacrum

Fix maintainer validation message

State clearly why maintainer verification is not activating, ruling out the user thinking they misconfigured something.

16 months agoAuto merge of #106908 - cjgillot:copyprop-ssa, r=oli-obk
bors [Sun, 29 Jan 2023 13:01:06 +0000 (13:01 +0000)]
Auto merge of #106908 - cjgillot:copyprop-ssa, r=oli-obk

Implement simple CopyPropagation based on SSA analysis

This PR extracts the "copy propagation" logic from https://github.com/rust-lang/rust/pull/106285.

MIR may produce chains of assignment between locals, like `_x = move? _y`.
This PR attempts to remove such chains by unifying locals.

The current implementation is a bit overzealous in turning moves into copies, and in removing storage statements.

16 months agoInsert whitespace to avoid ident concatenation in suggestion
Ryo Yoshida [Thu, 5 Jan 2023 19:43:08 +0000 (04:43 +0900)]
Insert whitespace to avoid ident concatenation in suggestion

16 months agoAuto merge of #106253 - nbdd0121:upcast, r=compiler-errors
bors [Sun, 29 Jan 2023 10:20:25 +0000 (10:20 +0000)]
Auto merge of #106253 - nbdd0121:upcast, r=compiler-errors

Skip possible where_clause_object_safety lints when checking `multiple_supertrait_upcastable`

Fix #106247

To achieve this, I lifted the `WhereClauseReferencesSelf` out from `object_safety_violations` and move it into `is_object_safe` (which is changed to a new query).

cc `@dtolnay`
r? `@compiler-errors`

16 months agoAuto merge of #107435 - matthiaskrgr:rollup-if5h6yu, r=matthiaskrgr
bors [Sun, 29 Jan 2023 07:01:58 +0000 (07:01 +0000)]
Auto merge of #107435 - matthiaskrgr:rollup-if5h6yu, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #106618 (Disable `linux_ext` in wasm32 and fortanix rustdoc builds.)
 - #107097 (Fix def-use dominance check)
 - #107154 (library/std/sys_common: Define MIN_ALIGN for m68k-unknown-linux-gnu)
 - #107397 (Gracefully exit if --keep-stage flag is used on a clean source tree)
 - #107401 (remove the usize field from CandidateSource::AliasBound)
 - #107413 (make more pleasant to read)
 - #107422 (Also erase substs for new infcx in pin move error)
 - #107425 (Check for missing space between fat arrow and range pattern)

Failed merges:

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

16 months agoRollup merge of #107425 - clubby789:match-range-missing-space, r=compiler-errors
Matthias Krüger [Sun, 29 Jan 2023 05:14:20 +0000 (06:14 +0100)]
Rollup merge of #107425 - clubby789:match-range-missing-space, r=compiler-errors

Check for missing space between fat arrow and range pattern

Fixes #107420

Ideally we wouldn't emit an error about expecting `=>` etc., but I'm not sure how to recover from this.

`@rustbot` label +A-diagnostics

16 months agoRollup merge of #107422 - Nilstrieb:erase-the-ice, r=compiler-errors
Matthias Krüger [Sun, 29 Jan 2023 05:14:20 +0000 (06:14 +0100)]
Rollup merge of #107422 - Nilstrieb:erase-the-ice, r=compiler-errors

Also erase substs for new infcx in pin move error

The code originally correctly erased the regions of the type it passed to the newly created infcx. But after the `fn_sig` query was made to return an `EarlyBinder<T>`, some substs that were around were substituted there without erasing their regions. They were then passed into the newly cerated infcx, which caused the ICE.

Fixes #107419

r? compiler-errors who reviewed the original PR adding this diagnostic

16 months agoRollup merge of #107413 - tshepang:pleasant-readin, r=Nilstrieb
Matthias Krüger [Sun, 29 Jan 2023 05:14:19 +0000 (06:14 +0100)]
Rollup merge of #107413 - tshepang:pleasant-readin, r=Nilstrieb

make more pleasant to read

16 months agoRollup merge of #107401 - lenko-d:remove_the_usize_field_from_CandidateSource_AliasBo...
Matthias Krüger [Sun, 29 Jan 2023 05:14:18 +0000 (06:14 +0100)]
Rollup merge of #107401 - lenko-d:remove_the_usize_field_from_CandidateSource_AliasBound, r=compiler-errors

remove the usize field from CandidateSource::AliasBound

Fixes [#107380](https://github.com/rust-lang/rust/issues/107380)

16 months agoRollup merge of #107397 - Teapot4195:issue-107392-fix, r=albertlarsan68
Matthias Krüger [Sun, 29 Jan 2023 05:14:18 +0000 (06:14 +0100)]
Rollup merge of #107397 - Teapot4195:issue-107392-fix, r=albertlarsan68

Gracefully exit if --keep-stage flag is used on a clean source tree

Instead of quitting with an obscure No such file or directory error, give the user a clearer and easier to understand error (as well as suggesting a possible cause for the error).

This is the first time I have written rust since 2020, and the first PR I will ever make to rust, so please do point out any mistakes I have made :smile: .

This fixes #107392

16 months agoRollup merge of #107154 - glaubitz:m68k-alloc, r=JohnTitor
Matthias Krüger [Sun, 29 Jan 2023 05:14:17 +0000 (06:14 +0100)]
Rollup merge of #107154 - glaubitz:m68k-alloc, r=JohnTitor

library/std/sys_common: Define MIN_ALIGN for m68k-unknown-linux-gnu

This PR adds the missing definition of MIN_ALIGN for the m68k-unknown-linux target.

16 months agoRollup merge of #107097 - tmiasko:ssa, r=cjgillot
Matthias Krüger [Sun, 29 Jan 2023 05:14:17 +0000 (06:14 +0100)]
Rollup merge of #107097 - tmiasko:ssa, r=cjgillot

Fix def-use dominance check

A definition does not dominate a use in the same statement. For example
in MIR generated for compound assignment x += a (when overflow checks
are disabled).

16 months agoRollup merge of #106618 - jmillikin:os-net-rustdoc-wasm32, r=JohnTitor
Matthias Krüger [Sun, 29 Jan 2023 05:14:16 +0000 (06:14 +0100)]
Rollup merge of #106618 - jmillikin:os-net-rustdoc-wasm32, r=JohnTitor

Disable `linux_ext` in wasm32 and fortanix rustdoc builds.

The `std::os::unix` module is stubbed out when building docs for these target platforms. The introduction of Linux-specific extension traits caused `std::os::net` to depend on sub-modules of `std::os::unix`, which broke rustdoc for the `wasm32-unknown-unknown` target.

Adding an additional `#[cfg]` guard solves that rustdoc failure by not declaring `linux_ext` on targets with a stubbed `std::os::unix`.

Fixes #105467

16 months agoAuto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
bors [Sun, 29 Jan 2023 04:11:27 +0000 (04:11 +0000)]
Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk

Use stable metric for const eval limit instead of current terminator-based logic

This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only.

The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made).

Also see: #103877

16 months agoAuto merge of #107406 - cjgillot:eliminate-witnesses, r=compiler-errors
bors [Sun, 29 Jan 2023 01:27:11 +0000 (01:27 +0000)]
Auto merge of #107406 - cjgillot:eliminate-witnesses, r=compiler-errors

Only compute mir_generator_witnesses query in drop_tracking_mir mode.

Attempt to fix the perf regression in https://github.com/rust-lang/rust/pull/101692

r? `@ghost`

16 months agorustdoc: remove unused class `has-srclink`
Michael Howell [Sat, 28 Jan 2023 23:35:02 +0000 (16:35 -0700)]
rustdoc: remove unused class `has-srclink`

Stopped being used in CSS with
73d0f7c7b68784f1db0a1f53855c20d118a7e8b0

16 months agodocs: remove colon from time header
Michael Howell [Sat, 28 Jan 2023 23:07:34 +0000 (16:07 -0700)]
docs: remove colon from time header

It's not used anywhere else; the inconsistency is weird.

16 months agoAuto merge of #103659 - clubby789:improve-partialord-derive, r=nagisa
bors [Sat, 28 Jan 2023 22:11:11 +0000 (22:11 +0000)]
Auto merge of #103659 - clubby789:improve-partialord-derive, r=nagisa

Special-case deriving `PartialOrd` for enums with dataless variants

I was able to get slightly better codegen by flipping the derived `PartialOrd` logic for two-variant enums.  I also tried to document the implementation of the derive macro to make the special-case logic a little clearer.
```rs
#[derive(PartialEq, PartialOrd)]
pub enum A<T> {
    A,
    B(T)
}
```
```diff
impl<T: ::core::cmp::PartialOrd> ::core::cmp::PartialOrd for A<T> {
   #[inline]
   fn partial_cmp(
       &self,
       other: &A<T>,
   ) -> ::core::option::Option<::core::cmp::Ordering> {
       let __self_tag = ::core::intrinsics::discriminant_value(self);
       let __arg1_tag = ::core::intrinsics::discriminant_value(other);
-      match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
-          ::core::option::Option::Some(::core::cmp::Ordering::Equal) => {
-              match (self, other) {
-                  (A::B(__self_0), A::B(__arg1_0)) => {
-                      ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0)
-                  }
-                  _ => ::core::option::Option::Some(::core::cmp::Ordering::Equal),
-              }
+      match (self, other) {
+          (A::B(__self_0), A::B(__arg1_0)) => {
+              ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0)
           }
-          cmp => cmp,
+          _ => ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag),
       }
   }
}
```
Godbolt: [Current](https://godbolt.org/z/GYjEzG1T8), [New](https://godbolt.org/z/GoK78qx15)
I'm not sure how common a case comparing two enums like this (such as `Option`) is, and if it's worth the slowdown of adding a special case to the derive. If it causes overall regressions it might be worth just manually implementing this for `Option`.

16 months agoMigrate some range parsing diagnostics
clubby789 [Sat, 28 Jan 2023 21:16:50 +0000 (21:16 +0000)]
Migrate some range parsing diagnostics

16 months agoCheck for missing space between fat arrow and range pattern
clubby789 [Sat, 28 Jan 2023 20:02:00 +0000 (20:02 +0000)]
Check for missing space between fat arrow and range pattern

16 months agoGracefully exit when --keep-stage used on clean source tree
teapot4195 [Sat, 28 Jan 2023 20:20:27 +0000 (15:20 -0500)]
Gracefully exit when --keep-stage used on clean source tree

16 months agoAlso erase substs for new infcx in pin move error
Nilstrieb [Sat, 28 Jan 2023 19:43:16 +0000 (20:43 +0100)]
Also erase substs for new infcx in pin move error

The code originally correctly erased the regions of the type it passed
to the newly created infcx. But after the `fn_sig` query was made to
return an `EarlyBinder<T>`, some substs that were around were
substituted there without erasing their regions. They were then passed
into the newly cerated infcx, which caused the ICE.

16 months agoAuto merge of #107303 - compiler-errors:intern-canonical-var-values, r=lcnr
bors [Sat, 28 Jan 2023 19:41:21 +0000 (19:41 +0000)]
Auto merge of #107303 - compiler-errors:intern-canonical-var-values, r=lcnr

Intern `CanonicalVarValues`

So that they are copy :sparkles:

16 months agoAuto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkin
bors [Sat, 28 Jan 2023 16:11:33 +0000 (16:11 +0000)]
Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkin

Remove HirId -> LocalDefId map from HIR.

Having this map in HIR prevents the creating of new definitions after HIR has been built.
Thankfully, we do not need it.

Based on https://github.com/rust-lang/rust/pull/103902

16 months agoReintroduce multiple_supertrait_upcastable lint
Gary Guo [Fri, 9 Dec 2022 02:27:03 +0000 (02:27 +0000)]
Reintroduce multiple_supertrait_upcastable lint

16 months agoRename `is_object_safe` to `check_is_object_safe` to hint side effects
Gary Guo [Sat, 28 Jan 2023 15:07:21 +0000 (15:07 +0000)]
Rename `is_object_safe` to `check_is_object_safe` to hint side effects

16 months agoMake `is_object_safe` a query and move lint_object_unsafe_trait call there
Gary Guo [Thu, 29 Dec 2022 09:53:25 +0000 (09:53 +0000)]
Make `is_object_safe` a query and move lint_object_unsafe_trait call there

16 months agoReplace `object_safety_violations().is_empty()` calls with `is_object_safe`
Gary Guo [Thu, 29 Dec 2022 09:52:46 +0000 (09:52 +0000)]
Replace `object_safety_violations().is_empty()` calls with `is_object_safe`

16 months agomake more pleasant to read
Tshepang Mbambo [Sat, 28 Jan 2023 14:35:07 +0000 (16:35 +0200)]
make more pleasant to read

16 months agoAuto merge of #107408 - matthiaskrgr:rollup-b5vz2ow, r=matthiaskrgr
bors [Sat, 28 Jan 2023 13:12:59 +0000 (13:12 +0000)]
Auto merge of #107408 - matthiaskrgr:rollup-b5vz2ow, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #104012 (Improve unexpected close and mismatch delimiter hint in TokenTreesReader)
 - #104252 (Stabilize the const_socketaddr feature)
 - #105524 (Replace libc::{type} with crate::ffi::{type})
 - #107096 (Detect references to non-existant messages in Fluent resources)
 - #107355 (Add regression test for #60755)
 - #107384 (Remove `BOOL_TY_FOR_UNIT_TESTING`)
 - #107385 (Use `FallibleTypeFolder` for `ConstInferUnifier` not `TypeRelation`)
 - #107391 (rustdoc: remove inline javascript from copy-path button)
 - #107398 (Remove `ControlFlow::{BREAK, CONTINUE}`)

Failed merges:

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

16 months agoUse field-less variant for AliasBound.
Lenko Donchev [Sat, 28 Jan 2023 12:00:27 +0000 (06:00 -0600)]
Use field-less variant for AliasBound.

16 months agoRollup merge of #107398 - scottmcm:its-their-funeral, r=dtolnay
Matthias Krüger [Sat, 28 Jan 2023 10:11:09 +0000 (11:11 +0100)]
Rollup merge of #107398 - scottmcm:its-their-funeral, r=dtolnay

Remove `ControlFlow::{BREAK, CONTINUE}`

Libs-API decided to remove these in #102697.

Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged.

r? libs

16 months agoRollup merge of #107391 - notriddle:notriddle/copy-path-button, r=GuillaumeGomez
Matthias Krüger [Sat, 28 Jan 2023 10:11:09 +0000 (11:11 +0100)]
Rollup merge of #107391 - notriddle:notriddle/copy-path-button, r=GuillaumeGomez

rustdoc: remove inline javascript from copy-path button

16 months agoRollup merge of #107385 - BoxyUwU:ConstInferUnifier_is_folder, r=compiler-errors
Matthias Krüger [Sat, 28 Jan 2023 10:11:08 +0000 (11:11 +0100)]
Rollup merge of #107385 - BoxyUwU:ConstInferUnifier_is_folder, r=compiler-errors

Use `FallibleTypeFolder` for `ConstInferUnifier` not `TypeRelation`

I am not sure why this was using a `TypeRelation`, maybe it predates the ability to have fallible type folders

16 months agoRollup merge of #107384 - Nilstrieb:bool-for-deletion, r=oli-obk
Matthias Krüger [Sat, 28 Jan 2023 10:11:08 +0000 (11:11 +0100)]
Rollup merge of #107384 - Nilstrieb:bool-for-deletion, r=oli-obk

Remove `BOOL_TY_FOR_UNIT_TESTING`

It is not used anymore for unit testing.

16 months agoRollup merge of #107355 - JohnTitor:issue-60755, r=compiler-errors
Matthias Krüger [Sat, 28 Jan 2023 10:11:07 +0000 (11:11 +0100)]
Rollup merge of #107355 - JohnTitor:issue-60755, r=compiler-errors

Add regression test for #60755

Closes #60755
r? compiler-errors
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
16 months agoRollup merge of #107096 - clubby789:fluent-bad-messageref, r=compiler-errors
Matthias Krüger [Sat, 28 Jan 2023 10:11:07 +0000 (11:11 +0100)]
Rollup merge of #107096 - clubby789:fluent-bad-messageref, r=compiler-errors

Detect references to non-existant messages in Fluent resources

Should help with cases like #107091, where `{variable}` (a message reference) is accidentally typed, rather than `{$variable}` (a variable reference)

Fixes #107370

```@rustbot``` label +A-translation

16 months agoRollup merge of #105524 - Ayush1325:libc-free, r=ChrisDenton
Matthias Krüger [Sat, 28 Jan 2023 10:11:06 +0000 (11:11 +0100)]
Rollup merge of #105524 - Ayush1325:libc-free, r=ChrisDenton

Replace libc::{type} with crate::ffi::{type}

Replace libc::{type} imports with crate::ffi::{type} outside of `std::sys` and `std::os`.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
16 months agoRollup merge of #104252 - faern:stabilize-const_socketaddr, r=JohnTitor
Matthias Krüger [Sat, 28 Jan 2023 10:11:06 +0000 (11:11 +0100)]
Rollup merge of #104252 - faern:stabilize-const_socketaddr, r=JohnTitor

Stabilize the const_socketaddr feature

Stabilizes `#![feature(const_socketaddr)]`. Tracking issue: #82485
Closes #82485

This has been unstably const for over a year now. And the code change simplifying the constness of the `new` constructors has been in stable Rust since 1.64 (a bit over a full release cycle). I'm not aware of any blockers to this stabilization.

16 months agoRollup merge of #104012 - chenyukang:yukang/fix-103882-deli-indentation, r=petrochenkov
Matthias Krüger [Sat, 28 Jan 2023 10:11:05 +0000 (11:11 +0100)]
Rollup merge of #104012 - chenyukang:yukang/fix-103882-deli-indentation, r=petrochenkov

Improve unexpected close and mismatch delimiter hint in TokenTreesReader

Fixes #103882
Fixes #68987
Fixes #69259

The inner indentation mismatching will be covered by outer block, the new added function `report_error_prone_delim_block` will find out the error prone candidates for reporting.

16 months agoAuto merge of #106916 - lukas-code:overlapping-substs, r=estebank
bors [Sat, 28 Jan 2023 10:00:56 +0000 (10:00 +0000)]
Auto merge of #106916 - lukas-code:overlapping-substs, r=estebank

Remove overlapping parts of multipart suggestions

This PR adds a debug assertion that the parts of a single substitution cannot overlap, fixes a overlapping substitution from the testsuite, and fixes https://github.com/rust-lang/rust/issues/106870.

Note that a single suggestion can still have multiple overlapping substitutions / possible edits, we just don't suggest overlapping replacements in a single edit anymore.

I've also included a fix for an unrelated bug where rustfix for `explicit_outlives_requirements` would produce multiple trailing commas for a where clause.

16 months agoAdapt ui-fulldeps.
Camille GILLOT [Sun, 22 Jan 2023 18:45:37 +0000 (18:45 +0000)]
Adapt ui-fulldeps.

16 months agoRemove `HirId -> LocalDefId` map from HIR.
Camille GILLOT [Sat, 5 Nov 2022 15:33:58 +0000 (15:33 +0000)]
Remove `HirId -> LocalDefId` map from HIR.

16 months agoTake a LocalDefId in hir::Visitor::visit_fn.
Camille GILLOT [Sun, 22 Jan 2023 18:00:33 +0000 (18:00 +0000)]
Take a LocalDefId in hir::Visitor::visit_fn.

16 months agoOnly compute mir_generator_witnesses query in drop_tracking_mir mode.
Camille GILLOT [Sat, 28 Jan 2023 08:41:22 +0000 (08:41 +0000)]
Only compute mir_generator_witnesses query in drop_tracking_mir mode.

16 months agoAuto merge of #107400 - matthiaskrgr:rollup-l6bycds, r=matthiaskrgr
bors [Sat, 28 Jan 2023 06:46:42 +0000 (06:46 +0000)]
Auto merge of #107400 - matthiaskrgr:rollup-l6bycds, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #107022 (Implement `SpecOptionPartialEq` for `cmp::Ordering`)
 - #107100 (Use proper `InferCtxt` when probing for associated types in astconv)
 - #107103 (Use new solver in `evaluate_obligation` query (when new solver is enabled))
 - #107190 (Recover from more const arguments that are not wrapped in curly braces)
 - #107306 (Correct suggestions for closure arguments that need a borrow)
 - #107339 (internally change regions to be covariant)
 - #107344 (Minor tweaks in the new solver)
 - #107373 (Don't merge vtables when full debuginfo is enabled.)

Failed merges:

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

16 months agoReplace libc::{type} with crate::ffi::{type}
Ayush Singh [Sat, 10 Dec 2022 08:04:19 +0000 (13:34 +0530)]
Replace libc::{type} with crate::ffi::{type}

Replace libc::{type} imports with crate::ffi::{type} outside of
`std::sys` and `std::os`.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
16 months agoremove the usize field from CandidateSource::AliasBound
Lenko Donchev [Sat, 28 Jan 2023 04:50:24 +0000 (22:50 -0600)]
remove the usize field from CandidateSource::AliasBound

16 months agoRemove from librustdoc and clippy too
Scott McMurray [Sat, 28 Jan 2023 04:02:51 +0000 (20:02 -0800)]
Remove from librustdoc and clippy too

16 months agoRollup merge of #107373 - michaelwoerister:dont-merge-vtables-when-debuginfo, r=Waffl...
Matthias Krüger [Sat, 28 Jan 2023 04:20:19 +0000 (05:20 +0100)]
Rollup merge of #107373 - michaelwoerister:dont-merge-vtables-when-debuginfo, r=WaffleLapkin

Don't merge vtables when full debuginfo is enabled.

This PR makes the compiler not emit the `unnamed_addr` attribute for vtables when full debuginfo is enabled, so that they don't get merged even if they have the same contents. This allows debuggers to more reliably map from a dyn pointer to the self-type of a trait object by looking at the vtable's debuginfo.

The PR only changes the behavior of the LLVM backend as other backends don't emit vtable debuginfo (as far as I can tell).

The performance impact of this change should be small as [measured](https://github.com/rust-lang/rust/pull/103514#issuecomment-1290833854) in a previous PR.

16 months agoRollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:19 +0000 (05:20 +0100)]
Rollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnr

Minor tweaks in the new solver

1. `InferCtxt::probe` is not needed in `compute_subtype_goal` and `compute_well_formed_goal`.
2. Add a handful of comments.
3. Add a micro-optimization in `consider_assumption` where we check the def-ids of the assumption and goal match before instantiating any binders.

r? ``@lcnr``

16 months agoRollup merge of #107339 - aliemjay:covariant, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:18 +0000 (05:20 +0100)]
Rollup merge of #107339 - aliemjay:covariant, r=lcnr

internally change regions to be covariant

Surprisingly, we consider the reference type `&'a T` to be contravaraint in its lifetime parameter. This is confusing and conflicts with the documentation we have in the reference, rustnomicon, and rustc-dev-guide. This also arguably not the correct use of terminology since we can use `&'static u8` in a place where `&' a u8` is expected, this implies that `&'static u8 <: &' a u8` and consequently `'static <: ' a`, hence covariance.

Because of this, when relating two types, we used to switch the argument positions in a confusing way:
`Subtype(&'a u8 <: &'b u8) => Subtype('b <: 'a) => Outlives('a: 'b) => RegionSubRegion('b <= 'a)`

The reason for the current behavior is probably that we wanted `Subtype('b <: 'a)` and `RegionSubRegion('b <= 'a)` to be equivalent, but I don' t think this is a good reason since these relations are sufficiently different in that the first is a relation in the subtyping lattice and is intrinsic to the type-systems, while the the second relation is an implementation detail of regionck.

This PR changes this behavior to use covariance, so..
`Subtype(&'a u8 <: &'b u8) => Subtype('a <: 'b) => Outlives('a: 'b) => RegionSubRegion('b <= 'a) `

Resolves #103676

r? `@lcnr`

16 months agoRollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow...
Matthias Krüger [Sat, 28 Jan 2023 04:20:18 +0000 (05:20 +0100)]
Rollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow, r=oli-obk

Correct suggestions for closure arguments that need a borrow

Fixes #107301 by dealing with binders correctly
Fixes another issue where we were suggesting adding just `&` when we expected `&mut _` in a closure arg

16 months agoRollup merge of #107190 - fmease:fix-81698, r=compiler-errors
Matthias Krüger [Sat, 28 Jan 2023 04:20:17 +0000 (05:20 +0100)]
Rollup merge of #107190 - fmease:fix-81698, r=compiler-errors

Recover from more const arguments that are not wrapped in curly braces

Recover from some array, borrow, tuple & arithmetic expressions in const argument positions that lack curly braces and provide a suggestion to fix the issue continuing where #92884 left off. Examples of such expressions: `[]`, `[0]`, `[1, 2]`, `[0; 0xff]`, `&9`, `("", 0)` and `(1 + 2) * 3` (we previously did not recover from them).

I am not entirely happy with my current solution because the code that recovers from `[0]` (coinciding with a malformed slice type) and `[0; 0]` (coinciding with a malformed array type) is quite fragile as the aforementioned snippets are actually successfully parsed as types by `parse_ty` since it itself already recovers from them (returning `[⟨error⟩]` and `[⟨error⟩; 0]` respectively) meaning I have to manually look for `TyKind::Err`s and construct a separate diagnostic for the suggestion to attach to (thereby emitting two diagnostics in total).

Fixes #81698.
`@rustbot` label A-diagnostics
r? diagnostics

16 months agoRollup merge of #107103 - compiler-errors:new-solver-evaluate_obligation, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:16 +0000 (05:20 +0100)]
Rollup merge of #107103 - compiler-errors:new-solver-evaluate_obligation, r=lcnr

Use new solver in `evaluate_obligation` query (when new solver is enabled)

(only when `-Ztrait-solver=next`, of course)

... Does this make sense? It seems to me like it should be reasonable, but maybe there's some reason why this is a bad idea.

r? ``@lcnr``

Needs a perf run because I guess this `solver == TraitSolver::Next` check is on a hot path.

16 months agoRollup merge of #107100 - compiler-errors:issue-107087, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:16 +0000 (05:20 +0100)]
Rollup merge of #107100 - compiler-errors:issue-107087, r=lcnr

Use proper `InferCtxt` when probing for associated types in astconv

Fixes #107087

16 months agoRollup merge of #107022 - scottmcm:ordering-option-eq, r=m-ou-se
Matthias Krüger [Sat, 28 Jan 2023 04:20:15 +0000 (05:20 +0100)]
Rollup merge of #107022 - scottmcm:ordering-option-eq, r=m-ou-se

Implement `SpecOptionPartialEq` for `cmp::Ordering`

Noticed as I continue to explore options for having code using `partial_cmp` optimize better.

Before:
```llvm
; Function Attrs: mustprogress nofree nosync nounwind willreturn uwtable
define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #0 {
start:
  %2 = icmp eq i8 %0, 2
  br i1 %2, label %bb1.i, label %bb3.i

bb1.i:                                            ; preds = %start
  %3 = icmp eq i8 %1, 2
  br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"

bb3.i:                                            ; preds = %start
  %.not.i = icmp ne i8 %1, 2
  %4 = icmp eq i8 %0, %1
  %spec.select.i = and i1 %.not.i, %4
  br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"

"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit": ; preds = %bb1.i, %bb3.i
  %.0.i = phi i1 [ %3, %bb1.i ], [ %spec.select.i, %bb3.i ]
  ret i1 %.0.i
}
```

After:
```llvm
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable
define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #1 {
start:
  %2 = icmp eq i8 %0, %1
  ret i1 %2
}
```

(Which <https://alive2.llvm.org/ce/z/-rop5r> says LLVM *could* just do itself, but there's probably an issue already open for that problem from when this was originally looked at for `Option<NonZeroU8>` and friends.)

16 months agoAuto merge of #107360 - bjorn3:fix_thin_archive_reading, r=wesleywiser
bors [Sat, 28 Jan 2023 04:02:25 +0000 (04:02 +0000)]
Auto merge of #107360 - bjorn3:fix_thin_archive_reading, r=wesleywiser

Fix thin archive reading

This includes a revert of https://github.com/rust-lang/rust/pull/105221 to restore fat archive reading with LlvmArchiveBuilder.

Should fix #107162, #107334 and https://github.com/google/shaderc-rs/issues/133

16 months agoRemove `ControlFlow::{BREAK, CONTINUE}`
Scott McMurray [Sat, 28 Jan 2023 03:46:42 +0000 (19:46 -0800)]
Remove `ControlFlow::{BREAK, CONTINUE}`

Libs-API decided to remove these in #102697.

Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged.

16 months agoLink to the LLVM issue from a comment on `SpecOptionPartialEq`
Scott McMurray [Sat, 28 Jan 2023 03:09:52 +0000 (19:09 -0800)]
Link to the LLVM issue from a comment on `SpecOptionPartialEq`

16 months agoAuto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obk
bors [Sat, 28 Jan 2023 01:05:29 +0000 (01:05 +0000)]
Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obk

Compute generator saved locals on MIR

Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type.  This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later.

This PR proposes to drop the HIR-based computation, and only keep the MIR one.  This is done in 3 steps.
1. During type-checking, the `witness` type variable is never unified.  This allows to stall all the obligations that depend on it until the end of type-checking.  Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification.
2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`.  From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do.  There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked.
3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query.  If any obligation was wrongly marked as fulfilled in step 1, it should be reported here.

There are still many issues:
- ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables.
- the diagnostics for captured types don't show where they are used/dropped;
- I do not attempt to support chalk.

cc `@eholk` `@jyn514` for the drop-tracking work
r? `@oli-obk` as you warned me of potential unsoundness

17 months agorustdoc: remove inline javascript from copy-path button
Michael Howell [Fri, 27 Jan 2023 21:23:28 +0000 (14:23 -0700)]
rustdoc: remove inline javascript from copy-path button

17 months agoBless mir-opt tests.
Camille GILLOT [Sat, 21 Jan 2023 14:26:44 +0000 (14:26 +0000)]
Bless mir-opt tests.

17 months agoPacify tidy.
Camille GILLOT [Sat, 21 Jan 2023 10:12:11 +0000 (10:12 +0000)]
Pacify tidy.

17 months agoRestrict amount of ignored locals.
Camille GILLOT [Sat, 21 Jan 2023 10:03:12 +0000 (10:03 +0000)]
Restrict amount of ignored locals.

17 months agoAuto merge of #107386 - flip1995:clippyup, r=Manishearth
bors [Fri, 27 Jan 2023 21:20:39 +0000 (21:20 +0000)]
Auto merge of #107386 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

17 months agoaddress review
b-naber [Fri, 27 Jan 2023 21:13:55 +0000 (22:13 +0100)]
address review

17 months agoBless ui-fulldeps.
Camille GILLOT [Sat, 1 Oct 2022 17:57:39 +0000 (19:57 +0200)]
Bless ui-fulldeps.

17 months agoBless tests.
Camille GILLOT [Thu, 26 Jan 2023 03:51:26 +0000 (03:51 +0000)]
Bless tests.

17 months agoCompute generator saved locals on MIR.
Camille GILLOT [Sat, 1 Oct 2022 13:57:22 +0000 (15:57 +0200)]
Compute generator saved locals on MIR.

17 months agoUpdate Cargo.lock
Philipp Krones [Fri, 27 Jan 2023 20:09:23 +0000 (21:09 +0100)]
Update Cargo.lock

17 months agoMerge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
Philipp Krones [Fri, 27 Jan 2023 20:09:08 +0000 (21:09 +0100)]
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup

17 months agoMicro-optimization in consider_assumption
Michael Goulet [Fri, 27 Jan 2023 04:32:12 +0000 (04:32 +0000)]
Micro-optimization in consider_assumption

17 months agoAdd some comments
Michael Goulet [Fri, 27 Jan 2023 04:31:51 +0000 (04:31 +0000)]
Add some comments

17 months agoNo need to probe when computing goals
Michael Goulet [Fri, 27 Jan 2023 04:00:37 +0000 (04:00 +0000)]
No need to probe when computing goals

17 months agoRemove unused import
nils [Fri, 27 Jan 2023 19:58:54 +0000 (20:58 +0100)]
Remove unused import

17 months agoAuto merge of #10242 - flip1995:rustup, r=flip1995
bors [Fri, 27 Jan 2023 19:31:37 +0000 (19:31 +0000)]
Auto merge of #10242 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

17 months agoyeet
Boxy [Fri, 27 Jan 2023 19:29:04 +0000 (19:29 +0000)]
yeet

17 months agoBump Clippy version -> 0.1.69
Philipp Krones [Fri, 27 Jan 2023 19:27:00 +0000 (20:27 +0100)]
Bump Clippy version -> 0.1.69

17 months agoBump nightly version -> 2023-01-27
Philipp Krones [Fri, 27 Jan 2023 19:26:48 +0000 (20:26 +0100)]
Bump nightly version -> 2023-01-27

17 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Fri, 27 Jan 2023 19:21:37 +0000 (20:21 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

17 months agoRemove `BOOL_TY_FOR_UNIT_TESTING`
Nilstrieb [Fri, 27 Jan 2023 19:22:54 +0000 (20:22 +0100)]
Remove `BOOL_TY_FOR_UNIT_TESTING`

It is not used anymore for unit testing.

17 months agoSeparate witness type computation from the generator transform.
Camille GILLOT [Tue, 26 Jul 2022 18:37:25 +0000 (20:37 +0200)]
Separate witness type computation from the generator transform.

17 months agoRemember where a type was kept in MIR.
Camille GILLOT [Sun, 11 Sep 2022 15:24:53 +0000 (17:24 +0200)]
Remember where a type was kept in MIR.

17 months agoIntroduce GeneratorWitnessMIR.
Camille GILLOT [Sat, 1 Oct 2022 12:56:24 +0000 (14:56 +0200)]
Introduce GeneratorWitnessMIR.

17 months agoAlways require Drop for generators.
Camille GILLOT [Sun, 11 Sep 2022 15:22:38 +0000 (17:22 +0200)]
Always require Drop for generators.

17 months agoTest the 3 generator handling versions for generator/async tests.
Camille GILLOT [Sat, 1 Oct 2022 10:19:31 +0000 (12:19 +0200)]
Test the 3 generator handling versions for generator/async tests.

17 months agoAdd `drop_tracking_mir` option.
Camille GILLOT [Sat, 1 Oct 2022 09:33:16 +0000 (11:33 +0200)]
Add `drop_tracking_mir` option.

17 months agoSeparate trait selection from ambiguity reporting.
Camille GILLOT [Wed, 28 Sep 2022 16:16:23 +0000 (18:16 +0200)]
Separate trait selection from ambiguity reporting.

17 months agoImpl HashStable/Encodable/Decodable for ObligationCause.
Camille GILLOT [Sun, 11 Sep 2022 12:42:43 +0000 (14:42 +0200)]
Impl HashStable/Encodable/Decodable for ObligationCause.

17 months agoDo not abort compilation when failing to normalize opaque types.
Camille GILLOT [Sun, 11 Sep 2022 09:22:47 +0000 (11:22 +0200)]
Do not abort compilation when failing to normalize opaque types.