Commit graph

215695 commits

Author SHA1 Message Date
Matthias Krüger
a84e060173
Rollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnr
Implement ObjectSafe and WF in the new solver

r? ``@lcnr``
2023-01-26 06:15:27 +01:00
Matthias Krüger
a8b5e5d9db
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``
2023-01-26 06:15:27 +01:00
Matthias Krüger
a8e8406e60
Rollup merge of #107204 - euclio:assoc-const-suggestion, r=petrochenkov
suggest qualifying bare associated constants

Fixes #107199.
2023-01-26 06:15:26 +01:00
Matthias Krüger
5bc49807dd
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)
2023-01-26 06:15:26 +01:00
Matthias Krüger
4b51b20d87
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
2023-01-26 06:15:25 +01:00
Matthias Krüger
f3644ca64d
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````
2023-01-26 06:15:24 +01:00
Matthias Krüger
ba928ba041
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.
2023-01-26 06:15:24 +01:00
Matthias Krüger
8ae5116fae
Rollup merge of #106407 - mejrs:attr_check, r=compiler-errors
Improve proc macro attribute diagnostics

Closes https://github.com/rust-lang/rust/issues/102923
2023-01-26 06:15:23 +01:00
bors
2a17174ee6 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
2023-01-25 23:39:51 +00:00
Michael Goulet
02b80d2f9c Don't normalize obligations in WF goal for the new solver 2023-01-25 21:28:22 +00:00
Michael Goulet
b3f0085376 Implement ObjectSafe and WF in the new solver 2023-01-25 21:27:12 +00:00
Matthias Krüger
a20b86f881
Rollup merge of #107282 - BoxyUwU:erica_builtin_pointee_impls, r=compiler-errors
erica solver: implement builtin `Pointee` trait impl candidates

r? ```@compiler-errors```
2023-01-25 22:19:56 +01:00
Matthias Krüger
f268c7b454
Rollup merge of #107266 - kadiwa4:source_viewer_scrollbar, r=notriddle
rustdoc: prohibit scroll bar on source viewer in Safari

Fixes #106455.
2023-01-25 22:19:55 +01:00
Matthias Krüger
c2f46df5a5
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```
2023-01-25 22:19:55 +01:00
Matthias Krüger
c20e0daf32
Rollup merge of #107255 - lcnr:implied-b-hr, r=oli-obk
add test where we ignore hr implied bounds

r? types
2023-01-25 22:19:54 +01:00
Matthias Krüger
2ed3639f83
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>
2023-01-25 22:19:53 +01:00
Matthias Krüger
b7baa9f217
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
2023-01-25 22:19:53 +01:00
Matthias Krüger
22e62a4fca
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.
2023-01-25 22:19:52 +01:00
Matthias Krüger
9e3f330656
Rollup merge of #106897 - estebank:issue-99430, r=davidtwco
Tweak E0597

CC #99430
2023-01-25 22:19:52 +01:00
Matthias Krüger
f21728fee4
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.
2023-01-25 22:19:51 +01:00
bors
c18a5e8a5b Auto merge of #107142 - cuviper:relnotes-1.67, r=Mark-Simulacrum
Release notes for 1.67.0

r? `@Mark-Simulacrum`
cc `@rust-lang/release`
2023-01-25 20:59:10 +00:00
bors
027c8507b4 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`
2023-01-25 16:39:29 +00:00
bors
95b61d16d4 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
2023-01-25 13:58:41 +00:00
Andy Russell
8b12d5f42f
suggest qualifying bare associated constants 2023-01-25 08:58:27 -05:00
Dylan DPC
e78fa8a0bc
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
2023-01-25 17:01:44 +05:30
Dylan DPC
139a3c5b0a
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```
2023-01-25 17:01:44 +05:30
Dylan DPC
24066910ca
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.
2023-01-25 17:01:43 +05:30
Dylan DPC
4e2b5d1f54
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.
2023-01-25 17:01:43 +05:30
Dylan DPC
a788ce243a
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.
2023-01-25 17:01:42 +05:30
Dylan DPC
0c53b215de
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.
2023-01-25 17:01:42 +05:30
Dylan DPC
9e6873f788
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.
2023-01-25 17:01:41 +05:30
Dylan DPC
b36a8dcea3
Rollup merge of #106583 - estebank:suggest-result-coercion, r=compiler-errors
Suggest coercion of `Result` using `?`

Fix #47560.
2023-01-25 17:01:40 +05:30
Dylan DPC
c0930c497c
Rollup merge of #105552 - mattjperez:add-incompatible-types-note, r=compiler-errors
Add help message about function pointers

#102608
2023-01-25 17:01:40 +05:30
bors
9467f95531 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`
2023-01-25 10:27:52 +00:00
Erik Desjardins
adc1890448 create and use GlobalAlloc::address_space 2023-01-25 01:46:19 -05:00
bors
c04832643d Auto merge of #107275 - calebcartwright:sync-from-rustfmt, r=calebcartwright
Sync rustfmt subtree
2023-01-25 04:49:08 +00:00
Boxy
a418e39b75 no without_constness 2023-01-24 23:32:47 +00:00
Boxy
2f924b0e3c sorry erica 2023-01-24 23:29:02 +00:00
Boxy
430dab0b42 implement builtin candidate 2023-01-24 23:24:30 +00:00
Weihang Lo
e9eb979081
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)
2023-01-24 20:34:38 +00:00
Caleb Cartwright
6bf1a87fcd update rustfmt subtree version in lockfile 2023-01-24 14:21:14 -06:00
Caleb Cartwright
8e1e67dbaa Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt 2023-01-24 14:16:03 -06:00
Caleb Cartwright
1d8491b120 chore: prep v1.5.2 release 2023-01-24 14:04:12 -06:00
Matthew J Perez
1e22280f23
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`
2023-01-24 14:02:56 -05:00
Caleb Cartwright
5139b14620 fix: version gate changes for multiline single generic bound 2023-01-24 11:38:44 -06:00
KaDiWa
11a94f242d
rustdoc: prevent scroll bar on source viewer 2023-01-24 16:46:45 +01:00
Jakob Degen
ad7393668f Delete SimplifyArmIdentity and SimplifyBranchSame mir opts 2023-01-24 04:13:52 -08:00
lcnr
e6e93e021e add test where we ignore hr implied bounds 2023-01-24 12:41:18 +01:00
Edward Shen
a8b77cfe54
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.
2023-01-23 20:33:04 -08:00
Caleb Cartwright
6eeb4fd230
Merge pull request #5670 from calebcartwright/subtree-sync-2023-01-24
Subtree sync 2023-01-24
2023-01-23 22:13:01 -06:00