Commit Graph

167815 Commits

Author SHA1 Message Date
Ralf Jung
5b20da8180 interpret: debug-check ScalarPair layout information 2022-05-04 22:52:02 +02:00
Oli Scherer
0d5a738b8b Enable tracing for all queryies 2022-05-04 16:15:26 +00:00
bors
343889b723 Auto merge of #96683 - nnethercote:speed-up-Token-ident-lifetime, r=petrochenkov
Speed up `Token::{ident,lifetime}`

Some speed and cleanliness improvements.

r? `@petrochenkov`
2022-05-04 15:24:02 +00:00
bors
c7a705a842 Auto merge of #8575 - FoseFx:trim_split_whitespace2, r=flip1995
add `trim_split_whitespace`

Closes #8521

changelog: [`trim_split_whitespace`]
2022-05-04 13:31:19 +00:00
Guillaume Gomez
67d1e7b8ff Improve Rc::new_cyclic and Arc::new_cyclic documentation 2022-05-04 15:20:02 +02:00
bors
751fd0d735 Auto merge of #8780 - Alexendoo:init-numbered-field-alias, r=flip1995
Ignore type aliases in `init_numbered_fields`

changelog: Ignore type aliases in [`init_numbered_fields`]

Fixes #8638
2022-05-04 13:17:35 +00:00
Max Baumann
fea177fafe
add trim_split_whitespace 2022-05-04 15:04:05 +02:00
bors
364bf39e31 Auto merge of #94775 - oli-obk:operand_order, r=davidtwco
Fix constants not getting dropped if part of a diverging expression

fixes https://github.com/rust-lang/rust/issues/90762

cc `@RalfJung`
2022-05-04 12:54:02 +00:00
kraktus
519aa6e4d7 update jemallocator example to use 2018 edition import syntax 2022-05-04 13:43:33 +02:00
Josh Triplett
0fc5c524f5 Stabilize bool::then_some 2022-05-04 13:22:08 +02:00
bors
25674202bb Auto merge of #96695 - JohnTitor:rollup-oo4fc1h, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #96597 (openbsd: unbreak build on native platform)
 - #96662 (Fix typo in lint levels doc)
 - #96668 (Fix flaky rustdoc-ui test because it did not replace time result)
 - #96679 (Quick fix for #96223.)
 - #96684 (Update `ProjectionElem::Downcast` documentation)
 - #96686 (Add some TAIT-related tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-04 09:55:51 +00:00
Oli Scherer
db02e61038 Generate an intermediate temporary for Drop constants.
To limit the fallout from this, don't do this for the last (or only) operand in an rvalue.
2022-05-04 09:09:52 +00:00
Yuki Okushi
2ca778fb09
Rollup merge of #96686 - JohnTitor:impl-trait-tests, r=oli-obk
Add some TAIT-related tests

Closes #53398
Closes #58662
Closes #89952
Closes #94429

r? `@oli-obk` as you're familiar with it
2022-05-04 17:13:16 +09:00
Yuki Okushi
731ad8a3c1
Rollup merge of #96684 - tmiasko:mir-downcast, r=petrochenkov
Update `ProjectionElem::Downcast` documentation

`ProjectionElem:::Downcast` is used when downcasting to a variant of
an enum or a generator, regardless of the number of variants.
2022-05-04 17:13:15 +09:00
Yuki Okushi
d0a7a4c6e6
Rollup merge of #96679 - ricked-twice:issue-96223-fix, r=jackh726
Quick fix for #96223.

This PR is a quick fix regarding #96223.

As mentioned in the issue, others modification could be added to not elide types with bound vars from suggestions.

Special thanks to ``@jackh726`` for mentoring and ``@Manishearth`` for minimal test case.

r? ``@jackh726``
2022-05-04 17:13:14 +09:00
Yuki Okushi
b255bf9eb4
Rollup merge of #96668 - GuillaumeGomez:fix-rustdoc-ui-flaky-test, r=petrochenkov
Fix flaky rustdoc-ui test because it did not replace time result

