Commit Graph

210423 Commits

Author SHA1 Message Date
bors
bebd57a960 Auto merge of #102944 - nnethercote:ast-Lit-third-time-lucky, r=petrochenkov
Use `token::Lit` in `ast::ExprKind::Lit`.

Instead of `ast::Lit`.

Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing.

r? `@petrochenkov`
2022-11-16 23:03:14 +00:00
Michael Goulet
75afb22331 Check dyn* return type correctly 2022-11-16 22:21:41 +00:00
Michael Howell
893bd781be rustdoc: remove redundant font-color CSS on .where
Before 7f6ce7dddd, light-theme where clauses
had color `#4E4C4C` while the main color was `#000`. One of that commit's
simplifications made it so that everything used the same black.
2022-11-16 13:28:51 -07:00
bors
e9493d63c2 Auto merge of #104456 - RalfJung:miri, r=RalfJung
update Miri

Not a huge sync, but there was a conflict and [josh](https://github.com/josh-project/josh/) seems to prefer those to be merged back ASAP.
2022-11-16 19:52:45 +00:00
David Koloski
b44d808e4a Don't attempt to normalize compiler backtraces
Backtraces can very significantly depending on environment and cause
test suite failures spuriously. Ensuring a proper failure-status should
be sufficient to keep a crash properly documented.
2022-11-16 12:35:30 -05:00
bors
e69336efe0 Auto merge of #104492 - matthiaskrgr:rollup-3xyjynz, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #103750 (Fix some misleading target feature aliases)
 - #104137 (Issue error when -C link-self-contained option is used on unsupported platforms)
 - #104317 (cleanup and dedupe CTFE and Miri error reporting)
 - #104335 (Only do parser recovery on retried macro matching)
 - #104394 (various cleanups to try to reduce the use of spans inside method resolution)
 - #104459 (rustdoc: remove unused JS IIFE from main.js)
 - #104462 (rustdoc: remove pointless CSS `.rightside { padding-right: 2px }`)
 - #104466 (rustdoc: remove no-op CSS `#crate-search-div { display: inline-block }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-16 15:55:30 +00:00
Ralf Jung
157b2d5436 ensure rand has its default features enabled 2022-11-16 16:13:55 +01:00
Matthias Krüger
972ad00094
Rollup merge of #104466 - notriddle:notriddle/crate-search-div-display, r=GuillaumeGomez
rustdoc: remove no-op CSS `#crate-search-div { display: inline-block }`

`#crate-search-div` is nested directly below `.search-results-title`, which has `display: inline-flex`. This makes the crate-search-div a [flex item], which makes its display property irrelevant, because flex items have their display [blockified] in any case.

[flex item]: https://developer.mozilla.org/en-US/docs/Glossary/Flex_Item
[blockified]: https://www.w3.org/TR/css-flexbox-1/#flex-items
2022-11-16 15:39:48 +01:00
Matthias Krüger
938948ea80
Rollup merge of #104462 - notriddle:notriddle/rightside-padding-right, r=GuillaumeGomez
rustdoc: remove pointless CSS `.rightside { padding-right: 2px }`

This CSS was added in 34bd2b845b, as `.since { padding-right: 2px }`, to prevent it from uncomfortably touching the srclink, which were separate floated elements. It was carried forward with 962c0a4ee5 to the new `.rightside`, but its role was replaced with adding " • " between them. All it does now is pushes the element 2px away from the page's right margin.

Removing this rule changes the page layout, but you have to look for it to notice it.
2022-11-16 15:39:47 +01:00
Matthias Krüger
baf1cbb70d
Rollup merge of #104459 - notriddle:notriddle/main-js-iife, r=GuillaumeGomez
rustdoc: remove unused JS IIFE from main.js

This [IIFE] made sense when it was added in f0683f98fa and there was a local variable scoped to it, but now it only sets two globals, so it does nothing.

[IIFE]: https://developer.mozilla.org/en-US/docs/Glossary/IIFE "immediately invoked function expression"
2022-11-16 15:39:47 +01:00
Matthias Krüger
163a7090b8
Rollup merge of #104394 - oli-obk:suggest_method_call, r=lcnr
various cleanups to try to reduce the use of spans inside method resolution

definitely review commit by commit.
2022-11-16 15:39:46 +01:00
Matthias Krüger
e033a389e1
Rollup merge of #104335 - Nilstrieb:macrowo, r=compiler-errors
Only do parser recovery on retried macro matching

Eager parser recovery can break macros, so we don't do it at first. But when we already know that the macro failed, we can retry it with recovery enabled to still emit useful diagnostics.

Helps with #103534
2022-11-16 15:39:46 +01:00
Matthias Krüger
353b915fec
Rollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obk
cleanup and dedupe CTFE and Miri error reporting

It looks like most of the time, this error raised from const_prop_lint is just redundant -- it duplicates the error reported when evaluating the const-eval query. This lets us make `ConstEvalErr` private to the const_eval module which I think is a good step.

The Miri change mostly replaces a `match` by `if let`, and dedupes the "this error is impossible in Miri" checks.

r? ``@oli-obk``
Fixes https://github.com/rust-lang/rust/issues/75461
2022-11-16 15:39:45 +01:00
Matthias Krüger
fbcd751ea1
Rollup merge of #104137 - StackDoubleFlow:err-lsc-unsupported, r=bjorn3
Issue error when -C link-self-contained option is used on unsupported platforms

The documentation was also updated to reflect this.

I'm assuming the supported platforms are the same as initially written in [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md#compiler-17).

Fixes #103576
2022-11-16 15:39:45 +01:00
Matthias Krüger
56a28a65f5
Rollup merge of #103750 - calebzulawski:master, r=workingjubilee
Fix some misleading target feature aliases

This is the first half of a fix for #100752.  It looks like these aliases were added in #78361 and slipped under the radar, as these features are not AVX512.  These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions.  A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features).  This PR allows using the names as defined by LLVM, which matches Intel documentation.

A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc.

r? ```@workingjubilee```

cc ```@Amanieu```
2022-11-16 15:39:44 +01:00
yukang
9c2d4dd529 fix #104510, Remove is_tainted_by_errors since we have ty_error for delay bug 2022-11-16 19:41:08 +08:00
bors
63c748ee23 Auto merge of #104481 - matthiaskrgr:rollup-hf8rev0, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #103484 (Add `rust` to `let_underscore_lock` example)
 - #103489 (Make `pointer::byte_offset_from` more generic)
 - #104193 (Shift no characters when using raw string literals)
 - #104348 (Respect visibility & stability of inherent associated types)
 - #104401 (avoid memory leak in mpsc test)
 - #104419 (Fix test/ui/issues/issue-30490.rs)
 - #104424 (rustdoc: remove no-op CSS `.popover { font-size: 1rem }`)
 - #104425 (rustdoc: remove no-op CSS `.main-header { justify-content }`)
 - #104450 (Fuchsia test suite script fix)
 - #104471 (Update PROBLEMATIC_CONSTS in style.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-16 10:27:24 +00:00
yukang
20ea083d87 fix #104390, fix ICE in in_operand for ty error 2022-11-16 17:48:13 +08:00
Oli Scherer
4f11f3b257 Convert predicates into Predicate in the Obligation constructor 2022-11-16 09:25:19 +00:00
Oli Scherer
634df06fae Generalize the ToPredicate trait
Its name is now not accurate anymore, but we'll adjust that later
2022-11-16 09:20:28 +00:00
Ralf Jung
1115ec601a cleanup and dedupe CTFE and Miri error reporting 2022-11-16 10:13:29 +01:00
Matthias Krüger
8bbecb9a42
Rollup merge of #104471 - scruss:patch-1, r=jyn514
Update PROBLEMATIC_CONSTS in style.rs

added 3735932941, since 3735927486 was already present.
2022-11-16 08:36:14 +01:00
Matthias Krüger
c32d79c983
Rollup merge of #104450 - andrewpollack:fix-fuchsia-compiler-docs, r=tmandry
Fuchsia test suite script fix

Fixing error from https://github.com/rust-lang/rust/pull/103842#discussion_r1022178201

r? ```@tmandry```
2022-11-16 08:36:14 +01:00
Matthias Krüger
25c3180d15
Rollup merge of #104425 - notriddle:notriddle/main-heading-justify-content, r=GuillaumeGomez
rustdoc: remove no-op CSS `.main-header { justify-content }`

This rule was added in 152e888905 to push the out-of-band content to the right while allowing it to line wrap when it got too big. The idea was that the justification rule would fill the space between the `<h1>` element and the `<div class="out-of-band">` element.

A later commit, 3cb03cb342, flattened the in-band element into the `<h1>`, copying the `flex-grow` rule. This means the `<h1>` element now grows to fill the space, so there's no need to justify-content any more.

This commit also adds a test case for this.
2022-11-16 08:36:13 +01:00
Matthias Krüger
b9d028ae99
Rollup merge of #104424 - notriddle:notriddle/popover-font-size, r=GuillaumeGomez
rustdoc: remove no-op CSS `.popover { font-size: 1rem }`

This rule was added in cc4f804829 because the help popover inherited the font-size from the help button "?" icon.

It doesn't inherit this any more, because it was moved from being nested inside the link to sharing a wrapper DIV with it.
2022-11-16 08:36:13 +01:00
Matthias Krüger
4ef422e2b9
Rollup merge of #104419 - Ayush1325:test-issue-30490, r=lcnr
Fix test/ui/issues/issue-30490.rs

Since the empty main is used for `not(unix)`, all the targets that will use this empty main will also need `allow(unused_imports)`.

Originally part of https://github.com/rust-lang/rust/pull/100316

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-16 08:36:12 +01:00
Matthias Krüger
4864a04c33
Rollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu
avoid memory leak in mpsc test

r? ```@Amanieu```
2022-11-16 08:36:12 +01:00
Matthias Krüger
3a8cacd7fb
Rollup merge of #104348 - fmease:iat-vis-stab, r=cjgillot
Respect visibility & stability of inherent associated types

As discussed in #103621, this probably won't be the final location of the code that resolves inherent associated types. Still, I think it's valuable to push correctness fixes for this feature (in regards to visibility and stability).

Let me know if I should write a translatable diagnostic instead and if I should move the tests to `privacy/` and `stability-attribute/` respectively.

Fixes #104243.
````@rustbot```` label A-visibility F-inherent_associated_types
r? ````@cjgillot```` (since you reviewed #103621, feel free to reroll though)
2022-11-16 08:36:11 +01:00
Matthias Krüger
88a19197b9
Rollup merge of #104193 - TaKO8Ki:fix-104142, r=cjgillot
Shift no characters when using raw string literals

Fixes #104142

Given the following code:

```rust
fn main() {
    println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#);
}
```

The current output is:

```
error: invalid format string: unmatched `}` found
 --> src/main.rs:2:59
  |
2 |     println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found
  |                                                           ^ unmatched `}` in format string
  |
  = note: if you intended to print `}`, you can escape it using `}}`

error: could not compile `debug_playground` due to previous error
```

