Commit Graph

162277 Commits

Author SHA1 Message Date
Matthias Krüger
5adef281d6
Rollup merge of #93226 - compiler-errors:issue-93141, r=jackh726
Normalize field access types during borrowck

I think a normalize was just left out here, since we normalize analogously throughout this file.

Fixes #93141
2022-01-23 20:13:05 +01:00
Matthias Krüger
552b564df0
Rollup merge of #93219 - cr1901:msp430-asm-squashed, r=Amanieu
Add preliminary support for inline assembly for msp430.

The `llvm_asm` macro was removed recently, and the MSP430 backend relies on inline assembly to build useful embedded apps. I conveniently "found" time to implement basic support for the new inline `asm` macro syntax with the help of `@Amanieu` :D.

In addition to tests in the compiler, I have tested this locally against deployed MSP430 code and have not found any noticeable differences in firmware operation or `objdump` disassemblies between the old `llvm_asm` and the new `asm` syntax.
2022-01-23 20:13:04 +01:00
Matthias Krüger
0f2ff4b270
Rollup merge of #93213 - c410-f3r:let-chains-feature, r=matthewjasper
Fix `let_chains` and `if_let_guard` feature flags

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

cc #53667
2022-01-23 20:13:03 +01:00
Matthias Krüger
bb260e8950
Rollup merge of #92555 - m-ou-se:scoped-threads, r=Amanieu
Implement RFC 3151: Scoped threads.

This implements https://github.com/rust-lang/rfcs/pull/3151

r? `@Amanieu`
2022-01-23 20:13:02 +01:00
Matthias Krüger
89baf0f162
Rollup merge of #91526 - petrochenkov:earlint, r=cjgillot
rustc_lint: Some early linting refactorings

The first one removes and renames some fields and methods from `EarlyContext`.

The second one uses the set of registered tools (for tool attributes and tool lints) in a more centralized way.

The third one removes creation of a fake `ast::Crate` from `fn pre_expansion_lint`.
Pre-expansion linting is done with per-module granularity on freshly loaded modules, and it previously synthesized an `ast::Crate` to visit non-root modules, now they are visited as modules.
The node ID used for pre-expansion linting is also made more precise (the loaded module ID is used).
2022-01-23 20:13:00 +01:00
Michael Goulet
4a74ace3c9 Liberate late bound regions when collecting GAT substs in wfcheck 2022-01-23 09:41:52 -08:00
Guillaume Gomez
d889a4ebac Fix brief appearance of rust logo in the sidebar 2022-01-23 18:04:41 +01:00
Thomas de Zeeuw
f2cdb57b94 Add os::unix::net::SocketAddr::unix
Creates a new SocketAddr from a path, supports both regular paths and
abstract namespaces.
2022-01-23 17:11:06 +01:00
bors
84322efad5 Auto merge of #93066 - nnethercote:infallible-decoder, r=bjorn3
Make `Decodable` and `Decoder` infallible.

`Decoder` has two impls:
- opaque: this impl is already partly infallible, i.e. in some places it
  currently panics on failure (e.g. if the input is too short, or on a
  bad `Result` discriminant), and in some places it returns an error
  (e.g. on a bad `Option` discriminant). The number of places where
  either happens is surprisingly small, just because the binary
  representation has very little redundancy and a lot of input reading
  can occur even on malformed data.
- json: this impl is fully fallible, but it's only used (a) for the
  `.rlink` file production, and there's a `FIXME` comment suggesting it
  should change to a binary format, and (b) in a few tests in
  non-fundamental ways. Indeed #85993 is open to remove it entirely.

And the top-level places in the compiler that call into decoding just
abort on error anyway. So the fallibility is providing little value, and
getting rid of it leads to some non-trivial performance improvements.

Much of this PR is pretty boring and mechanical. Some notes about
a few interesting parts:
- The commit removes `Decoder::{Error,error}`.
- `InternIteratorElement::intern_with`: the impl for `T` now has the same
  optimization for small counts that the impl for `Result<T, E>` has,
  because it's now much hotter.
- Decodable impls for SmallVec, LinkedList, VecDeque now all use
  `collect`, which is nice; the one for `Vec` uses unsafe code, because
  that gave better perf on some benchmarks.

r? `@bjorn3`
2022-01-23 15:37:43 +00:00
woppopo
5e97fc9aa2 Make NonNull::new const 2022-01-23 23:04:39 +09:00
bors
d976d8ad87 Auto merge of #8311 - dswij:8277, r=llogiq
fix `needless_question_mark` not considering async fn

closes #8277

changelog: [`needless_question_mark`] Fix FN on async functions
2022-01-23 12:59:52 +00:00
dswij
a05276620c fix needless_question_mark not considering async fn 2022-01-23 20:31:27 +08:00
bors
1e4067957b Auto merge of #93047 - matthiaskrgr:defer__dist_PlainSourceTarball, r=Mark-Simulacrum
build: dist: defer PlainSourceTarball