As mentioned in https://github.com/rust-lang/rust/pull/93715: a test is flaky because I forgot to replace the time value.

This PR fixes it.

r? ``@petrochenkov``
2022-05-04 17:13:13 +09:00
Yuki Okushi
33d507a986
Rollup merge of #96662 - rockboynton:master, r=GuillaumeGomez
Fix typo in lint levels doc
2022-05-04 17:13:12 +09:00
Yuki Okushi
91e5a47aae
Rollup merge of #96597 - semarie:split_debuginfo-unix, r=davidtwco,Mark-Simulacrum
openbsd: unbreak build on native platform

after #95612, only linux and windows target are build with `-Zunstable-options`, but others platforms might use `-Csplit-debuginfo`

currently, without this PR, the build of rustc on OpenBSD fails with:

```
Building stage0 tool unstable-book-gen (x86_64-unknown-openbsd)
running: "/data/semarie/build-rust/install_dir/beta/bin/cargo" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path"
"/data/semarie/build-rust/build_dir/rustc-nightly-src/src/tools/unstable-book-gen/Cargo.toml" "--message-format" "json-render-diagnostics"
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/data/semarie/build-rust/build_dir/build/bootstrap/debug/rustc - --crate-name ___ --print=file-names --cfg=bootstrap -Csymbol-mangling-version=v0 -Zmacro-backtrace -Clink-args=-Wl,-z,origin
'-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Csplit-debuginfo=off -Ztls-model=initial-exec --target x86_64-unknown-openbsd --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro
--print=sysroot --print=cfg` (exit status: 1)
  --- stdout

  Did not run successfully: exit status: 1
  "/data/semarie/build-rust/install_dir/beta/bin/rustc" "-" "--crate-name" "___" "--print=file-names" "--cfg=bootstrap" "-Csymbol-mangling-version=v0" "-Zmacro-backtrace" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib"
"-Csplit-debuginfo=off" "-Ztls-model=initial-exec" "--target" "x86_64-unknown-openbsd" "--crate-type" "bin" "--crate-type" "rlib" "--crate-type" "dylib" "--crate-type" "cdylib" "--crate-type" "staticlib" "--crate-type" "proc-macro"
"--print=sysroot" "--print=cfg" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/data/semarie/build-rust/install_dir/beta"
  -------------

  --- stderr
  error: `-Csplit-debuginfo` is unstable on this platform