The output should look like:

```
error: invalid format string: unmatched `}` found
 --> src/main.rs:2:45
  |
2 |     println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found
  |                                             ^ unmatched `}` in format string
  |
  = note: if you intended to print `}`, you can escape it using `}}`

error: could not compile `debug_playground` due to previous error
```

This pull request fixes the wrong span for `invalid format string` error and also solves the ICE.
2022-11-16 08:36:11 +01:00
Matthias Krüger
91963cc244
Rollup merge of #103489 - WaffleLapkin:byte_offset_from_you, r=scottmcm
Make `pointer::byte_offset_from` more generic

As suggested by https://github.com/rust-lang/rust/issues/96283#issuecomment-1288792955 (cc ````@scottmcm),```` make `pointer::byte_offset_from` work on pointers of different types. `byte_offset_from` really doesn't care about pointer types, so this is totally fine and, for example, allows patterns like this:
```rust
ptr::addr_of!(x.b).byte_offset_from(ptr::addr_of!(x))
```

The only possible downside is that this removes the `T` == `U` hint to inference, but I don't think this matter much. I don't think there are a lot of cases where you'd want to use `byte_offset_from` with a pointer of unbounded type (and in such cases you can just specify the type).

````@rustbot```` label +T-libs-api
2022-11-16 08:36:10 +01:00
Matthias Krüger
5140bbd102
Rollup merge of #103484 - saschanaz:patch-2, r=ehuss
Add `rust` to `let_underscore_lock` example