Apparently it changes some tool sources and invalidates their fingerprints, forcing us to build them several times (before and after vendoring sources).
I have not dug into why vendoring actually invalidates the figreprints, but moving the vendoring lower in the pipeline seems to avoid the issue.
I could imagine that we somehow write a .cargo/config somewhere which somehow makes subsequent builds use the vendored deps but I was not able to find anything.

I checked the sizes of generated archives pre and post patch and their are the same, so I hope there is no functional change.

Fixes #93033
2022-01-23 12:29:08 +00:00
Vadim Petrochenkov
aee89cdff1 Update clippy 2022-01-23 19:31:32 +08:00
Vadim Petrochenkov
67cccaff48 expand: Pass everything by reference to pre-expansion lint callback 2022-01-23 19:31:32 +08:00
Vadim Petrochenkov
05cd75504b rustc_lint: Stop creating a fake ast::Crate for running early lints
Add a trait generalizing over the crate root and freshly loaded modules instead
This also makes node IDs used for pre-expansion linting more precise
2022-01-23 19:31:32 +08:00
Vadim Petrochenkov
9c70b6d11b Update clippy 2022-01-23 19:31:32 +08:00
Conrad Ludgate
f00b02bb69 remove duplicate rule 2022-01-23 11:05:04 +00:00
Vadim Petrochenkov
245d559a90 rustc_lint: Reuse the set of registered tools from resolver 2022-01-23 18:51:51 +08:00
Vadim Petrochenkov
51b2338611 rustc_lint: Reuse the set of registered tools from resolver 2022-01-23 18:51:51 +08:00
Vadim Petrochenkov
452aa81770 rustc_lint: Remove some redundant fields from EarlyContext
Use consistent function parameter order for early context construction and early linting
Rename some functions to make it clear that they do not necessarily work on the whole crate
2022-01-23 18:51:51 +08:00
Conrad Ludgate
a0748d9436 tweak all sidebar colours 2022-01-23 10:43:06 +00:00
bors
16c1a9dd7c Auto merge of #93220 - matthiaskrgr:rollup-9bkrlk0, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #90666 (Stabilize arc_new_cyclic)
 - #91122 (impl Not for !)
 - #93068 (Fix spacing for `·` between stability and source)
 - #93103 (Tweak `expr.await` desugaring `Span`)
 - #93113 (Unify search input and buttons size)
 - #93168 (update uclibc instructions for new toolchain, add link from platforms doc)
 - #93185 (rustdoc: Make some `pub` items crate-private)
 - #93196 (Remove dead code from build_helper)

Failed merges:

 - #93188 (rustdoc: fix bump down typing search on Safari)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-23 09:16:32 +00:00
Conrad Ludgate
9c3ffd7681 adjust sidebar link brightness 2022-01-23 09:06:44 +00:00
woppopo
aa6795e2d4 Add intrinsics::const_deallocate 2022-01-23 15:13:44 +09:00
mark
cf382de0cc Remove DiagnosticBuilder.quiet 2022-01-23 00:11:13 -06:00
William D. Jones
19809ed76d Add preliminary support for inline assembly for msp430. 2022-01-22 23:42:46 -05:00
pierwill
4f89224f7f Use an indexmap to avoid sorting LocalDefIds
Update `indexmap` to 1.8.0.

Bless test
2022-01-22 22:34:16 -06:00
Michael Goulet
4ff7e6e3e3 Normalize field access types during borrowck 2022-01-22 20:05:05 -08:00
bors
788a8bc740 Auto merge of #8217 - Jarcho:needless_borrow_8191, r=camsteffen
Fix `needless_borrow` causing mutable borrows to be moved

fixes #8191

changelog: Fix `needless_borrow` causing mutable borrows to be moved
changelog: Rename `ref_in_deref` to `needless_borrow`
changelog: Suggest removing the borrow on method call receivers in `needless_borrow`
2022-01-23 03:01:39 +00:00
Jason Newcomb
c61514086d Subsume ref_in_deref into needless_borrow 2022-01-22 21:22:33 -05:00
bors
d13e8dd41d Auto merge of #93165 - eholk:disable-generator-drop-tracking, r=nikomatsakis
Disable drop range tracking in generators

