]> git.lizzy.rs Git - rust.git/log
rust.git
16 months agoAuto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgr
bors [Thu, 26 Jan 2023 09:14:05 +0000 (09:14 +0000)]
Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #97373 (impl DispatchFromDyn for Cell and UnsafeCell)
 - #106625 (Remove backwards compat for LLVM 12 coverage format)
 - #106779 (Avoid __cxa_thread_atexit_impl on Emscripten)
 - #106811 (Append .dwp to the binary filename instead of replacing the existing extension.)
 - #106836 (Remove optimistic spinning from `mpsc::SyncSender`)
 - #106946 (implement Hash for proc_macro::LineColumn)
 - #107074 (remove unnecessary check for opaque types)
 - #107287 (Improve fn pointer notes)
 - #107304 (Use `can_eq` to compare types for default assoc type error)

Failed merges:

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

16 months agoRollup merge of #107304 - Nilstrieb:ᐸTy as PartialEqᐳ::eq because what else are we...
Matthias Krüger [Thu, 26 Jan 2023 06:53:26 +0000 (07:53 +0100)]
Rollup merge of #107304 - Nilstrieb:ᐸTy as PartialEqᐳ::eq because what else are we gonna use in rustc_middle, r=compiler-errors

Use `can_eq` to compare types for default assoc type error

This correctly handles inference variables like `{integer}`. I had to move all of this `note_and_explain` code to `rustc_infer`, it made no sense for it to be in `rustc_middle` anyways.

The commits are reviewed separately.

Fixes #106968

16 months agoRollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 06:53:25 +0000 (07:53 +0100)]
Rollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=compiler-errors

Improve fn pointer notes

continuation of #105552

r? `@compiler-errors`

16 months agoRollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 06:53:25 +0000 (07:53 +0100)]
Rollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-errors

remove unnecessary check for opaque types

this isn't needed and may hide some errors.

after analysis there are no opaque types so it's a noop anyways

before analysis there are opaque types but due to `Reveal::UserFacing` we don't reveal them. `is_subtype` simply discards the opaque type constraints as these will get checked again during mir borrowck.

r? types

want to land this after the beta-cutoff as mir validator changes are apparently pretty scary

16 months agoRollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
Matthias Krüger [Thu, 26 Jan 2023 06:53:24 +0000 (07:53 +0100)]
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se

implement Hash for proc_macro::LineColumn

For use in `HashMap<LineColumn, TokenTree>` or `HashMap<LineColumn, Comment>`, for example.

[Here is an example of one case complicated by the absence of this impl.](https://github.com/andrewbaxter/genemichaels/blob/71bc45e417c3f9dae09f890f1ec4630e758e5c70/src/comments.rs#L25-L34)

Tracking issue: https://github.com/rust-lang/rust/issues/54725

16 months agoRollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu
Matthias Krüger [Thu, 26 Jan 2023 06:53:23 +0000 (07:53 +0100)]
Rollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu

Remove optimistic spinning from `mpsc::SyncSender`

Per https://github.com/rust-lang/rust/pull/106701#issuecomment-1381649679.
Closes #106804

r? `@Amanieu`

16 months agoRollup merge of #106811 - khuey:dwp_extension, r=davidtwco
Matthias Krüger [Thu, 26 Jan 2023 06:53:23 +0000 (07:53 +0100)]
Rollup merge of #106811 - khuey:dwp_extension, r=davidtwco

Append .dwp to the binary filename instead of replacing the existing extension.

gdb et al. expect to find the dwp file at `<binary>`.dwp, even if <binary> already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).

16 months agoRollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
Matthias Krüger [Thu, 26 Jan 2023 06:53:22 +0000 (07:53 +0100)]
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum

Avoid __cxa_thread_atexit_impl on Emscripten

 - Fixes https://github.com/rust-lang/rust/issues/91628.
 - Fixes https://github.com/emscripten-core/emscripten/issues/15722.

See discussion in both issues.

The TL;DR is that weak linkage causes LLVM to produce broken Wasm, presumably due to pointer mismatch. The code is casting a void pointer to a function pointer with specific signature, but Wasm is very strict about function pointer compatibility, so the resulting code is invalid.

Ideally LLVM should catch this earlier in the process rather than emit invalid Wasm, but it currently doesn't and this is an easy and valid fix, given that Emcripten doesn't have `__cxa_thread_atexit_impl` these days anyway.

Unfortunately, I can't add a regression test as even after looking into this issue for a long time, I couldn't reproduce it with any minimal Rust example, only with extracted LLVM IR or on a large project involving Rust + C++.

16 months agoRollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
Matthias Krüger [Thu, 26 Jan 2023 06:53:22 +0000 (07:53 +0100)]
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa

Remove backwards compat for LLVM 12 coverage format

The minimum external LLVM was updated to 13 recently in https://github.com/rust-lang/rust/pull/100611, so this PR removes backwards compat with older coverage formats.

I kept the version check and error message there, in accordance with this comment: https://github.com/rust-lang/rust/pull/91207#issuecomment-981121867

16 months agoRollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnay
Matthias Krüger [Thu, 26 Jan 2023 06:53:21 +0000 (07:53 +0100)]
Rollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnay

impl DispatchFromDyn for Cell and UnsafeCell

