]> git.lizzy.rs Git - rust.git/log
rust.git
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.

 

**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 #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 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 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 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 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 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 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 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 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.

16 months agoRollup merge of #107148 - Ezrashaw:uncode-e0789, r=compiler-errors,GuillaumeGomez
Yuki Okushi [Mon, 23 Jan 2023 10:30:00 +0000 (19:30 +0900)]
Rollup merge of #107148 - Ezrashaw:uncode-e0789, r=compiler-errors,GuillaumeGomez

remove error code from `E0789`, add UI test/docs

`E0789` shouldn't have an error code, it's explicitly internal-only and is tiny in scope. (I wonder if we can tighten the standard for this in the RFC?) I also added a UI test and error docs (done like `E0208`, they are "no longer emitted").

r? `@GuillaumeGomez` (shouldn't need a compiler review, it's pretty minor)

16 months agoRollup merge of #107109 - est31:thin_box_link, r=Mark-Simulacrum
Yuki Okushi [Mon, 23 Jan 2023 10:30:00 +0000 (19:30 +0900)]
Rollup merge of #107109 - est31:thin_box_link, r=Mark-Simulacrum

ThinBox: Add intra-doc-links for Metadata

16 months agoRollup merge of #107101 - compiler-errors:perf-106309-1, r=petrochenkov
Yuki Okushi [Mon, 23 Jan 2023 10:29:59 +0000 (19:29 +0900)]
Rollup merge of #107101 - compiler-errors:perf-106309-1, r=petrochenkov

Filter param-env predicates for errors before calling `to_opt_poly_trait_pred`

cc #106309 https://github.com/rust-lang/rust/pull/106757#issuecomment-1396616318

r? `@ghost`

16 months agoRollup merge of #106886 - dtolnay:fastinstall, r=Mark-Simulacrum
Yuki Okushi [Mon, 23 Jan 2023 10:29:59 +0000 (19:29 +0900)]
Rollup merge of #106886 - dtolnay:fastinstall, r=Mark-Simulacrum

Make stage2 rustdoc and proc-macro-srv disableable in x.py install

Rustdoc will build if `[build] tools = ["rustdoc"]` is set, and rust-analyzer-proc-macro-srv will build if `[build] tools = ["rust-analyzer"]` is set.

On my machine skipping these tools speeds up `x.py install` from 7m15s to 6m08s (0m43s for rustdoc and 0m24s for rust-analyzer-proc-macro-srv). This is a significant speedup, since I never use rust-analyzer-proc-macro-srv, and I practically never need to use a custom build of rustdoc.

16 months agoRollup merge of #106796 - vadorovsky:revert-105708-enable-atomic-cas-bpf, r=bjorn3
Yuki Okushi [Mon, 23 Jan 2023 10:29:58 +0000 (19:29 +0900)]
Rollup merge of #106796 - vadorovsky:revert-105708-enable-atomic-cas-bpf, r=bjorn3

BPF: Disable atomic CAS