Currently https://doc.rust-lang.org/beta/rustc/lints/listing/deny-by-default.html#let-underscore-lock has no colored grammar and raw `{{produces}}` command is exposed.
2022-11-16 08:36:10 +01:00
Ralf Jung
6906f08c13 allow fastrand dependency 2022-11-16 08:30:41 +01:00
bors
e702534763 Auto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm
Fix inconsistent rounding of 0.5 when formatted to 0 decimal places

As described in #70336, when displaying values to zero decimal places the value of 0.5 is rounded to 1, which is inconsistent with the display of other half-integer values which round to even.

From testing the flt2dec implementation, it looks like this comes down to the condition in the fixed-width Dragon implementation where an empty buffer is treated as a case to apply rounding up. I believe the change below fixes it and updates only the relevant tests.

Nevertheless I am aware this is very much a core piece of functionality, so please take a very careful look to make sure I haven't missed anything. I hope this change does not break anything in the wider ecosystem as having a consistent rounding behaviour in floating point formatting is in my opinion a useful feature to have.

Resolves #70336
2022-11-16 07:20:30 +00:00
Nicholas Nethercote
54082dd216 Merge basic blocks where possible when generating LLVM IR.
In `codegen_assert_terminator` we decide if a BB's successor is a
candidate for merging, which requires that it be the only successor, and
that it only have one predecessor. That result then gets passed down,
and if it reaches `funclet_br` with the appropriate BB characteristics,
then no `br` instruction is issued, a `MergingSucc::True` result is
passed back, and the merging proceeds in `codegen_block`.