After some fruitful discussion on [Internals](https://internals.rust-lang.org/t/impl-dispatchfromdyn-for-cell-2/16520) here's my first PR to rust-lang/rust 🎉

Please let me know if there's something I missed.

This adds `DispatchFromDyn` impls for `Cell`, `UnsafeCell` and `SyncUnsafeCell`.
An existing test is also expanded to test the `Cell` impl (which requires the `UnsafeCell` impl)

The different `RefCell` types can not implement `DispatchFromDyn` since they have more than one (non ZST) field.

&nbsp;

**Edit:**
### What:
These changes allow one to make types like `MyRc`(code below), to be object safe method receivers after implementing `DispatchFromDyn` and `Deref` for them.

This allows for code like this:
```rust
struct MyRc<T: ?Sized>(Cell<NonNull<RcBox<T>>>);

/* impls for DispatchFromDyn, CoerceUnsized and Deref for MyRc*/

trait Trait {
    fn foo(self: MyRc<Self>);
}

let impls_trait = ...;
let rc = MyRc::new(impls_trait) as MyRc<dyn Trait>;
rc.foo();
```

Note: `Cell` and `UnsafeCell` won't directly become valid method receivers since they don't implement `Deref`. Making use of these changes requires a wrapper type and nightly features.

### Why:
A custom pointer type with interior mutability allows one to store extra information in the pointer itself.
These changes allow for such a type to be a method receiver.

### Examples:
My use case is a cycle aware custom `Rc` implementation that when dropping a cycle marks some references dangling.

On the [forum](https://internals.rust-lang.org/t/impl-dispatchfromdyn-for-cell/14762/8) andersk mentioned that they track if a `Gc` reference is rooted with an extra bit in the reference itself.

16 months agoAuto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgr
bors [Thu, 26 Jan 2023 06:23:14 +0000 (06:23 +0000)]
Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #106407 (Improve proc macro attribute diagnostics)
 - #106960 (Teach parser to understand fake anonymous enum syntax)
 - #107085 (Custom MIR: Support binary and unary operations)
 - #107086 (Print PID holding bootstrap build lock on Linux)
 - #107175 (Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`)
 - #107204 (suggest qualifying bare associated constants)
 - #107248 (abi: add AddressSpace field to Primitive::Pointer )
 - #107272 (Implement ObjectSafe and WF in the new solver)
 - #107285 (Implement `Generator` and `Future` in the new solver)
 - #107286 (ICE in new solver if we see an inference variable)
 - #107313 (Add Style Team Triagebot config)

Failed merges:

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

16 months agoRollup merge of #107313 - calebcartwright:style-guide-triagebot, r=joshtriplett
Matthias Krüger [Thu, 26 Jan 2023 05:15:29 +0000 (06:15 +0100)]
Rollup merge of #107313 - calebcartwright:style-guide-triagebot, r=joshtriplett

Add Style Team Triagebot config

16 months agoRollup merge of #107286 - compiler-errors:new-solver-deny-infers, r=lcnr
Matthias Krüger [Thu, 26 Jan 2023 05:15:29 +0000 (06:15 +0100)]
Rollup merge of #107286 - compiler-errors:new-solver-deny-infers, r=lcnr

ICE in new solver if we see an inference variable

By construction, we do not expect to see any `ty::Infer(ty::TyVar(_))` inference types in the solver (we treat this as ambiguous, since we need to be able to structurally resolve the self type at least one layer to assemble candidates for it). Additionally, since we're doing no freshening, we also don't expect to see any fresh vars of any kind in the solver.

Let's make that an ICE so we can catch any mistakes.

When #107282 lands, we should also ICE there too if we see a non-int/float infer.

r? `@lcnr`

16 months agoRollup merge of #107285 - compiler-errors:new-solver-future-and-generator, r=lcnr
Matthias Krüger [Thu, 26 Jan 2023 05:15:28 +0000 (06:15 +0100)]
Rollup merge of #107285 - compiler-errors:new-solver-future-and-generator, r=lcnr

Implement `Generator` and `Future` in the new solver

r? `@lcnr`

16 months agoRollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnr
Matthias Krüger [Thu, 26 Jan 2023 05:15:27 +0000 (06:15 +0100)]
Rollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnr

Implement ObjectSafe and WF in the new solver

r? ``@lcnr``

16 months agoRollup merge of #107248 - erikdesjardins:addrspace, r=oli-obk
Matthias Krüger [Thu, 26 Jan 2023 05:15:27 +0000 (06:15 +0100)]
Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obk

abi: add AddressSpace field to Primitive::Pointer

...and remove it from `PointeeInfo`, which isn't meant for this.

There are still various places (marked with FIXMEs) that assume all pointers
have the same size and alignment. Fixing this requires parsing non-default
address spaces in the data layout string (and various other changes),
which will be done in a followup.
(That is, if it's actually worth it to support multiple different pointer sizes.
There is a lot of code that would be affected by that.)

Fixes #106367

r? ``@oli-obk``
cc ``@Patryk27``

16 months agoRollup merge of #107204 - euclio:assoc-const-suggestion, r=petrochenkov
Matthias Krüger [Thu, 26 Jan 2023 05:15:26 +0000 (06:15 +0100)]
Rollup merge of #107204 - euclio:assoc-const-suggestion, r=petrochenkov

suggest qualifying bare associated constants

Fixes #107199.

16 months agoRollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebank
Matthias Krüger [Thu, 26 Jan 2023 05:15:26 +0000 (06:15 +0100)]
Rollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebank

Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`

Fixes #107158

`point_at_expr_source_of_inferred_type` uses `lookup_probe` to adjust the self type of a method receiver -- but that method returns inference variables from inside a probe. That means that the ty vars are no longer valid, so we can't use any infcx methods on them.

Also, pass some extra span info to hack a quick solution to bad labels, resulting in this diagnostic improvement:

```rust
fn example2() {
    let mut x = vec![1];
    x.push("");
}
```

```diff
  error[E0308]: mismatched types
   --> src/main.rs:5:12
    |
  5 |     x.push("");
    |       ---- ^^
    |       |    |
    |       |    expected integer, found `&str`
-   |       |    this is of type `&'static str`, which causes `x` to be inferred as `Vec<{integer}>`
    |       arguments to this method are incorrect
```
(since that "which causes `x` to be inferred as `Vec<{integer}>` part is wrong)

r? `@estebank`

(we really should make this code better in general, cc #106590, but that's a bit bigger issue that needs some more thinking about)

16 months agoRollup merge of #107086 - clubby789:bootstrap-lock-pid-linux, r=albertlarsan68
Matthias Krüger [Thu, 26 Jan 2023 05:15:25 +0000 (06:15 +0100)]
Rollup merge of #107086 - clubby789:bootstrap-lock-pid-linux, r=albertlarsan68

Print PID holding bootstrap build lock on Linux

Partially address #107077

Parse `/proc/locks` to find the PID of the process which created the build directory lock

16 months agoRollup merge of #107085 - tmiasko:custom-mir-operators, r=oli-obk
Matthias Krüger [Thu, 26 Jan 2023 05:15:24 +0000 (06:15 +0100)]
Rollup merge of #107085 - tmiasko:custom-mir-operators, r=oli-obk

Custom MIR: Support binary and unary operations

Lower binary and unary operations directly to corresponding unchecked MIR
operations. Ultimately this might not be syntax we want, but it allows for
experimentation in the meantime.

r? ````@oli-obk```` ````@JakobDegen````

16 months agoRollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot
Matthias Krüger [Thu, 26 Jan 2023 05:15:24 +0000 (06:15 +0100)]
Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot

Teach parser to understand fake anonymous enum syntax

Parse `Ty | OtherTy` in function argument and return types.
Parse type ascription in top level patterns.

Minimally address #100741.

16 months agoRollup merge of #106407 - mejrs:attr_check, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 05:15:23 +0000 (06:15 +0100)]
Rollup merge of #106407 - mejrs:attr_check, r=compiler-errors

Improve proc macro attribute diagnostics

Closes https://github.com/rust-lang/rust/issues/102923

16 months agoimprove fn pointer notes
Matthew J Perez [Wed, 25 Jan 2023 17:10:26 +0000 (17:10 +0000)]
improve fn pointer notes

- add note and suggestion for casting both expected and found fn items
  to fn pointers
- add note for casting expected fn item to fn pointer

16 months agoICE in new solver if we see an inference variable
Michael Goulet [Wed, 25 Jan 2023 00:38:34 +0000 (00:38 +0000)]
ICE in new solver if we see an inference variable

16 months agoImplement Generator and Future
Michael Goulet [Tue, 24 Jan 2023 23:38:20 +0000 (23:38 +0000)]
Implement Generator and Future

16 months agoReport the right fulfillment errors
Michael Goulet [Tue, 24 Jan 2023 23:57:26 +0000 (23:57 +0000)]
Report the right fulfillment errors

16 months agoAuto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot
bors [Thu, 26 Jan 2023 03:10:52 +0000 (03:10 +0000)]
Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot

InstCombine away intrinsic validity assertions

This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.

16 months agoadd style team triagebot config
Caleb Cartwright [Thu, 26 Jan 2023 01:58:22 +0000 (19:58 -0600)]
add style team triagebot config

16 months agoAuto merge of #107309 - matthiaskrgr:rollup-0wgq6be, r=matthiaskrgr
bors [Wed, 25 Jan 2023 23:39:51 +0000 (23:39 +0000)]
Auto merge of #107309 - matthiaskrgr:rollup-0wgq6be, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #105345 (Add hint for missing lifetime bound on trait object when type alias is used)
 - #106897 (Tweak E0597)
 - #106944 (Suggest using a lock for `*Cell: Sync` bounds)
 - #107239 (Bring tests back into rustc source tarball)
 - #107244 (rustdoc: rearrange HTML in primitive reference links)
 - #107255 (add test where we ignore hr implied bounds)
 - #107256 (Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts)
 - #107266 (rustdoc: prohibit scroll bar on source viewer in Safari)
 - #107282 (erica solver: implement builtin `Pointee` trait impl candidates)

Failed merges:

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

16 months agoDon't normalize obligations in WF goal for the new solver
Michael Goulet [Tue, 24 Jan 2023 19:10:56 +0000 (19:10 +0000)]
Don't normalize obligations in WF goal for the new solver

16 months agoImplement ObjectSafe and WF in the new solver
Michael Goulet [Tue, 24 Jan 2023 18:48:15 +0000 (18:48 +0000)]
Implement ObjectSafe and WF in the new solver

16 months agoRollup merge of #107282 - BoxyUwU:erica_builtin_pointee_impls, r=compiler-errors
Matthias Krüger [Wed, 25 Jan 2023 21:19:56 +0000 (22:19 +0100)]
Rollup merge of #107282 - BoxyUwU:erica_builtin_pointee_impls, r=compiler-errors

erica solver: implement builtin `Pointee` trait impl candidates

r? ```@compiler-errors```

16 months agoRollup merge of #107266 - kadiwa4:source_viewer_scrollbar, r=notriddle
Matthias Krüger [Wed, 25 Jan 2023 21:19:55 +0000 (22:19 +0100)]
Rollup merge of #107266 - kadiwa4:source_viewer_scrollbar, r=notriddle

rustdoc: prohibit scroll bar on source viewer in Safari

Fixes #106455.

16 months agoRollup merge of #107256 - JakobDegen:delete-sai, r=cjgillot
Matthias Krüger [Wed, 25 Jan 2023 21:19:55 +0000 (22:19 +0100)]
Rollup merge of #107256 - JakobDegen:delete-sai, r=cjgillot

Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts

I had attempted to fix the first of these opts in #94177 . However, despite that PR already being a full re-write, it still did not fix some of the core soundness issues. The optimizations that are attempted here are likely to be desirable, but I do not expect any of the currently written code to survive into a sound implementation. Deleting the code keeps us from having to maintain the passes in the meantime.

Closes #77359 , closes #72800 , closes #78628

r? ```@cjgillot```

16 months agoRollup merge of #107255 - lcnr:implied-b-hr, r=oli-obk
Matthias Krüger [Wed, 25 Jan 2023 21:19:54 +0000 (22:19 +0100)]
Rollup merge of #107255 - lcnr:implied-b-hr, r=oli-obk

add test where we ignore hr implied bounds

r? types

16 months agoRollup merge of #107244 - notriddle:notriddle/primitive-reference-link, r=GuillaumeGomez
Matthias Krüger [Wed, 25 Jan 2023 21:19:53 +0000 (22:19 +0100)]
Rollup merge of #107244 - notriddle:notriddle/primitive-reference-link, r=GuillaumeGomez

rustdoc: rearrange HTML in primitive reference links

This patch avoids hard-to-click single character links by making the generic part of the link:

Before: <a href="#">&</a>T

After: <a href="#">&T</a>

16 months agoRollup merge of #107239 - tmiasko:tests, r=Mark-Simulacrum
Matthias Krüger [Wed, 25 Jan 2023 21:19:53 +0000 (22:19 +0100)]
Rollup merge of #107239 - tmiasko:tests, r=Mark-Simulacrum

Bring tests back into rustc source tarball

They were missing after recent move from src/test to tests.

cc ```@albertlarsan68```

Fixes #107081

16 months agoRollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkin
Matthias Krüger [Wed, 25 Jan 2023 21:19:52 +0000 (22:19 +0100)]
Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkin

Suggest using a lock for `*Cell: Sync` bounds

I mostly did this for `OnceCell<T>` at first because users will be confused to see that the `OnceCell<T>` in `std` isn't `Sync` but then extended it to `Cell<T>` and `RefCell<T>` as well.

16 months agoRollup merge of #106897 - estebank:issue-99430, r=davidtwco
Matthias Krüger [Wed, 25 Jan 2023 21:19:52 +0000 (22:19 +0100)]
Rollup merge of #106897 - estebank:issue-99430, r=davidtwco

Tweak E0597

CC #99430

16 months agoRollup merge of #105345 - yanchen4791:issue-103582-fix, r=jackh726
Matthias Krüger [Wed, 25 Jan 2023 21:19:51 +0000 (22:19 +0100)]
Rollup merge of #105345 - yanchen4791:issue-103582-fix, r=jackh726

Add hint for missing lifetime bound on trait object when type alias is used

Fix issue #103582.

The problem: When a type alias is used to specify the return type of the method in a trait impl, the suggestion for fixing the problem of "missing lifetime bound on trait object" of the trait impl will not be created. The issue caused by the code which searches for the return trait objects when constructing the hint suggestion is not able to find the trait objects since they are specified in the type alias path instead of the return path of the trait impl.

The solution: Trace the trait objects in the type alias path and provide them along with the alias span to generate the suggestion in case the type alias is used in return type of the method in the trait impl.

16 months agoAuto merge of #107142 - cuviper:relnotes-1.67, r=Mark-Simulacrum
bors [Wed, 25 Jan 2023 20:59:10 +0000 (20:59 +0000)]
Auto merge of #107142 - cuviper:relnotes-1.67, r=Mark-Simulacrum

Release notes for 1.67.0

r? `@Mark-Simulacrum`
cc `@rust-lang/release`

16 months agoUse `can_eq` to compare types for default assoc type error
Nilstrieb [Wed, 25 Jan 2023 19:11:05 +0000 (20:11 +0100)]
Use `can_eq` to compare types for default assoc type error

This works correctly with inference variables.

16 months agoMove `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`
Nilstrieb [Wed, 25 Jan 2023 18:53:03 +0000 (19:53 +0100)]
Move `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`

This way we can properly deal with the types.

16 months agoAuto merge of #103902 - vincenzopalazzo:macros/obligation_rulesv2, r=oli-obk
bors [Wed, 25 Jan 2023 16:39:29 +0000 (16:39 +0000)]
Auto merge of #103902 - vincenzopalazzo:macros/obligation_rulesv2, r=oli-obk

use `LocalDefId` instead of `HirId` in trait resolution to simplify the obligation clause resolution

This commit introduces a refactoring suggested by `@lcnr` to simplify the obligation clause resolution.

This is just the first PR that introduces a type of refactoring, but others PRs will follow this to introduce name changing to change from the variable name from `body_id` to something else.

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

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
`@rustbot` r? `@lcnr`

16 months agoAuto merge of #107290 - Dylan-DPC:rollup-tovojhr, r=Dylan-DPC
bors [Wed, 25 Jan 2023 13:58:41 +0000 (13:58 +0000)]
Auto merge of #107290 - Dylan-DPC:rollup-tovojhr, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #105552 (Add help message about function pointers)
 - #106583 (Suggest coercion of `Result` using `?`)
 - #106767 (Allow setting CFG_DISABLE_UNSTABLE_FEATURES to 0)
 - #106823 (Allow fmt::Arguments::as_str() to return more Some(_).)
 - #107166 (rustc_metadata: Support non-`Option` nullable values in metadata tables)
 - #107213 (Add suggestion to remove if in let..else block)
 - #107223 (`sub_ptr()` is equivalent to `usize::try_from().unwrap_unchecked()`, not `usize::from().unwrap_unchecked()`)
 - #107227 (`new_outside_solver` ->  `evaluate_root_goal`)
 - #107232 (rustdoc: simplify settings popover DOM, CSS, JS)

Failed merges:

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

16 months agosuggest qualifying bare associated constants
Andy Russell [Sun, 22 Jan 2023 17:06:23 +0000 (12:06 -0500)]
suggest qualifying bare associated constants

16 months agoRollup merge of #107232 - notriddle:notriddle/settings-choice, r=GuillaumeGomez
Dylan DPC [Wed, 25 Jan 2023 11:31:44 +0000 (17:01 +0530)]
Rollup merge of #107232 - notriddle:notriddle/settings-choice, r=GuillaumeGomez

rustdoc: simplify settings popover DOM, CSS, JS

* Change the class names so that they all start with `setting-`. That should make it harder to accidentally use a setting class outside the settings popover, where loading the CSS might accidentally change the styles of something unrelated.
* Get rid of an unnecessary wrapper DIV around the radio button line.
* Simplify CSS selectors by making the DOM easier and more intuitive to target.
* Remove dead settings JS for obsolete select-wrapper

16 months agoRollup merge of #107227 - lcnr:solver-new-external-api, r=compiler-errors
Dylan DPC [Wed, 25 Jan 2023 11:31:44 +0000 (17:01 +0530)]
Rollup merge of #107227 - lcnr:solver-new-external-api, r=compiler-errors

`new_outside_solver` ->  `evaluate_root_goal`

r? ```@rust-lang/initiative-trait-system-refactor```

16 months agoRollup merge of #107223 - ChayimFriedman2:patch-5, r=WaffleLapkin
Dylan DPC [Wed, 25 Jan 2023 11:31:43 +0000 (17:01 +0530)]
Rollup merge of #107223 - ChayimFriedman2:patch-5, r=WaffleLapkin

`sub_ptr()` is equivalent to `usize::try_from().unwrap_unchecked()`, not `usize::from().unwrap_unchecked()`

`usize::from()` gives a `usize`, not `Result<usize>`, and `usize: From<isize>` is not implemented.

16 months agoRollup merge of #107213 - edward-shen:edward-shen/fix-accidental-let-else, r=compiler...
Dylan DPC [Wed, 25 Jan 2023 11:31:43 +0000 (17:01 +0530)]
Rollup merge of #107213 - edward-shen:edward-shen/fix-accidental-let-else, r=compiler-errors

Add suggestion to remove if in let..else block

Adds an additional hint to failures where we encounter an else keyword while we're parsing an if-let expression.

This is likely that the user has accidentally mixed if-let and let..else together.

Fixes #103791.

16 months agoRollup merge of #107166 - petrochenkov:nooptable, r=oli-obk
Dylan DPC [Wed, 25 Jan 2023 11:31:42 +0000 (17:01 +0530)]
Rollup merge of #107166 - petrochenkov:nooptable, r=oli-obk

rustc_metadata: Support non-`Option` nullable values in metadata tables

This is a convenience feature for cases in which "no value in the table" and "default value in the table" are equivalent.
Tables using `Table<DefIndex, ()>` are migrated in this PR, some other cases can be migrated later.
This helps `DocFlags` in https://github.com/rust-lang/rust/pull/107136 in particular.

16 months agoRollup merge of #106823 - m-ou-se:format-args-as-str-guarantees, r=dtolnay
Dylan DPC [Wed, 25 Jan 2023 11:31:42 +0000 (17:01 +0530)]
Rollup merge of #106823 - m-ou-se:format-args-as-str-guarantees, r=dtolnay

Allow fmt::Arguments::as_str() to return more Some(_).

This adjusts the documentation to allow optimization of format_args!() to be visible through fmt::Arguments::as_str().

This allows for future changes like https://github.com/rust-lang/rust/pull/106824.

16 months agoRollup merge of #106767 - chbaker0:disable-unstable-features, r=Mark-Simulacrum
Dylan DPC [Wed, 25 Jan 2023 11:31:41 +0000 (17:01 +0530)]
Rollup merge of #106767 - chbaker0:disable-unstable-features, r=Mark-Simulacrum

Allow setting CFG_DISABLE_UNSTABLE_FEATURES to 0

Two locations check whether this build-time environment variable is defined. Allowing it to be explicitly disabled with a "0" value is useful, especially for integrating with external build systems.

16 months agoRollup merge of #106583 - estebank:suggest-result-coercion, r=compiler-errors
Dylan DPC [Wed, 25 Jan 2023 11:31:40 +0000 (17:01 +0530)]
Rollup merge of #106583 - estebank:suggest-result-coercion, r=compiler-errors

Suggest coercion of `Result` using `?`

Fix #47560.

16 months agoRollup merge of #105552 - mattjperez:add-incompatible-types-note, r=compiler-errors
Dylan DPC [Wed, 25 Jan 2023 11:31:40 +0000 (17:01 +0530)]
Rollup merge of #105552 - mattjperez:add-incompatible-types-note, r=compiler-errors

Add help message about function pointers

#102608

16 months agoAuto merge of #107277 - weihanglo:update-cargo, r=weihanglo
bors [Wed, 25 Jan 2023 10:27:52 +0000 (10:27 +0000)]
Auto merge of #107277 - weihanglo:update-cargo, r=weihanglo

Update cargo

11 commits in 985d561f0bb9b76ec043a2b12511790ec7a2b954..3c5af6bed9a1a243a693e8e22ee2486bd5b82a6c 2023-01-20 14:39:28 +0000 to 2023-01-24 15:48:15 +0000

- Add a note about verifying your email address on crates.io (rust-lang/cargo#11620)
- Improve CI caching by skipping mtime checks for paths in $CARGO_HOME (rust-lang/cargo#11613)
- test: Update for clap 4.1.3 (rust-lang/cargo#11619)
- Fix unused attribute on Windows. (rust-lang/cargo#11614)
- [Doc]: Added links to the `Target` section of the glossary for occurences of `target triple` (rust-lang/cargo#11603)
- feat: stabilize auto fix note (rust-lang/cargo#11558)
- Clarify the difference between CARGO_CRATE_NAME and CARGO_PKG_NAME (rust-lang/cargo#11576)
- Temporarily pin libgit2-sys. (rust-lang/cargo#11609)
- Disable network SSH tests on windows. (rust-lang/cargo#11610)
- fix(toml): Add `default-features` to `TomlWorkspaceDependency` (rust-lang/cargo#11409)
- doc(contrib): remove rls in release process (rust-lang/cargo#11601)

r? `@ghost`

16 months agocreate and use GlobalAlloc::address_space
Erik Desjardins [Wed, 25 Jan 2023 06:46:19 +0000 (01:46 -0500)]
create and use GlobalAlloc::address_space

16 months agoAuto merge of #107275 - calebcartwright:sync-from-rustfmt, r=calebcartwright
bors [Wed, 25 Jan 2023 04:49:08 +0000 (04:49 +0000)]
Auto merge of #107275 - calebcartwright:sync-from-rustfmt, r=calebcartwright

Sync rustfmt subtree

16 months agono without_constness
Boxy [Tue, 24 Jan 2023 23:32:47 +0000 (23:32 +0000)]
no without_constness

16 months agosorry erica
Boxy [Tue, 24 Jan 2023 23:29:02 +0000 (23:29 +0000)]
sorry erica

16 months agoimplement builtin candidate
Boxy [Tue, 24 Jan 2023 23:24:25 +0000 (23:24 +0000)]
implement builtin candidate

16 months agoUpdate cargo
Weihang Lo [Tue, 24 Jan 2023 20:34:33 +0000 (20:34 +0000)]
Update cargo

11 commits in 985d561f0bb9b76ec043a2b12511790ec7a2b954..3c5af6bed9a1a243a693e8e22ee2486bd5b82a6c
2023-01-20 14:39:28 +0000 to 2023-01-24 15:48:15 +0000

- Add a note about verifying your email address on crates.io (rust-lang/cargo#11620)
- Improve CI caching by skipping mtime checks for paths in $CARGO_HOME (rust-lang/cargo#11613)
- test: Update for clap 4.1.3 (rust-lang/cargo#11619)
- Fix unused attribute on Windows. (rust-lang/cargo#11614)
- [Doc]: Added links to the `Target` section of the glossary for occurences of `target triple` (rust-lang/cargo#11603)
- feat: stabilize auto fix note (rust-lang/cargo#11558)
- Clarify the difference between CARGO_CRATE_NAME and CARGO_PKG_NAME (rust-lang/cargo#11576)
- Temporarily pin libgit2-sys. (rust-lang/cargo#11609)
- Disable network SSH tests on windows. (rust-lang/cargo#11610)
- fix(toml): Add `default-features` to `TomlWorkspaceDependency` (rust-lang/cargo#11409)
- doc(contrib): remove rls in release process (rust-lang/cargo#11601)

16 months agoupdate rustfmt subtree version in lockfile
Caleb Cartwright [Tue, 24 Jan 2023 20:21:14 +0000 (14:21 -0600)]
update rustfmt subtree version in lockfile

16 months agoMerge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt
Caleb Cartwright [Tue, 24 Jan 2023 20:16:03 +0000 (14:16 -0600)]
Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt

16 months agochore: prep v1.5.2 release
Caleb Cartwright [Tue, 24 Jan 2023 19:08:52 +0000 (13:08 -0600)]
chore: prep v1.5.2 release

16 months agoAdd suggestions for function pointers
Matthew J Perez [Sun, 11 Dec 2022 07:49:07 +0000 (02:49 -0500)]
Add suggestions for function pointers

- On compiler-error's suggestion of moving this lower down the stack,
along the path of `report_mismatched_types()`, which is used
by `rustc_hir_analysis` and `rustc_hir_typeck`.
- update ui tests, add test
- add suggestions for references to fn pointers
- modify `TypeErrCtxt::same_type_modulo_infer` to take `T: relate::Relate` instead of `Ty`

16 months agofix: version gate changes for multiline single generic bound
Caleb Cartwright [Tue, 24 Jan 2023 17:13:54 +0000 (11:13 -0600)]
fix: version gate changes for multiline single generic bound

16 months agorustdoc: prevent scroll bar on source viewer
KaDiWa [Tue, 24 Jan 2023 15:46:45 +0000 (16:46 +0100)]
rustdoc: prevent scroll bar on source viewer

16 months agoadd feature gate tests for DispatchFromDyn
dimi [Wed, 26 Oct 2022 12:40:03 +0000 (14:40 +0200)]
add feature gate tests for DispatchFromDyn

16 months agoDelete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts
Jakob Degen [Tue, 24 Jan 2023 12:13:52 +0000 (04:13 -0800)]
Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts

16 months agoadd test where we ignore hr implied bounds
lcnr [Tue, 24 Jan 2023 11:41:18 +0000 (12:41 +0100)]
add test where we ignore hr implied bounds

16 months agoimpl DispatchFromDyn for Cell and UnsafeCell
dimi [Tue, 24 May 2022 21:56:19 +0000 (23:56 +0200)]
impl DispatchFromDyn for Cell and UnsafeCell

16 months agoAdd suggestion to remove if in let...else block
Edward Shen [Tue, 24 Jan 2023 04:31:45 +0000 (20:31 -0800)]
Add suggestion to remove if in let...else block

Adds an additional hint to failures where we encounter an else keyword
while we're parsing an if-let block.

This is likely that the user has accidentally mixed if-let and let...else
together.

16 months agoMerge pull request #5670 from calebcartwright/subtree-sync-2023-01-24
Caleb Cartwright [Tue, 24 Jan 2023 04:13:01 +0000 (22:13 -0600)]
Merge pull request #5670 from calebcartwright/subtree-sync-2023-01-24

Subtree sync 2023-01-24

16 months agochore: bump toolchain
Caleb Cartwright [Tue, 24 Jan 2023 03:44:03 +0000 (21:44 -0600)]
chore: bump toolchain

16 months agoMerge remote-tracking branch 'upstream/master' into subtree-sync-2023-01-24
Caleb Cartwright [Tue, 24 Jan 2023 03:19:31 +0000 (21:19 -0600)]
Merge remote-tracking branch 'upstream/master' into subtree-sync-2023-01-24

16 months agorustdoc: rearrange HTML in primitive reference links
Michael Howell [Tue, 24 Jan 2023 00:10:54 +0000 (17:10 -0700)]
rustdoc: rearrange HTML in primitive reference links

This patch avoids hard-to-click single character links by making
the generic part of the link:

Before: <a href="#">&</a>T

After: <a href="#">&T</a>

16 months agoThread a ParamEnv down to might_permit_raw_init
Ben Kimock [Sun, 22 Jan 2023 22:06:28 +0000 (17:06 -0500)]
Thread a ParamEnv down to might_permit_raw_init

16 months agoPrint PID holding bootstrap build lock on Linux
clubby789 [Thu, 19 Jan 2023 21:11:17 +0000 (21:11 +0000)]
Print PID holding bootstrap build lock on Linux

16 months agorustdoc: remove dead settings JS for obsolete select-wrapper
Michael Howell [Mon, 23 Jan 2023 17:46:40 +0000 (10:46 -0700)]
rustdoc: remove dead settings JS for obsolete select-wrapper

16 months agorustdoc: simplify settings popover DOM
Michael Howell [Mon, 23 Jan 2023 17:44:01 +0000 (10:44 -0700)]
rustdoc: simplify settings popover DOM

* Changes the class names so that they all start with `setting-`.
  That should make it harder to accidentally use a setting class outside
  the settings popover, where loading the CSS might accidentally change
  the styles of something unrelated.
* Get rid of an unnecessary wrapper DIV around the radio button line.
* Simplify CSS selectors by making the DOM easier and more intuitive
  to target.

16 months agoBring tests back into rustc source tarball
Tomasz Miąsko [Mon, 23 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Bring tests back into rustc source tarball

They were missing after recent move from src/test to tests.

16 months agoreview comment: Remove AST AnonTy
Esteban Küber [Mon, 23 Jan 2023 14:29:53 +0000 (14:29 +0000)]
review comment: Remove AST AnonTy

16 months agofix: correct span for structs with const generics
Caleb Cartwright [Mon, 23 Jan 2023 16:54:05 +0000 (10:54 -0600)]
fix: correct span for structs with const generics

16 months agoAdd hint for missing lifetime bound on trait object when type alias is used
yanchen4791 [Tue, 6 Dec 2022 00:51:49 +0000 (16:51 -0800)]
Add hint for missing lifetime bound on trait object when type alias is used

16 months agoHack to suppress bad labels in type mismatch inference deduction code
Michael Goulet [Sat, 21 Jan 2023 22:18:51 +0000 (22:18 +0000)]
Hack to suppress bad labels in type mismatch inference deduction code

16 months agoDon't resolve type var roots in point_at_expr_source_of_inferred_type
Michael Goulet [Sat, 21 Jan 2023 21:54:49 +0000 (21:54 +0000)]
Don't resolve type var roots in point_at_expr_source_of_inferred_type

16 months agorustc_metadata: Support non-`Option` nullable values in metadata tables
Vadim Petrochenkov [Sat, 21 Jan 2023 14:38:14 +0000 (18:38 +0400)]
rustc_metadata: Support non-`Option` nullable values in metadata tables

This is a convenience feature for cases in which "no value in the table" and "default value in the table" are equivalent.
Tables using `Table<DefIndex, ()>` are migrated in this PR, some other cases can be migrated later.

This helps `DocFlags` in https://github.com/rust-lang/rust/pull/107136 in particular.

16 months ago`new_outside_solver` -> `evaluate_root_goal`
lcnr [Mon, 23 Jan 2023 14:34:11 +0000 (15:34 +0100)]
`new_outside_solver` ->  `evaluate_root_goal`

16 months agotweak wording
Esteban Küber [Mon, 23 Jan 2023 14:46:30 +0000 (14:46 +0000)]
tweak wording

16 months agoEnsure suggestion correctness
Esteban Küber [Sun, 8 Jan 2023 19:12:15 +0000 (19:12 +0000)]
Ensure suggestion correctness

16 months agoDo not erase regions
Esteban Küber [Sun, 8 Jan 2023 07:43:24 +0000 (07:43 +0000)]
Do not erase regions

16 months agoAdd call in `emit_type_mismatch_suggestions`
Esteban Küber [Sun, 8 Jan 2023 07:14:17 +0000 (07:14 +0000)]
Add call in `emit_type_mismatch_suggestions`

16 months agoreview comment: use `fcx.infcx`
Esteban Küber [Sun, 8 Jan 2023 07:05:23 +0000 (07:05 +0000)]
review comment: use `fcx.infcx`

16 months agoSuggest coercion of `Result` using `?`
Esteban Küber [Sun, 8 Jan 2023 02:54:59 +0000 (02:54 +0000)]
Suggest coercion of `Result` using `?`

Fix #47560.

16 months agoAuto merge of #107220 - JohnTitor:rollup-5pvuz0z, r=JohnTitor
bors [Mon, 23 Jan 2023 13:07:16 +0000 (13:07 +0000)]
Auto merge of #107220 - JohnTitor:rollup-5pvuz0z, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #106796 (BPF: Disable atomic CAS)
 - #106886 (Make stage2 rustdoc and proc-macro-srv disableable in x.py install)
 - #107101 (Filter param-env predicates for errors before calling `to_opt_poly_trait_pred`)
 - #107109 (ThinBox: Add intra-doc-links for Metadata)
 - #107148 (remove error code from `E0789`, add UI test/docs)
 - #107151 (Instantiate dominators algorithm only once)
 - #107153 (Consistently use dominates instead of is_dominated_by)

Failed merges:

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

16 months ago`sub_ptr()` is equivalent to `usize::try_from().unwrap_unchecked()`, not `usize:...
Chayim Refael Friedman [Mon, 23 Jan 2023 12:42:32 +0000 (14:42 +0200)]
`sub_ptr()` is equivalent to `usize::try_from().unwrap_unchecked()`, not `usize::from().unwrap_unchecked()`.

`usize::from()` gives a `usize`, not `Result<usize>`, and `usize: From<isize>` is not implemented.

16 months agofix: use LocalDefId instead of HirId in trait res
Vincenzo Palazzo [Sun, 15 Jan 2023 11:58:46 +0000 (12:58 +0100)]
fix: use LocalDefId instead of HirId in trait res

use LocalDefId instead of HirId in trait resolution to simplify
the obligation clause resolution

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
16 months agoRollup merge of #107153 - tmiasko:dominates, r=oli-obk
Yuki Okushi [Mon, 23 Jan 2023 10:30:02 +0000 (19:30 +0900)]
Rollup merge of #107153 - tmiasko:dominates, r=oli-obk

Consistently use dominates instead of is_dominated_by

There is a number of APIs that answer dominance queries. Previously they were named either "dominates" or "is_dominated_by". Consistently use the "dominates" form.

No functional changes.

16 months agoRollup merge of #107151 - tmiasko:dominators-no-inline, r=compiler-errors
Yuki Okushi [Mon, 23 Jan 2023 10:30:01 +0000 (19:30 +0900)]
Rollup merge of #107151 - tmiasko:dominators-no-inline, r=compiler-errors

Instantiate dominators algorithm only once

Remove inline from BasicBlocks::dominators to instantiate the dominator algorithm only once - in the rustc_middle crate.