command did not execute successfully: "/data/semarie/build-rust/install_dir/beta/bin/cargo.bin" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path"
```

I am suspecting that all unix might be affected, but I am unsure about the right conditional to use. so I only added "openbsd" target inside it as I am able to test it.

rustc nightly built correctly with this PR on openbsd.
2022-05-04 17:13:11 +09:00
bors
fed2c43bbf Auto merge of #96693 - ehuss:update-cargo, r=ehuss
Update cargo

7 commits in f63f23ff1f1a12ede8585bbd1bbf0c536e50293d..a44758ac805600edbb6ba51e7e6fb81a6077c0cd
2022-04-28 03:15:50 +0000 to 2022-05-04 02:29:34 +0000
- Add support for `-Zbuild-std` to `cargo fetch` (rust-lang/cargo#10129)
- Migrate tests of `cargo-init` to snapbox (rust-lang/cargo#10620)
- dedupe toml_edit crate, followup rust-lang/cargo#10603 (rust-lang/cargo#10619)
- Update GitHub Actions actions/checkout@v2 to v3 (rust-lang/cargo#10618)
- Integrate snapbox in with cargo-test-support (rust-lang/cargo#10581)
- Fix zsh completion (rust-lang/cargo#10613)
- Update documentation for workspace inheritance (rust-lang/cargo#10611)
2022-05-04 07:31:58 +00:00
Oli Scherer
afcd33a6fc Add regression test 2022-05-04 07:26:09 +00:00
Jack Huey
8e31cdefc4 Revert #92191 Prefer projection candidates instead of param_env candidates for Sized predicates 2022-05-04 01:55:23 -04:00
Eric Huss
22326c56cc Update cargo 2022-05-03 22:48:05 -07:00
bors
21d613b111 Auto merge of #96447 - petrochenkov:docregr, r=GuillaumeGomez
rustdoc: Resolve doc links on fields during early resolution

Another subset of https://github.com/rust-lang/rust/pull/94857 which fixes https://github.com/rust-lang/rust/issues/96429.

This case regressed in https://github.com/rust-lang/rust/pull/96135 when `may_have_doc_links`-based filtering was introduced.
Before that filtering structs could collect traits in scope for their fields, but after the filtering structs won't collect anything if they don't have doc comments on them, so we have to visit fields too.
2022-05-04 05:01:47 +00:00
Folyd
67ebeea7a0 Move callback to the () => {} syntax.
Fix lint

Fix main.js

Restore anonymous functions

Fix

Fix more
2022-05-04 11:10:48 +08:00
bors
9add63257b Auto merge of #96353 - estebank:issue-95413, r=compiler-errors
When suggesting to import an item, also suggest changing the path if appropriate

When we don't find an item we search all of them for an appropriate
import and suggest `use`ing it. This is sometimes done for expressions
that have paths with more than one segment. We now also suggest changing
that path to work with the `use`.

Fix #95413
2022-05-04 01:58:23 +00:00
Yuki Okushi
81a4f4bd69
Add some TAIT-related tests 2022-05-04 09:17:47 +09:00
Nicholas Nethercote
5022d764cf Show invisible delimeters (within comments) when pretty printing. 2022-05-04 10:06:06 +10:00
bors
1b2e0b60cc Auto merge of #95380 - compiler-errors:unit-destructure-assign, r=nikomatsakis
Fix unit struct/enum variant in destructuring assignment

See https://github.com/rust-lang/rfcs/blob/master/text/2909-destructuring-assignment.md#guide-level-explanation, "including **unit** and tuple structs"

Fixes #94319
2022-05-03 22:29:58 +00:00
bors
a10fe902d2 Auto merge of #8779 - binggh:easier-needless-late-init, r=llogiq
Easier readability for `needless_late_init` message

Closes #8530

Updated the lint to use a `MultiSpan`, showing where the `let` statement was first used and where the initialisation statement was done, as in the format described, for easier readability.

Was wondering why, when pushing the span label for the initialisation statement, that sometimes the prior statement above the initialisation statement gets pulled into the output as well - any insight is appreciated!

---

changelog: [`needless_late_init`]: Now shows the `let` statement where it was first initialized
2022-05-03 20:42:35 +00:00
Tomasz Miąsko
a63d414031 Update ProjectionElem::Downcast documentation
`ProjectionElem:::Downcast` is used when downcasting to a variant of
an enum or a generator, regardless of the number of variants.
2022-05-03 22:29:51 +02:00
ricked-twice
574bee35fb
Taking review hints into account. 2022-05-03 22:23:30 +02:00
Nicholas Nethercote
1d2e172935 Remove unnecessary NtIdent in Token::is_whole_expr.
The comment on this function explains that it's a specialized version of
`maybe_whole_expr`. But `maybe_whole_expr` doesn't do anything with
`NtIdent`, so `is_whole_expr` also doesn't need to.
2022-05-04 06:15:36 +10:00
Nicholas Nethercote
bbef9756ea Fix spelling of an identifier. 2022-05-04 06:15:36 +10:00
Nicholas Nethercote
637a93cb5d Speed up Token::{ident,lifetime}.
They're hot enough that the repeated matching done by `uninterpolate`
has a measurable effect.
2022-05-04 06:15:29 +10:00
bors
e1b71feb59 Auto merge of #96558 - bjorn3:librarify_parse_format, r=davidtwco
Make rustc_parse_format compile on stable

This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.
2022-05-03 20:03:54 +00:00
bors
8be86fcf35 Auto merge of #96558 - bjorn3:librarify_parse_format, r=davidtwco
Make rustc_parse_format compile on stable

This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.
2022-05-03 20:03:54 +00:00
ricked-twice
bfcd191905
Quick fix for #96223. 2022-05-03 21:16:03 +02:00
Joshua Nelson
cd63b22e80 Add more tests for label-break-value 2022-05-03 14:09:52 -05:00
Guillaume Gomez
56c2769de3 Fix flaky rustdoc-ui test because it did not replace time result 2022-05-03 20:46:02 +02:00
bors
38b7a041cc Auto merge of #8783 - flip1995:ouir-nursery, r=llogiq
Move only_used_in_recursion to nursery

r? `@llogiq`

I still think this is the right thing to do for this lint. See: #8782

I want to get this merged before the sync on Thursday, because I want to backport this and the last fix #8691 to beta.

changelog: Move [`only_used_in_recursion`] to nursery
2022-05-03 18:06:52 +00:00
ridwanabdillahi
175a4eab84 Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB.
Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries.

Merge the queries for debugger visualizers into a single query.

Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`.

Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate.

Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature.