Enabling CAS for BPF targets (https://github.com/rust-lang/rust/pull/105708) breaks the build of core library.
The failure occurs both when building rustc for BPF targets and when
building crates for BPF targets with the current nightly.

The LLVM BPF backend does not correctly lower all `atomicrmw` operations
and crashes for unsupported ones.

Before we can enable CAS for BPF in Rust, we need to fix the LLVM BPF
backend first.

Fixes #106795

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
16 months agoAuto merge of #107136 - petrochenkov:dochidden, r=cjgillot
bors [Mon, 23 Jan 2023 10:12:57 +0000 (10:12 +0000)]
Auto merge of #107136 - petrochenkov:dochidden, r=cjgillot

rustc_metadata: Encode `doc(hidden)` flag to metadata

To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance.

This is especially important for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.

16 months agoadd UI test + docs for `E0789`
Ezra Shaw [Sat, 21 Jan 2023 08:32:05 +0000 (21:32 +1300)]
add UI test + docs for `E0789`

16 months agoAuto merge of #107215 - Dylan-DPC:rollup-zqtiufk, r=Dylan-DPC
bors [Mon, 23 Jan 2023 07:32:07 +0000 (07:32 +0000)]
Auto merge of #107215 - Dylan-DPC:rollup-zqtiufk, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #104926 (Move relationships from FulfillmentContext to Inherited)
 - #106854 (Add `Arc::into_inner` for safely discarding `Arc`s without calling the destructor on the inner type.)
 - #107108 (Consider doc(alias) when providing typo suggestions)
 - #107186 (rustdoc: Use correct pseudo-element selector)
 - #107192 (Add myself to the mailmap)
 - #107195 (Fix typo in universal_regions.rs comment)
 - #107203 (Suggest remove deref for type mismatch)

Failed merges:

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

16 months agoRollup merge of #107203 - chenyukang:yukang/fix-106496-remove-deref, r=compiler-errors
Dylan DPC [Mon, 23 Jan 2023 06:22:07 +0000 (11:52 +0530)]
Rollup merge of #107203 - chenyukang:yukang/fix-106496-remove-deref, r=compiler-errors

Suggest remove deref for type mismatch

Fixes #106496

16 months agoRollup merge of #107195 - smoelius:patch-2, r=Nilstrieb
Dylan DPC [Mon, 23 Jan 2023 06:22:06 +0000 (11:52 +0530)]
Rollup merge of #107195 - smoelius:patch-2, r=Nilstrieb

Fix typo in universal_regions.rs comment

16 months agoRollup merge of #107192 - fmease:mailmap-me-at-fmease-dev, r=albertlarsan68
Dylan DPC [Mon, 23 Jan 2023 06:22:06 +0000 (11:52 +0530)]
Rollup merge of #107192 - fmease:mailmap-me-at-fmease-dev, r=albertlarsan68

Add myself to the mailmap

16 months agoRollup merge of #107186 - GuillaumeGomez:correct-pseudo-element-selector, r=notriddle
Dylan DPC [Mon, 23 Jan 2023 06:22:05 +0000 (11:52 +0530)]
Rollup merge of #107186 - GuillaumeGomez:correct-pseudo-element-selector, r=notriddle

rustdoc: Use correct pseudo-element selector

As explained [here](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements#syntax).

I wrote it on top of #107152 so we'll need to wait for this one to be merged first.

r? `@notriddle`

16 months agoRollup merge of #107108 - sulami:issue-83968-doc-alias-typo-suggestions, r=compiler...
Dylan DPC [Mon, 23 Jan 2023 06:22:05 +0000 (11:52 +0530)]
Rollup merge of #107108 - sulami:issue-83968-doc-alias-typo-suggestions, r=compiler-errors

Consider doc(alias) when providing typo suggestions

This means that

```rust
impl Foo {
    #[doc(alias = "quux")]
    fn bar(&self) {}
}

fn main() {
    (Foo {}).quux();
}
```

will suggest `bar`. This currently uses the "there is a method with a similar name" help text, because the point where we choose and emit a suggestion is different from where we gather the suggestions. Changes have mainly been made to the latter.

The selection code will now fall back to aliased candidates, but generally only if there is no candidate that matches based on the existing Levenshtein methodology.

Fixes #83968.

16 months agoRollup merge of #106854 - steffahn:drop_linear_arc_rebased, r=Mark-Simulacrum
Dylan DPC [Mon, 23 Jan 2023 06:22:04 +0000 (11:52 +0530)]
Rollup merge of #106854 - steffahn:drop_linear_arc_rebased, r=Mark-Simulacrum

Add `Arc::into_inner` for safely discarding `Arc`s without calling the destructor on the inner type.

ACP: rust-lang/libs-team#162

Reviving #79665.

I want to get this merged this time; this does not contain changes (apart from very minor changes in comments/docs).

See #79665 for further description of the PR. The only “unresolved” points that led to that PR being closed, AFAICT, were

* The desire to also implement a `Rc::into_inner` function
  * however, this can very well also happen as a subsequent PR
* Possible need for further discussion on the naming “`into_inner`” (?)
  * `into_inner` seems fine to me; also, this PR introduces unstable API, and names can be changed later, too
* ~~I don't know if a tracking issue for the feature flag is supposed to be opened before or after this PR gets merged (if *before*, then I can add the issue number to the `#[unstable…]` attribute)~~ There is a [tracking issue](https://github.com/rust-lang/rust/issues/106894) now.

I say “unresolved” in quotation marks because from my point of view, if reviewers agree, the PR can be merged immediately and as-is :-)

16 months agoRollup merge of #104926 - spastorino:calculate_diverging_fallback-cleanups, r=lcnr
Dylan DPC [Mon, 23 Jan 2023 06:22:04 +0000 (11:52 +0530)]
Rollup merge of #104926 - spastorino:calculate_diverging_fallback-cleanups, r=lcnr

Move relationships from FulfillmentContext to Inherited

r? `@lcnr`

16 months agoAuto merge of #107044 - cuviper:more-llvm-ci, r=Mark-Simulacrum
bors [Mon, 23 Jan 2023 04:36:34 +0000 (04:36 +0000)]
Auto merge of #107044 - cuviper:more-llvm-ci, r=Mark-Simulacrum

ci: add runners for vanilla LLVM 14 and 15

As discussed in [zulip #t-infra][1] -- r? Mark-Simulacrum

[1]: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/testing.20multiple.20llvm.20versions

16 months agoConsider doc(alias) when providing typo suggestions
Robin Schroer [Wed, 18 Jan 2023 10:58:50 +0000 (19:58 +0900)]
Consider doc(alias) when providing typo suggestions

This means that

```rust
impl Foo {
    #[doc(alias = "quux")]
    fn bar(&self) {}
}

fn main() {
    (Foo {}).quux();
}
```

will suggest `bar`. This currently uses the "there is a method with a
similar name" help text, because the point where we choose and emit a
suggestion is different from where we gather the suggestions. Changes
have mainly been made to the latter.

The selection code will now fall back to aliased candidates, but
generally only if there is no candidate that matches based on the
existing Levenshtein methodology.

Fixes #83968.

16 months agoAuto merge of #106981 - joboet:std_remove_box_syntax, r=thomcc
bors [Mon, 23 Jan 2023 01:05:56 +0000 (01:05 +0000)]
Auto merge of #106981 - joboet:std_remove_box_syntax, r=thomcc

Do not use box syntax in `std`

See #94970 and #49733. About half of the `box` instances in `std` do not even need to allocate, the other half can simply be replaced with `Box::new`.

`@rustbot` label +T-libs
r? rust-lang/libs

16 months agoAuto merge of #106975 - tmiasko:basic-blocks-cache, r=cjgillot
bors [Sun, 22 Jan 2023 21:35:21 +0000 (21:35 +0000)]
Auto merge of #106975 - tmiasko:basic-blocks-cache, r=cjgillot

Refactor basic blocks control flow caches

No functional changes.

16 months agoAuto merge of #106827 - alexcrichton:update-llvm-to-15.0.7, r=cuviper
bors [Sun, 22 Jan 2023 18:39:13 +0000 (18:39 +0000)]
Auto merge of #106827 - alexcrichton:update-llvm-to-15.0.7, r=cuviper

Update LLVM to 15.0.7

This commit pulls in rust-lang/llvm-project#143 which updates the LLVM version used by rustc to 15.0.7, namely pulling in https://reviews.llvm.org/D136110 which is needed for some work I'm working on with wasm.

16 months agoFix #106496, suggest remove deref for type mismatch
yukang [Sun, 22 Jan 2023 16:42:20 +0000 (00:42 +0800)]
Fix #106496, suggest remove deref for type mismatch

16 months agofn-trait-closure test now pass on new solver
Santiago Pastorino [Sun, 22 Jan 2023 15:36:58 +0000 (12:36 -0300)]
fn-trait-closure test now pass on new solver

16 months agoRename relationships to infer_var_info
Santiago Pastorino [Fri, 20 Jan 2023 19:45:01 +0000 (16:45 -0300)]
Rename relationships to infer_var_info

16 months agoMove relationships::update to Inherited::update_infer_var_info
Santiago Pastorino [Fri, 20 Jan 2023 19:42:22 +0000 (16:42 -0300)]
Move relationships::update to Inherited::update_infer_var_info

16 months agoStore relationships on Inherent
Santiago Pastorino [Fri, 25 Nov 2022 21:18:03 +0000 (18:18 -0300)]
Store relationships on Inherent

16 months agoRemove duplicated debug call
Santiago Pastorino [Thu, 24 Nov 2022 17:26:57 +0000 (14:26 -0300)]
Remove duplicated debug call

16 months agoAuto merge of #107187 - matthiaskrgr:rollup-lvwzlg2, r=matthiaskrgr
bors [Sun, 22 Jan 2023 13:22:34 +0000 (13:22 +0000)]
Auto merge of #107187 - matthiaskrgr:rollup-lvwzlg2, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #107102 (Implement some more predicates in the new solver)
 - #107111 (Fix missing arguments issues and copy-paste bug for fluent)
 - #107114 (Add note about absolute paths to Path::join)
 - #107127 (Enable sanitizers for s390x-linux)
 - #107152 (Migrate scraped-examples top and bottom "borders" to CSS variables)
 - #107170 (Add myself to .mailmap)
 - #107174 (rustdoc: Use `DefId(Map,Set)` instead of `FxHash(Map,Set)`)
 - #107180 (Remove unnecessary `&format!`)

Failed merges:

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

16 months agoUpdate universal_regions.rs
Samuel Moelius [Sun, 22 Jan 2023 12:38:02 +0000 (07:38 -0500)]
Update universal_regions.rs

16 months agoadd fmease to mailmap
León Orell Valerian Liehr [Sun, 22 Jan 2023 11:36:04 +0000 (12:36 +0100)]
add fmease to mailmap

16 months agoRollup merge of #107180 - nvzqz:rm-fmt-ref, r=joshtriplett
Matthias Krüger [Sun, 22 Jan 2023 10:43:09 +0000 (11:43 +0100)]
Rollup merge of #107180 - nvzqz:rm-fmt-ref, r=joshtriplett

Remove unnecessary `&format!`

These were likely from before the `PartialEq<str>` impl for `&String`.

16 months agoRollup merge of #107174 - petrochenkov:defidoc, r=notriddle
Matthias Krüger [Sun, 22 Jan 2023 10:43:08 +0000 (11:43 +0100)]
Rollup merge of #107174 - petrochenkov:defidoc, r=notriddle

rustdoc: Use `DefId(Map,Set)` instead of `FxHash(Map,Set)`

Not all uses are converted, a few cases iterating through maps/sets and requiring nontrivial changes are kept.
cc https://github.com/rust-lang/rust/pull/106977

16 months agoRollup merge of #107170 - albertlarsan68:update-mailmap, r=compiler-errors
Matthias Krüger [Sun, 22 Jan 2023 10:43:08 +0000 (11:43 +0100)]
Rollup merge of #107170 - albertlarsan68:update-mailmap, r=compiler-errors

Add myself to .mailmap

16 months agoRollup merge of #107152 - GuillaumeGomez:migrate-to-css-var, r=notriddle
Matthias Krüger [Sun, 22 Jan 2023 10:43:07 +0000 (11:43 +0100)]
Rollup merge of #107152 - GuillaumeGomez:migrate-to-css-var, r=notriddle

Migrate scraped-examples top and bottom "borders" to CSS variables

r? `@notriddle`

16 months agoRollup merge of #107127 - uweigand:s390x-sanitizer, r=Mark-Simulacrum
Matthias Krüger [Sun, 22 Jan 2023 10:43:07 +0000 (11:43 +0100)]
Rollup merge of #107127 - uweigand:s390x-sanitizer, r=Mark-Simulacrum

Enable sanitizers for s390x-linux

Include sanitizers supported by LLVM on s390x (asan, lsan, msan, tsan) in the target definition, as well as in the compiletest supported list.

Build sanitizer runtime for the target.  Enable sanitizers in the CI.