Commit Graph

196393 Commits

Author SHA1 Message Date
bors
06f4950cbd Auto merge of #100032 - BoxyUwU:no_ty_in_placeholder_const, r=compiler-errors
make `PlaceholderConst` not store the type of the const

Currently the `Placeholder` variant on `ConstKind` is 28 bytes when with this PR its 8 bytes, i am not sure this is really useful at all rn since `Unevaluated` and `Value` variants are huge still but eventually it should be possible to get both down to 16 bytes 🤔. Mostly opening this to see if this change has any perf impact when done before it can make `ConstKind`/`ConstS` smaller
2022-08-02 13:10:49 +00:00
bors
792bc5a010 Auto merge of #99977 - BlackHoleFox:cfte-cstr, r=thomcc
Add validation to const fn CStr creation

Improves upon the existing validation that only worked when building the stdlib from source. `CStr::from_bytes_with_nul_unchecked` now utilizes `const_eval_select` to validate the safety requirements of the function when used as `const FOO: &CStr = CStr::from_bytes_with_nul_unchecked(b"Foobar\0");`.

This can help catch erroneous code written by accident and, assuming a new enough `rustc` in use, remove the need for boilerplate safety comments for this function in `const` contexts.

~~I think this might need a UI test, but I don't know where to put it. If this is a worth change, a perf run would be nice to make sure the `O(n)` validation isn't too bad. I didn't notice a difference building the stdlib tests locally.~~
2022-08-02 09:07:31 +00:00
bors
ca37a45232 Auto merge of #100048 - matthiaskrgr:rollup-agimvm6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #99156 (`codegen_fulfill_obligation` expect erased regions)
 - #99293 (only run --all-targets in stage0 for Std)
 - #99779 (Fix item info pos and height)
 - #99994 (Remove `guess_head_span`)
 - #100011 (Use Parser's `restrictions` instead of `let_expr_allowed`)
 - #100017 (kmc-solid: Update `Socket::connect_timeout` to be in line with #78802)
 - #100037 (Update rustc man page to match `rustc --help`)
 - #100042 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-02 06:09:22 +00:00
Matthias Krüger
6ab19fd4f5
Rollup merge of #100042 - ehuss:update-books, r=ehuss
Update books

## reference