Respond to PR comments and minor cleanups.
2022-05-03 10:53:54 -07:00
bors
086bf7a8ff Auto merge of #96280 - lygstate:ffi-fixes, r=joshtriplett
library/core: Fixes implement of c_uint, c_long, c_ulong

Fixes: aa67016624 ("make memcmp return a value of c_int_width instead of i32")
Introduce c_num_definition to getting the cfg_if logic easier to maintain
Add newlines for easier code reading

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2022-05-03 17:22:58 +00:00
Yoshiki Matsuda
4698a3fb8a ignore the doctest for map 2022-05-04 00:53:46 +09:00
flip1995
1834f326c4
Move only_used_in_recursion to nursery 2022-05-03 16:41:12 +01:00
Gary Guo
6baaa527ce Allow inline consts to reference generic params 2022-05-03 15:22:03 +01:00
Oli Scherer
efc6a6f1bd Report that opaque types are not allowed in impls even in the presence of other errors 2022-05-03 13:53:53 +00:00
Gary Guo
bf4d7fa43f Hide InlineConst's generic arg during print
The generic arg is for type inference only and shouldn't be exposed
to users.
2022-05-03 14:37:16 +01:00
Alex Macleod
d53293d52a Ignore type aliases in init_numbered_fields 2022-05-03 14:28:27 +01:00
Martin Geisler
9a1dc2a0a2 Remove hard links from env::current_exe security example
The security example shows that `env::current_exe` will return the
path used when the program was started. This is not really surprising
considering how hard links work: after `ln foo bar`, the two files are
_equivalent_. It is _not_ the case that `bar` is a “link” to `foo`,
nor is `foo` a link to `bar`. They are simply two names for the same
underlying data.

The security vulnerability linked to seems to be different: there an
attacker would start a SUID binary from a directory under the control
of the attacker. The binary would respawn itself by executing the
program found at `/proc/self/exe` (which the attacker can control).
This is a real problem. In my opinion, the example given here doesn’t
really show the same problem, it just shows a misunderstanding of what
hard links are.

I looked through the history a bit and found that the example was
introduced in #33526. That PR actually has two commits, and the
first (8478d48dad) explains the race
condition at the root of the linked security vulnerability. The second
commit proceeds to replace the explanation with the example we have
today.

This commit reverts most of the second commit from #33526.
2022-05-03 14:49:04 +02:00
Loïc BRANSTETT
81d2cba36f Enable cfg checking of cargo features for everything but std 2022-05-03 14:27:15 +02:00