Commit Graph

210175 Commits

Author SHA1 Message Date
Ralf Jung
1115ec601a cleanup and dedupe CTFE and Miri error reporting 2022-11-16 10:13:29 +01:00
bors
3b91b1a37b Auto merge of #104468 - weihanglo:update-cargo, r=weihanglo
Update cargo

5 commits in a3dfea71ca0c888a88111086898aa833c291d497..16b097879b6f117c8ae698aab054c87f26ff325e 2022-11-11 03:50:47 +0000 to 2022-11-14 23:28:16 +0000
- improve error message for cargo add/remove (rust-lang/cargo#11375)
- Bump crate versions of `cargo-util` and `crates-io` (rust-lang/cargo#11369)
- doc(changelog): suggestions of cargo fix are nightly only (rust-lang/cargo#11373)
- Add warning when PATH env separator is in project path (rust-lang/cargo#11318)
- Fix git2 safe-directory disable (rust-lang/cargo#11366)

r? `@ghost`
2022-11-16 03:23:42 +00:00
Weihang Lo
de53bd3eef
Update cargo
5 commits in a3dfea71ca0c888a88111086898aa833c291d497..16b097879b6f117c8ae698aab054c87f26ff325e
2022-11-11 03:50:47 +0000 to 2022-11-14 23:28:16 +0000
- improve error message for cargo add/remove (rust-lang/cargo#11375)
- Bump crate versions of `cargo-util` and `crates-io` (rust-lang/cargo#11369)
- doc(changelog): suggestions of cargo fix are nightly only (rust-lang/cargo#11373)
- Add warning when PATH env separator is in project path (rust-lang/cargo#11318)
- Fix git2 safe-directory disable (rust-lang/cargo#11366)
2022-11-16 00:11:19 +00:00
bors
79146baa9c Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obk
Perform simple scalar replacement of aggregates (SROA) MIR opt

This is a re-open of https://github.com/rust-lang/rust/pull/85796

I copied the debuginfo implementation (first commit) from `@eddyb's` own SROA PR.

This pass replaces plain field accesses by simple locals when possible.
To be eligible, the replaced locals:
- must not be enums or unions;
- must not be used whole;
- must not have their address taken.

The storage and deinit statements are duplicated on each created local.

cc `@tmiasko` who reviewed the former version of this PR.
2022-11-15 23:52:22 +00:00
Camille GILLOT
a18de7084a Mark test as panic=abort. 2022-11-15 18:06:45 +00:00
Camille GILLOT
779007da06 Enable SROA by at mir-opt level 3. 2022-11-15 17:59:36 +00:00
Camille GILLOT
e4f343191a Flatten aggregates into locals. 2022-11-15 17:55:11 +00:00
Camille GILLOT
b550eabfa6 Introduce composite debuginfo. 2022-11-15 17:53:50 +00:00
bors
a00f8ba7fc Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obk
interpret: support for per-byte provenance

Also factors the provenance map into its own module.

The third commit does the same for the init mask. I can move it in a separate PR if you prefer.

Fixes https://github.com/rust-lang/miri/issues/2181

r? `@oli-obk`
2022-11-15 17:37:15 +00:00
bors
6d651a295e Auto merge of #104437 - matthiaskrgr:rollup-n5jdg9v, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #103439 (Show note where the macro failed to match)
 - #103734 (Adjust stabilization version to 1.65.0 for wasi fds)
 - #104148 (Visit attributes of trait impl items during AST validation)
 - #104241 (Move most of unwind's build script to lib.rs)
 - #104258 (Deduce closure signature from a type alias `impl Trait`'s supertraits)
 - #104296 (Walk types more carefully in `ProhibitOpaqueTypes` visitor)
 - #104309 (Slightly improve error message for invalid identifier)
 - #104316 (Simplify suggestions for errors in generators.)
 - #104339 (Add `rustc_deny_explicit_impl`)

Failed merges:

 - #103484 (Add `rust` to `let_underscore_lock` example)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 12:35:57 +00:00
Matthias Krüger
55ff8bf847
Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillot
Add `rustc_deny_explicit_impl`

Also adjust `E0322` error message to be more general, since it's used for `DiscriminantKind` and `Pointee` as well.

Also add `rustc_deny_explicit_impl` on the `Tuple` and `Destruct` marker traits.
2022-11-15 10:44:12 +01:00
Matthias Krüger
a9b92151b0
Rollup merge of #104316 - cjgillot:simplify-async-suggestion, r=estebank
Simplify suggestions for errors in generators.

Split from https://github.com/rust-lang/rust/pull/101692/
2022-11-15 10:44:11 +01:00
Matthias Krüger
769f231371
Rollup merge of #104309 - chenyukang:yukang/fix-104088-identifier-error, r=davidtwco
Slightly improve error message for invalid identifier

fixes #104088
2022-11-15 10:44:11 +01:00
Matthias Krüger
d8b416db0a
Rollup merge of #104296 - compiler-errors:opaque-ty-ffi-normalization-cycle, r=lcnr
Walk types more carefully in `ProhibitOpaqueTypes` visitor

The visitor didn't account for the case where you could have `<TAIT as Trait>::Assoc` normalize to itself, in the case of a `type TAIT = impl Trait` with an unconstrained associated type. That causes the visitor to loop on the same type over and over.

Fixes #104291
2022-11-15 10:44:10 +01:00
Matthias Krüger
34425c8c00
Rollup merge of #104258 - compiler-errors:tait-closure-deduce, r=oli-obk
Deduce closure signature from a type alias `impl Trait`'s supertraits

r? `@oli-obk`

Basically pass the TAIT's bounds through the same method that we're using to deduce a signature from infer var closure bounds.

Does this need a new FCP? I see it as a logical extension of #101834, but happy to rfcbot a new one if it does.
2022-11-15 10:44:10 +01:00
Matthias Krüger
add6f14fbf
Rollup merge of #104241 - bjorn3:smaller_unwind_build_script, r=Mark-Simulacrum
Move most of unwind's build script to lib.rs

Only the android libunwind detection remains in the build script

* Reduces dependence on build scripts for building the standard library
* Reduces dependence on exact target names in favor of using semantic cfg(target_*) usage.
* Keeps almost all code related to linking of the unwinder in one file
2022-11-15 10:44:09 +01:00
Matthias Krüger
47f9d89f9a
Rollup merge of #104148 - fmease:fix-104140, r=petrochenkov
Visit attributes of trait impl items during AST validation

Fixes #104140.

This fix might not be backward compatible (in practice) since we now validate more attributes than before.
Should I write more tests?

`@rustbot` label A-attributes
2022-11-15 10:44:09 +01:00
Matthias Krüger
e309b79050
Rollup merge of #103734 - Mark-Simulacrum:fix-version-stabilized, r=JohnTitor
Adjust stabilization version to 1.65.0 for wasi fds

See https://github.com/rust-lang/rust/pull/103308#issuecomment-1292277645 for this ask.

Backport of that PR to beta (1.65.0) will include a similar patch.
2022-11-15 10:44:08 +01:00
Matthias Krüger
1a6ed3050f
Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebank
Show note where the macro failed to match

When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong.

```rust
macro_rules! uwu {
    (a a a b) => {};
}
uwu! { a a a c }
```

```diff
error: no rules expected the token `c`
 --> macros.rs:5:14
  |
1 | macro_rules! uwu {
  | ---------------- when calling this macro
...
4 | uwu! { a a a c }
  |              ^ no rules expected this token in macro call
  |
+note: while trying to match `b`
+ --> macros.rs:2:12
+  |
+2 |     (a a a b) => {};
+  |            ^
```
2022-11-15 10:44:07 +01:00
bors
357f660729 Auto merge of #101168 - jachris:dataflow-const-prop, r=oli-obk
Add new MIR constant propagation based on dataflow analysis

The current constant propagation in `rustc_mir_transform/src/const_prop.rs` fails to handle many cases that would be expected from a constant propagation optimization. For example:
```rust
let x = if true { 0 } else { 0 };
```
This pull request adds a new constant propagation MIR optimization pass based on the existing dataflow analysis framework. Since most of the analysis is not unique to constant propagation, a generic framework has been extracted. It works on top of the existing framework and could be reused for other optimzations.

Closes #80038. Closes #81605.

## Todo
### Essential
- [x] [Writes to inactive enum variants](https://github.com/rust-lang/rust/pull/101168#pullrequestreview-1089493974). Resolved by rejecting the registration of places with downcast projections for now. Could be improved by flooding other variants if mutable access to a variant is observed.
- [X] Handle [`StatementKind::CopyNonOverlapping`](https://github.com/rust-lang/rust/pull/101168#discussion_r957774914). Resolved by flooding the destination.
- [x] Handle `UnsafeCell` / `!Freeze` correctly.
- [X] Overflow propagation of `CheckedBinaryOp`: Decided to not propagate if overflow flag is `true` (`false` will still be propagated)
- [x] More documentation in general.
- [x] Arguments for correctness, documentation of necessary assumptions.
- [x] Better performance, or alternatively, require `-Zmir-opt-level=3` for now.

### Extra
- [x]  Add explicit unreachability, i.e. upgrading the lattice from $\mathbb{P} \to \mathbb{V}$ to $\set{\bot} \cup (\mathbb{P} \to \mathbb{V})$.
- [x] Use storage statements to improve precision.
- [ ] Consider opening issue for duplicate diagnostics: https://github.com/rust-lang/rust/pull/101168#issuecomment-1276609950
- [ ] Flood moved-from places with $\bot$ (requires some changes for places with tracked projections).
- [ ] Add downcast projections back in.
- [ ] [Algebraic simplifications](https://github.com/rust-lang/rust/pull/101168#discussion_r957967878) (possibly with a shared API; done by old const prop).
- [ ] Propagation through slices / arrays.
- [ ] Find other optimizations that are done by old `const_prop.rs`, but not by this one.
2022-11-15 09:38:05 +00:00
bors
ca92d90b59 Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #103842 (Adding Fuchsia compiler testing script, docs)
 - #104354 (Remove leading newlines from `NonZero*` doc examples)
 - #104372 (Update compiler-builtins)
 - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`)
 - #104381 (Remove dead NoneError diagnostic handling)
 - #104383 (Remove unused symbols and diagnostic items)
 - #104391 (Deriving cleanups)
 - #104403 (Specify language of code comment to generate document)
 - #104404 (Fix missing minification for static files)
 - #104413 ([llvm-wrapper] adapt for LLVM API change)
 - #104415 (rustdoc: fix corner case in search keyboard commands)
 - #104422 (Fix suggest associated call syntax)
 - #104426 (Add test for #102154)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 06:43:28 +00:00
Michael Goulet
d8bd153ba5 Normalize types before looking for opaques 2022-11-15 03:44:45 +00:00
bors
101e1822c3 Auto merge of #104418 - matthiaskrgr:rollup-y4i6xjc, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.)
 - #102470 (Stabilize const char convert)
 - #104223 (Recover from function pointer types with generic parameter list)
 - #104229 (Don't print full paths in overlap errors)
 - #104294 (Don't ICE with inline const errors during MIR build)
 - #104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc)
 - #104349 (fix some typos in comments)
 - #104350 (Fix x finding Python on Windows)
 - #104356 (interpret: make check_mplace public)
 - #104364 (rustdoc: Resolve doc links in external traits having local impls)
 - #104378 (Bump chalk to v0.87)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 03:37:07 +00:00
yukang
b2b509491d move testcase for tidy 2022-11-15 09:00:27 +08:00
yukang
ff18c73065 comment feedback 2022-11-15 08:58:23 +08:00
yukang
9db8e183dc fix #104088, Slightly improve error message for invalid identifier 2022-11-15 08:58:19 +08:00
Matthias Krüger
7c7cb7182f
Rollup merge of #104426 - aDotInTheVoid:test-102154, r=compiler-errors
Add test for #102154

Closes #102154
2022-11-15 01:40:47 +01:00
Matthias Krüger
ce263b7350
Rollup merge of #104422 - compiler-errors:fix-suggest_associated_call_syntax, r=BoxyUwU
Fix suggest associated call syntax

Fixes #104412
2022-11-15 01:40:47 +01:00
Matthias Krüger
5e753ca2b2
Rollup merge of #104415 - notriddle:notriddle/search-keyboard-commands, r=GuillaumeGomez
rustdoc: fix corner case in search keyboard commands

This fixes a bug when that shows up in nightly and in stable where:

* Search something
* Press down: first result is highlighted
* Press down: second result is highlighted
* Press down: third result is highlighted
* Press right: first result of second tab is highlighted
* Press left: third result of first tab is highlighted
* Press up: second result is highlighted
* Press up: first result is highlighted
* Press up: Search box is highlighted
* Press down: **third result** is highlighted, where it ought to highlight the first result
2022-11-15 01:40:46 +01:00
Matthias Krüger
f17828d938
Rollup merge of #104413 - krasimirgg:llvm-16-mref, r=nikic
[llvm-wrapper] adapt for LLVM API change

for feda983ff8.
2022-11-15 01:40:46 +01:00
Matthias Krüger
f0978eec01
Rollup merge of #104404 - GuillaumeGomez:fix-missing-minification, r=notriddle
Fix missing minification for static files

It's a fix for https://github.com/rust-lang/rust/pull/101702.

The problem was that `Path::ends_with` doesn't do what we thought it does: it checks if the entire item is the last path part, no just if the "path string" ends with the given argument. So instead, I just used the `extension()` method to get the information we want.

cc `@jsha`
r? `@notriddle`

PS: Is it worth it to add a CI test to ensure that the minification was performed on JS and CSS files or not?
2022-11-15 01:40:45 +01:00
Matthias Krüger
da2beab3f6
Rollup merge of #104403 - koka831:lint-doc, r=Dylan-DPC
Specify language of code comment to generate document

Fix `let_underscore_drop` comment
https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#example-7
2022-11-15 01:40:45 +01:00
Matthias Krüger
aea4c0c1b8
Rollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726
Deriving cleanups

Fixing some minor problems `@RalfJung` found in #99046.

r? `@RalfJung`
2022-11-15 01:40:44 +01:00
Matthias Krüger
2c29b05fb2
Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors
Remove unused symbols and diagnostic items

As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere.

Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it...
2022-11-15 01:40:44 +01:00
Matthias Krüger
0a3cb1ed81
Rollup merge of #104381 - mejrs:none_error, r=compiler-errors
Remove dead NoneError diagnostic handling

`NoneError` was removed some time ago, so this was dead code.
2022-11-15 01:40:44 +01:00
Matthias Krüger
2eee3a6d5e
Rollup merge of #104380 - rust-lang:notriddle/code-opacity, r=GuillaumeGomez
rustdoc: remove unused CSS `code { opacity: 1 }`

According to https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/CSS.20cleanup this style was added for declarations that no longer use opacity.
2022-11-15 01:40:43 +01:00
Matthias Krüger
83b6e85181
Rollup merge of #104372 - Ayush1325:compiler-builtins, r=JohnTitor
Update compiler-builtins

This was originally a part of https://github.com/rust-lang/rust/pull/100316. However, extracting it to a seperate PR should help with any extra testing that might be needed.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-15 01:40:43 +01:00
Matthias Krüger
1b41a38f52
Rollup merge of #104354 - lukas-code:blank-lines-2, r=JohnTitor
Remove leading newlines from `NonZero*` doc examples

Like https://github.com/rust-lang/rust/pull/103045, but for `NonZero*`.

`@rustbot` label A-docs
2022-11-15 01:40:42 +01:00
Matthias Krüger
98be657c7c
Rollup merge of #103842 - andrewpollack:add-fuchsia-test-script, r=tmandry
Adding Fuchsia compiler testing script, docs

Adding Fuchsia compiler testing script and related docs updates

r? `@tmandry`

cc. `@djkoloski`
2022-11-15 01:40:42 +01:00
bors
dedfb9c214 Auto merge of #104091 - BelovDV:issue-103044, r=petrochenkov
Wrap bundled static libraries into object files

Fixes #103044 (not sure, couldn't test locally)

Bundled static libraries should be wrapped into object files as it's done for metadata file.

r? `@petrochenkov`
2022-11-15 00:38:08 +00:00
Nixon Enraght-Moony
9214673331 Add test for #102154 2022-11-14 22:42:57 +00:00
Michael Howell
7b00534952 rustdoc: fix corner case in search keyboard commands 2022-11-14 13:21:08 -07:00
Michael Goulet
540e12f7da Add regression test 2022-11-14 19:29:37 +00:00
Michael Goulet
5497317aa5 Do autoderef to match impl against rcvr 2022-11-14 19:29:37 +00:00
Michael Goulet
bf607dae3f Move logic into method 2022-11-14 19:29:37 +00:00
Michael Goulet
3f697b85f2 Drive-by: actual -> rcvr_ty 2022-11-14 19:29:36 +00:00
Nilstrieb
7e7c11cf56
Show a note where a macro failed to match
This shows a small note on what the macro matcher was currently
processing to aid with "no rules expected the token X" errors.
2022-11-14 19:59:15 +01:00
Matthias Krüger
c389097693
Rollup merge of #104378 - compiler-errors:chalk-up, r=jackh726
Bump chalk to v0.87

1. Removes `ReEmpty` from chalk
2. Adds support for the `std::marker::Tuple` trait
2022-11-14 19:26:19 +01:00
Matthias Krüger
dc869fcfb2
Rollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomez
rustdoc: Resolve doc links in external traits having local impls

For external impls it was done in https://github.com/rust-lang/rust/pull/103192 right away, but the local impl case was forgotten.

Fixes https://github.com/rust-lang/rust/issues/104145.
2022-11-14 19:26:19 +01:00
Matthias Krüger
050ece6765
Rollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk
interpret: make check_mplace public

This helps avoid code duplication in https://github.com/rust-lang/miri/pull/2661.
2022-11-14 19:26:18 +01:00