The commit also adds `CachedLlbb`, a new type to help keep track of
each BB that has been merged into its predecessor.
2022-11-16 15:46:39 +11:00
Nicholas Nethercote
68194aa8d5 Use &mut Bx more.
For the next commit, `FunctionCx::codegen_*_terminator` need to take a
`&mut Bx` instead of consuming a `Bx`. This triggers a cascade of
similar changes across multiple functions. The resulting code is more
concise and replaces many `&mut bx` expressions with `bx`.
2022-11-16 15:46:39 +11: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
Stewart Russell
e6e29a8134
Update PROBLEMATIC_CONSTS in style.rs
added 3735932941, since 3735927486 was already present.
2022-11-15 21:19:47 -05: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
Michael Howell
7854883b44 rustdoc: remove no-op CSS #crate-search-div { display: inline-block }
`#crate-search-div` is nested directly below `.search-results-title`, which
has `display: inline-flex`. This makes the crate-search-div a [flex item],
which makes its display property irrelevant, because flex items have their
display [blockified] in any case.

[flex item]: https://developer.mozilla.org/en-US/docs/Glossary/Flex_Item
[blockified]: https://www.w3.org/TR/css-flexbox-1/#flex-items
2022-11-15 15:57:00 -07:00
Nicholas Nethercote
358a603f11 Use token::Lit in ast::ExprKind::Lit.
Instead of `ast::Lit`.

Literal lowering now happens at two different times. Expression literals
are lowered when HIR is crated. Attribute literals are lowered during
parsing.

This commit changes the language very slightly. Some programs that used
to not compile now will compile. This is because some invalid literals
that are removed by `cfg` or attribute macros will no longer trigger
errors. See this comment for more details:
https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-16 09:41:28 +11:00
Nicholas Nethercote
01760265cb Add some more bad suffix cases in a test. 2022-11-16 09:02:19 +11:00
Nicholas Nethercote
b8db4a34ef Add a test for different stages of lexer error reporting. 2022-11-16 09:02:19 +11:00
Michael Howell
74969ac2d1 rustdoc: remove pointless CSS .rightside { padding-right: 2px }
This CSS was added in 34bd2b845b, as
`.since { padding-right: 2px }`, to prevent it from uncomfortably touching
the srclink, which was a separate floated element. It was carried forward
with 962c0a4ee5 to the new `.rightside`, but
its role was replaced with adding " &bull; " between them. All it does now
is pushes the element 2px away from the page's right margin.

Removing this rule changes the page layout, but you have to look for it to
notice it.
2022-11-15 13:23:21 -07:00
Kagami Sascha Rosylight
0a528b16fc
Merge branch 'master' into patch-2 2022-11-15 21:16:11 +01:00
Michael Howell
5649cbb9f8 rustdoc: remove unused JS IIFE from main.js
This [IIFE] made sense when it was added in
f0683f98fa and there was a local variable
scoped to it, but now it only sets two globals, so it does nothing.

[IIFE]: https://developer.mozilla.org/en-US/docs/Glossary/IIFE "immediately invoked function expression"
2022-11-15 13:03:44 -07:00
Ralf Jung
5516273805 update lockfile 2022-11-15 20:06:42 +01:00
Nilstrieb
b7b67228f9
Only do parser recovery on retried macro matching
This prevents issues with eager parser recovery during macro matching.
2022-11-15 19:34:35 +01:00
bors
209bcbb178 Auto merge of #2667 - RalfJung:josh, r=RalfJung
adjust josh pushing, remove './miri toolchain HEAD/commit'

Looks like pushing works much better if we use as base commit the last commit we pulled from rustc and merged into Miri. Which I guess is fair. Conveniently, the `rust-version` file should usually be pretty much exactly that commit. Also adjust `rustc-pull` to update that file.

Pulling is now the way to update to a newer rustc, so I also removed `./miri toolchain HEAD`.
2022-11-15 18:28:02 +00:00
Ralf Jung
a47e431390 adjust josh pushing and remove ./miri toolchain updating the toolchain file 2022-11-15 19:27:14 +01:00