2 commits in a92be0fef439b3d8e0468d82cb24812d303520a0..f3d3953bf3b158d596c96d55ce5366f9f3f972e9
2022-07-21 19:01:23 -0700 to 2022-08-01 17:17:37 -0700
- Add `let_chains` references (rust-lang/reference#1179)
- Remove outdated warning (rust-lang/reference#1243)

## rust-by-example

18 commits in 3155db49b0d57cd82c65456ac210b69ecec5ccb1..ee342dc91e1ba1bb1e1f1318f84bbe3bfac04798
2022-07-05 20:35:53 -0300 to 2022-07-27 11:06:36 -0300
- Closure inferred twice (rust-lang/rust-by-example#1588)
- fix a syntax bug in example assembly (rust-lang/rust-by-example#1511)
- Minor grammar change in src/std/rc.md paragraph 2 (rust-lang/rust-by-example#1586)
- Fix typo in asm.md (rust-lang/rust-by-example#1585)
- Fix incorrect padding in fixed-width print (rust-lang/rust-by-example#1584)
- Update print.md (rust-lang/rust-by-example#1582)
- add-chapter-on-defaults (rust-lang/rust-by-example#1580)
- Fix typo (rust-lang/rust-by-example#1579)
- fix a compile error (rust-lang/rust-by-example#1578)
- Suggest using mod.rs pattern to share test code (rust-lang/rust-by-example#1577)
- fix a compile error in iter_any.md (rust-lang/rust-by-example#1576)
- Mention attribute like macros in attributes.md (rust-lang/rust-by-example#1574)
- Update exercise to be clearer (rust-lang/rust-by-example#1573)
- fixes link for turbofish in testcase_mapreduce.md (rust-lang/rust-by-example#1572)
- Fix inconsistency between comment and code in hello/print.md (rust-lang/rust-by-example#1571)
- Fixes a typo in print.md (rust-lang/rust-by-example#1570)
- into_iter-moves-elements (rust-lang/rust-by-example#1569)
- Fix a typo in print.md (rust-lang/rust-by-example#1568)

## rustc-dev-guide

16 commits in d5201cddace979b299ec1bf9fd8997338151aa9d..04f3cf0bb2f5a6ee2bfc4b1a6a6cd8c11d1c5531
2022-07-21 04:48:49 +0200 to 2022-07-31 07:46:57 +0200
- address review comment
- accept review suggestion
- try address review comments
- summary of chapter
- Update src/building/compiler-documenting.md
- revamp doc-build chapter
- minor fixes
- Prefer relative links
- Fix the link to clippy docs
- Fix the link to `ResolverAstLowering`
- Fix the link to `ProcMacro` trait
- Fix the link to `Lazy<T>`
- Add instructions to fix build errors in std after adding a new target
- Document how to build a cross-compiler
- Add documentation about Microsoft provided debuggers and CodeView/PDB… (rust-lang/rustc-dev-guide#1406)
- rust-analyzer is now a subtree

## embedded-book

2 commits in 766979590da8100998f0d662499d4a901d8d1640..befe6840874311635c417cf731377f07234ee373
2022-07-04 09:13:58 +0000 to 2022-07-25 07:51:14 +0000
- Updated instructions for running first Hardware example  (rust-embedded/book#323)
- Improved ligability for hardware.md  (rust-embedded/book#324)
2022-08-02 07:30:47 +02:00
Matthias Krüger
703ee5c3f4
Rollup merge of #100037 - fw-immunant:patch-1, r=jyn514
Update rustc man page to match `rustc --help`

This brings the `--crate-type`,  `--emit`, and `--print` options' allowed arguments into sync with that printed by `rustc --help`.

c.f. the `opt::multi_s` calls for `"crate-type"`, `"emit"`, and `"print"` here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_session/src/config.rs
2022-08-02 07:30:46 +02:00
Matthias Krüger
042bba799b
Rollup merge of #100017 - solid-rs:patch/kmc-solid/adapt-to-78802, r=thomcc
kmc-solid: Update `Socket::connect_timeout` to be in line with #78802

Fixes the build failure of the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets after #78802.

```
error[E0308]: mismatched types
   --> library\std\src\sys\solid\net.rs:234:45
    |
234 |             cvt(netc::connect(self.0.raw(), addrp, len))
    |                 -------------               ^^^^^ expected *-ptr, found union `SocketAddrCRepr`
    |                 |
    |                 arguments to this function are incorrect
    |
    = note: expected raw pointer `*const sockets::sockaddr`
                     found union `SocketAddrCRepr`
note: function defined here
   --> library\std\src\sys\solid\abi\sockets.rs:173:12
    |
    173 |     pub fn connect(s: c_int, name: *const sockaddr, namelen: socklen_t) -> c_int;
    |            ^^^^^^^
```
2022-08-02 07:30:45 +02:00
Matthias Krüger
beb4cdddde
Rollup merge of #100011 - compiler-errors:let-chain-restriction, r=fee1-dead
Use Parser's `restrictions` instead of `let_expr_allowed`

This also means that the `ALLOW_LET` flag is reset properly for subexpressions, so we can properly deny things like `a && (b && let c = d)`. Also the parser is a tiny bit smaller now.

It doesn't reject _all_ bad `let` expr usages, just a bit more.

cc `@c410-f3r`
2022-08-02 07:30:44 +02:00
Matthias Krüger
17f76a16f9
Rollup merge of #99994 - TaKO8Ki:remove-guess-head-span, r=fee1-dead
Remove `guess_head_span`

follow-up to #98519
2022-08-02 07:30:43 +02:00
Matthias Krüger
96908527ca
Rollup merge of #99779 - GuillaumeGomez:fix-item-info-pos-and-height, r=notriddle
Fix item info pos and height

Fixes https://github.com/rust-lang/rust/issues/98266.
Fixes https://github.com/rust-lang/rust/issues/98343.

You can test it [here](https://rustdoc.crud.net/imperio/fix-item-info-pos-and-height/lib2/trait.Trait.html).

Here is a screenshot of the result:

![Screenshot from 2022-07-26 21-55-53](https://user-images.githubusercontent.com/3050060/181100624-18b8b045-5c25-4c7c-9c44-97d55d29b675.png)

r? `@jsha`
2022-08-02 07:30:41 +02:00
Matthias Krüger
3357470fb7
Rollup merge of #99293 - jo3bingham:issue-98720-fix, r=jyn514
only run --all-targets in stage0 for Std

Repro'd the issue with `python3 x.py check --stage 1 library/std` and tested the fix with the same command.

r? `@jyn514`

I tried to implement [this solution](https://github.com/rust-lang/rust/issues/98720#issuecomment-1184435462), but didn't have any luck. I don't think I fully understood what needed to be done. However, I would love to be mentored on it since it would be a more correct solution, and I can learn more about how bootstrap works.
2022-08-02 07:30:40 +02:00
Matthias Krüger
0629445300
Rollup merge of #99156 - lcnr:omoe-wa, r=wesleywiser
`codegen_fulfill_obligation` expect erased regions

it's a query, so by erasing regions before calling it, we get better caching.
This doesn't actually change anything as its already the status quo.
2022-08-02 07:30:39 +02:00
bors
9538d2d0f1 Auto merge of #99431 - yaahc:error-in-core, r=joshtriplett
Remove `fn backtrace` and replace with usages of provider API

This PR is part of moving error into core and has been split to facilitate review.
2022-08-02 03:25:41 +00:00
Takayuki Maeda
a3c2d55356 remove a SourceMap::guess_head_span 2022-08-02 11:40:23 +09:00
Eric Huss
1bdb0ab6e9 Update books 2022-08-01 18:57:55 -07:00
bors
9d5cd21a5d Auto merge of #100033 - rylev:no-cancel-try-perf, r=Mark-Simulacrum
Don't cancel try-perf branch if 'outdated'

`try-perf` just like the `try` branch should always run all jobs to completion. This allows us to use the branch like a queue.

r? `@Mark-Simulacrum`
2022-08-02 00:39:17 +00:00
Ryan Levick
debb75aa44 Don't cancel try-perf branch if 'outdated' 2022-08-01 18:50:58 -04:00
Frances Wingerter
9864db6c76
Update rustc man page to match rustc --help
This brings the `--crate-type`,  `--emit`, and `--print` options' allowed arguments into sync with that printed by `rustc --help`.
2022-08-01 22:03:18 +00:00
bors
21de280ccc Auto merge of #95884 - cjgillot:assoc-item, r=lcnr
Thin `AssocItem`

This PR removes a few fields from `AssocItem` that should be easily computed using other queries.
This simplifies some of the metadata decoding.
2022-08-01 21:43:35 +00:00
Jane Losare-Lusby
b2bbca3933 remove fn backtrace 2022-08-01 20:10:40 +00:00
Camille GILLOT
212a06ee69 Match on TraitItem exhaustively. 2022-08-01 21:39:59 +02:00
Camille GILLOT
6c5f077157 Bless incremental tests. 2022-08-01 21:39:56 +02:00
Camille GILLOT
957548183d Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
Camille GILLOT
d7ea161b7e Remove DefId from AssocItemContainer. 2022-08-01 21:38:45 +02:00
Camille GILLOT
8ee4446ee5 Remove visibility from AssocItem. 2022-08-01 21:38:20 +02:00
Camille GILLOT
110f0656cb Store associated item defaultness in impl_defaultness. 2022-08-01 21:38:16 +02:00
Ellen
49d001c5f3 fmt... 2022-08-01 20:15:58 +01:00
Joseph Bingham
c5d661a01c add comment 2022-08-01 20:15:33 +01:00
bors
fe3342816a Auto merge of #99476 - dpaoliello:rawdylibvectorcall, r=michaelwoerister
Add tests for raw-dylib with vectorcall, and fix vectorcall code generation

* Adds tests for using `raw-dylib` (#58713) with `vectorcall`.
* Fixed code generation for `vectorcall` (parameters have to be marked with `InReg`, just like `fastcall`).
* Enabled running the `raw-dylib` `fastcall` tests when using MSVC (since I had to add support in the test for running MSVC-only tests since GCC doesn't support `vectorcall`).
2022-08-01 18:43:57 +00:00
bors
c9e134e1b6 Auto merge of #100024 - matthiaskrgr:rollup-36ab4wx, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #99340 (Fix ICE in Definitions::create_def)
 - #99629 (Improve `cannot move out of` error message)
 - #99864 (bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty)
 - #99911 (Remove some uses of `guess_head_span`)
 - #99976 (Make Rustdoc exit with correct error code when scraping examples from invalid files)
 - #100003 (Improve size assertions.)
 - #100012 (Avoid `Ty` to `String` conversions)
 - #100020 (better error when python is not found in x - issue #99648)

Failed merges:

 - #99994 (Replace `guess_head_span` with `opt_span`)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-01 15:40:43 +00:00
Matthias Krüger
058ea7a955
Rollup merge of #100020 - CallumIO:issue-99648, r=jyn514
better error when python is not found in x - issue #99648

`x` now shows an appropriate error message and exits, when a version of `python` is not found on the users `PATH`.

Resolves #99648
2022-08-01 16:49:35 +02:00
Matthias Krüger
4606830f83
Rollup merge of #100012 - TaKO8Ki:avoid-ty-to-string-conversions, r=fee1-dead
Avoid `Ty` to `String` conversions

follow-up to #98668
2022-08-01 16:49:34 +02:00
Matthias Krüger
e6bb00fff5
Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqd
Improve size assertions.

- For any file with four or more size assertions, move them into a
  separate module (as is already done for `hir.rs`).
- Add some more for AST nodes and THIR nodes.
- Put the `hir.rs` ones in alphabetical order.

r? `@lqd`
2022-08-01 16:49:33 +02:00
Matthias Krüger
1fa02dd3e9
Rollup merge of #99976 - willcrichton:example-analyzer, r=jyn514
Make Rustdoc exit with correct error code when scraping examples from invalid files

This PR fixes a small issue with the new Rustdoc scrape-examples feature. If a file that is being scraped has a type error, then currently that error is printed out, but the rustdoc process exits as if it succeeded. This is a problem for Cargo, which needs to track whether scraping succeeded (see rust-lang/cargo#10343).

This PR fixes the issue by checking whether an error is emitted, and aborting if so.
2022-08-01 16:49:32 +02:00
Matthias Krüger
8db3d7cfb6
Rollup merge of #99911 - cjgillot:no-guess, r=davidtwco
Remove some uses of `guess_head_span`

That function cuts a span at the first occurrence of `{`.  Using `def_span` is almost always more precise.
2022-08-01 16:49:31 +02:00
Matthias Krüger
1530ed8373
Rollup merge of #99864 - klensy:bootstrap-art-dupe, r=jyn514
bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty

Example (https://github.com/rust-lang-ci/rust/runs/7551453940?check_suite_focus=true#step:25:15008):
```
 duplicate artifacts found when compiling a tool, this typically means that something was recompiled because a transitive dependency has different features activated than in a previous build:

the following dependencies are duplicated although they have the same features enabled:
the following dependencies have different features:
  memchr 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)
    `clippy-driver` additionally enabled features {} at "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-freebsd/release/deps/libmemchr-44aa6ff4f08e293f.rlib"
    `cargo` additionally enabled features {"use_std"} at "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-freebsd/release/deps/libmemchr-70e29af0fd3ef292.rlib"
```

Notice that no info printed under  `the following dependencies are duplicated although they have the same features enabled:`
2022-08-01 16:49:30 +02:00
Matthias Krüger
f9aa989eac
Rollup merge of #99629 - obeis:issue-99470, r=compiler-errors
Improve `cannot move out of` error message

Closes #99470
r? `@bjorn3`
2022-08-01 16:49:28 +02:00
Matthias Krüger
58042bffac
Rollup merge of #99340 - GoldsteinE:fix-localdefid-debug-ice, r=lcnr
Fix ICE in Definitions::create_def

`Debug` implementation for `LocalDefId` uses global `Definitions`. Normally it’s ok, but we can’t do it while holding a mutable reference to `Definitions`, since it causes ICE or deadlock (depending on whether `parallel_compiler` is enabled).

This PR effectively copies the `Debug` implementation into the problematic method. I don’t particularly love this solution (since it creates code duplication), but I don’t see any other options.

This issue was discovered when running `rustdoc` with `RUSTDOC_LOG=trace` on the following file:
```rust
pub struct SomeStruct;

fn asdf() {
    impl SomeStruct {
        pub fn qwop(&self) {
            println!("hidden function");
        }
    }
}
```

I’m not sure how to create a test for this behavior.
2022-08-01 16:49:27 +02:00
Ellen
825a7cc65c make PlaceholderConst not store the type of the const 2022-08-01 15:42:38 +01:00
Goldstein
d9f28b7b70
fix ICE in Definitions::create_def 2022-08-01 16:15:55 +03:00
bors
dcb444af0a Auto merge of #99884 - nnethercote:lexer-improvements, r=matklad
Lexer improvements

Some cleanups and small speed improvements.

r? `@matklad`
2022-08-01 12:52:49 +00:00
Callum Leslie
fcf1f958ac
fix: better error when python not found in x
chore: clean comments to be relevant
2022-08-01 13:33:59 +01:00
Will Crichton
a93feaf6e1 Make Rustdoc exit with correct error code when scrape examples from invalid files 2022-08-01 00:23:19 -07:00
Tomoaki Kawada
bfbda81107 kmc-solid: Adapt to a recent change in the IntoInner impl of SocketAddr
`(x: SocketAddr).into_inner()` evaluates to `(SocketAddrCRepr,
socklen_t)` instead of `(*const sockaddr, socklen_t)` as of
commit 55e23db13.
2022-08-01 16:08:24 +09:00
bors
1f5d8d49eb Auto merge of #98246 - joshtriplett:times, r=m-ou-se
Support setting file accessed/modified timestamps

Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.
2022-08-01 06:44:43 +00:00
bors
25bb1c13bd Auto merge of #99944 - bjorn3:hide_proc_macro_symbols, r=eddyb
Limit symbols exported from proc macros

Only `__rustc_proc_macro_decls_*__` and `rust_metadata_*` need to be
exported for proc macros to work. All other symbols only increase binary
size and have the potential to conflict with symbols from the host
compiler.

Fixes https://github.com/rust-lang/rust/issues/99909
Fixes #59998

cc `@eddyb`
2022-08-01 03:58:52 +00:00
Takayuki Maeda
92b31ccb73 avoid Ty to String conversions 2022-08-01 12:52:30 +09:00
Michael Goulet
6be7a87f9c Use expr parse restrictions for let expr parsing 2022-08-01 01:13:16 +00:00
bors
6423ab3a75 Auto merge of #99998 - matthiaskrgr:rollup-igafy0r, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #99519 (Remove implicit names and values from `--cfg` in `--check-cfg`)
 - #99620 (`-Z location-detail`: provide option to disable all location details)
 - #99932 (Fix unwinding on certain platforms when debug assertions are enabled)
 - #99973 (Layout things)
 - #99980 (Remove more Clean trait implementations)
 - #99984 (Fix compat.rs for `cfg(miri)`)
 - #99986 (Add wrap suggestions for record variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-01 01:11:08 +00:00
Nicholas Nethercote
9037ebba0c Improve size assertions.
- For any file with four or more size assertions, move them into a
  separate module (as is already done for `hir.rs`).
- Add some more for AST nodes and THIR nodes.
- Put the `hir.rs` ones in alphabetical order.
2022-08-01 09:15:05 +10:00
Nicholas Nethercote
99f5c79d64 Shrink Token.
From 72 bytes to 12 bytes (on x86-64).

There are two parts to this:
- Changing various source code offsets from 64-bit to 32-bit. This is
  not a problem because the rest of rustc also uses 32-bit source code
  offsets. This means `Token` is no longer `Copy` but this causes no
  problems.
- Removing the `RawStrError` from `LiteralKind`. Raw string literal
  invalidity is now indicated by a `None` value within
  `RawStr`/`RawByteStr`, and the new `validate_raw_str` function can be
  used to re-lex an invalid raw string literal to get the `RawStrError`.

There is one very small change in behaviour. Previously, if a raw string
literal matched both the `InvalidStarter` and `TooManyHashes` cases,
the latter would override the former. This has now changed, because
`raw_double_quoted_string` now uses `?` and so returns immediately upon
detecting the `InvalidStarter` case. I think this is a slight
improvement to report the earlier-detected error, and it explains the
change in the `test_too_many_hashes` test.

The commit also removes a couple of comments that refer to #77629 and
say that the size of these types don't affect performance. These
comments are wrong, though the performance effect is small.
2022-08-01 08:53:04 +10:00