Generator drop tracking caused an ICE for generators involving the Never type (Issue #93161). Since this breaks a test case with miri, we temporarily disable drop tracking so miri is unblocked while we properly fix the issue.
2022-01-23 02:20:50 +00:00
Jason Newcomb
9e9110e4f3 Remove final reference on fields and method calls in needless_borrow 2022-01-22 20:35:32 -05:00
Rune Tynan
92206318bc Add has tests for blanket_with_local trait methods 2022-01-22 19:55:25 -05:00
Alyssa Verkade
b885700c7b [borrowck] Fix help on mutating &self in async fns
Previously, when rustc was provided an async function that tried to
mutate through a shared reference to an implicit self (as shown in the
ui test), rustc would suggest modifying the parameter signature
to `&mut` + the fully qualified name of the ty (in the case of the repro
`S`). If a user modified their code to match the suggestion, the
compiler would not accept it.

This commit modifies the suggestion so that when rustc is provided the
ui test that is also attached in this commit, it suggests (correctly)
`&mut self`. We try to be careful about distinguishing between implicit
and explicit self annotations, since the latter seem to be handled
correctly already.

Fixes rust-lang/rust#93093
2022-01-22 16:21:16 -08:00
Matthias Krüger
1a935a52be
Rollup merge of #93196 - mati865:remove-build_helper-dead-code, r=Mark-Simulacrum
Remove dead code from build_helper

Tested with `./x.py check` ran on x86_64 Linux.
2022-01-23 01:09:47 +01:00
Matthias Krüger
d4c9c5ad66
Rollup merge of #93185 - camelid:crate-private, r=GuillaumeGomez
rustdoc: Make some `pub` items crate-private

They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.
2022-01-23 01:09:46 +01:00
Matthias Krüger
389e712a46
Rollup merge of #93168 - skrap:master, r=Amanieu
update uclibc instructions for new toolchain, add link from platforms doc

2 quick things:
1) `libc` was updated to make use of features in a uclibc version more recent than the recommended toolchain in the target document, so I updated the link.
2) As has been done with other platforms, link directly from the platform support doc to the target-specific document.
2022-01-23 01:09:45 +01:00
Matthias Krüger
74b05ce746
Rollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jsha
Unify search input and buttons size

Fixes #93060.

Here what it looks like:

![Screenshot from 2022-01-20 21-38-19](https://user-images.githubusercontent.com/3050060/150418571-fefd6538-b3ee-4dd2-b77b-77e96bcfa0ed.png)
![Screenshot from 2022-01-20 21-38-22](https://user-images.githubusercontent.com/3050060/150418570-53ba259b-9bd4-4084-8b43-d74a5752d712.png)

You can test it [here](https://rustdoc.crud.net/imperio/unify-sizes/std/index.html).

r? ``@jsha``
2022-01-23 01:09:44 +01:00
Matthias Krüger
a15252817a
Rollup merge of #93103 - estebank:await-span, r=nagisa
Tweak `expr.await` desugaring `Span`

Fix #93074
2022-01-23 01:09:43 +01:00
Matthias Krüger
24ac541de6
Rollup merge of #93068 - jsha:dot-spacing, r=GuillaumeGomez
Fix spacing for `·` between stability and source

This puts in an actual space (by adjusting the space-eating operators in our templates), updates the test, and remove the now-unnecessary CSS rule.

r? ``@GuillaumeGomez``
2022-01-23 01:09:42 +01:00
Matthias Krüger
55a1f8b955
Rollup merge of #91122 - dtolnay:not, r=m-ou-se
impl Not for !

The lack of this impl caused trouble for me in some degenerate cases of macro-generated code of the form `if !$cond {...}`, even without `feature(never_type)` on a stable compiler. Namely if `$cond` contains a `return` or `break` or similar diverging expression, which would otherwise be perfectly legal in boolean position, the code previously failed to compile with:

```console
error[E0600]: cannot apply unary operator `!` to type `!`
   --> library/core/tests/ops.rs:239:8
    |
239 |     if !return () {}
    |        ^^^^^^^^^^ cannot apply unary operator `!`
```
2022-01-23 01:09:41 +01:00
Matthias Krüger
59d9ad98b6
Rollup merge of #90666 - bdbai:arc_new_cyclic, r=m-ou-se
Stabilize arc_new_cyclic

This stabilizes feature `arc_new_cyclic` as the implementation has been merged for one year and there is no unresolved questions. The FCP is not started yet.

Closes #75861 .

``@rustbot`` label +T-libs-api
2022-01-23 01:09:40 +01:00
bors
10c4c4afec Auto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum
Update hashbrown to 0.12.0

[Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0120---2022-01-17)
2022-01-22 23:39:21 +00:00
Santiago Pastorino
e5f2fdb539
Restructure the code leveraging in abilities more than modes 2022-01-22 18:16:11 -03:00
Ibraheem Ahmed
32ab0b88f4 respect doc(hidden) when suggesting available fields 2022-01-22 15:48:45 -05:00
Caio
cbb0fffe59 Fix let_chains and if_let_guard feature flags 2022-01-22 17:45:45 -03:00
bors
bfe1564676 Auto merge of #93202 - matthiaskrgr:rollup-rki39xg, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #85967 (add support for the l4-bender linker on the x86_64-unknown-l4re-uclibc tier 3 target)
 - #92828 (Print a helpful message if unwinding aborts when it reaches a nounwind function)
 - #93012 (Update pulldown-cmark version to fix markdown list issue)
 - #93116 (Simplify use of `map_or`)
 - #93132 (Increase the format version of rustdoc-json-types)
 - #93147 (Interner cleanups)
 - #93153 (Reject unsupported naked functions)
 - #93170 (Add missing GUI test explanations)
 - #93172 (rustdoc: remove dashed underline under main heading)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-22 19:26:42 +00:00
Jonah Petri
ab5437e861 update uclibc instructions for new toolchain, add link from platforms doc 2022-01-22 14:16:52 -05:00
Guillaume Gomez
9f30dd9cbc Remove unneeded cursor pointer rule on mobile sidebar 2022-01-22 19:43:25 +01:00