Commit Graph

225150 Commits

Author SHA1 Message Date
jyn
157d936c31 Stop normalizing so many different prefixes
Previously, we would normalize *all* of
- the absolute path to the repository checkout
- the /rustc/$sha for stage1 (if `remap-debuginfo` was enabled)
- the /rustc/$sha for download-rustc
- the sysroot for download-rustc

Now, we consistently only normalize /rustc/FAKE_PREFIX. Not only is this
much simpler, but it also avoids ongoing maintenance for download-rustc
and makes it much less likely that tests break by accident.

- Change `tests/ui/track-diagnostics/track6.rs` to use a relative path
  instead of an absolute one. I am not actually sure why `track_caller`
works here, but it does seem to work 🤷

- Pass `-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX` to all
  suites, not just UI. In particular, mir-opt tests emit /rustc/ paths
  in their output.
2023-05-26 12:16:30 -05:00
asquared31415
b19466abc2 improve error message for calling a method on a raw pointer with an unknown pointee, and add some tests 2023-05-26 13:15:15 -04:00
jyn
60e95e76d0 Update proc-macro-api for the new rustc metadata format 2023-05-26 11:59:25 -05:00
bohan
f78369b3af fix: dedup static_candidates before report 2023-05-27 00:52:07 +08:00
Guillaume Gomez
c908d1e4de Update tests for re-exports of doc hidden macros 2023-05-26 17:31:54 +02:00
Guillaume Gomez
3802ba0f6a Fix re-export of doc hidden macro not showing up 2023-05-26 17:31:11 +02:00
Oli Scherer
164d041e30 Stop creating intermediate places just to immediate convert them to operands 2023-05-26 15:01:29 +00:00
Boxy
ad77bc8427 print const and type errors in braces not square brackets 2023-05-26 16:01:29 +01:00
Oli Scherer
5f66c41921 Add regression test 2023-05-26 15:00:31 +00:00
ozkanonur
c7cec29215 add rustdoc-gui-test tool in triagebot.toml 2023-05-26 17:00:31 +03:00
Pietro Albini
c5139b9136
add reasoning for introducing a metrics format version 2023-05-26 15:25:21 +02:00
Pietro Albini
7040d4102f
rename metadata_version to format_version
The new name is more accurate.
2023-05-26 15:21:21 +02:00
jyn
62314be705 Load only the header for crate_matches
Previously, we used the following info to determine whether to load the crate:
1. The METADATA_HEADER, which includes a METADATA_VERSION constant
2. The embedded rustc version
3. Various metadata in the `CrateRoot`, including the SVH

This worked ok most of the time. Unfortunately, when building locally the rustc version is always
the same because `omit-git-hash` is on by default. That meant that we depended only on 1 and 3, and
we are not very good about bumping METADATA_VERSION (it's currently at 7) so in practice we were
only depending on 3. `CrateRoot` is a very large struct and changes somewhat regularly, so this led
to a steady stream of crashes from trying to load it.

Change the logic to add an intermediate step between 2 and 3: introduce a new `CrateHeader` struct
that contains only the minimum info needed to decide whether the crate should be loaded or not. That
avoids having to load all of `CrateRoot`, which in practice means we should crash much less often.

Note that this works because the SVH should be different between any two dependencies, even if the
compiler has changed, because we use `-Zbinary-dep-depinfo` in bootstrap. See
https://github.com/rust-lang/rust/pull/111329#issuecomment-1538303474 for more details about how the
original crash happened.
2023-05-26 07:44:37 -05:00
jyn
39f337ab95 Make errors from x doc less verbose
before:
```
error: could not document `bootstrap`

Caused by:
  process didn't exit successfully: `/home/jyn/src/rust/build/bootstrap/debug/rustdoc ... --crate-version '1.71.0
  (eb9da7bfa
  2023-05-25)
  (a
  long
  description
  goes
  here)' --document-private-items --enable-index-page --show-type-layout --generate-link-to-definition -Zunstable-options` (exit status: 1)
```

after:
```
error: could not document `bootstrap`

Caused by:
  process didn't exit successfully: `/home/jyn/src/rust/build/bootstrap/debug/rustdoc ... --crate-version '1.71.0        (eb9da7bfa      2023-05-25)     (a     long     description    goes     here)' --document-private-items --enable-index-page --show-type-layout --generate-link-to-definition -Zunstable-options` (exit status: 1)
```
2023-05-26 07:40:57 -05:00
bors
917b0b6c70 Auto merge of #111562 - clubby789:speedup-bootstrap-py, r=jyn514
Improve startup time of bootstrap

~~If the user has a `build/host` symlink set up, we can determine the target triple by reading it rather than invoking rustc. This significantly reduces startup time of bootstrap once any kind of build has been done~~
New approach explained below
```
➜  hyperfine -p 'git checkout -q master' -N './x.py -h' -r 50
Benchmark 1: ./x.py -h
  Time (mean ± σ):     140.7 ms ±   2.6 ms    [User: 99.9 ms, System: 39.3 ms]
  Range (min … max):   136.8 ms … 149.6 ms    50 runs

➜  rust git:(master) hyperfine -p 'git checkout -q speedup-bootstrap-py' -N './x.py -h' -r 50
Benchmark 1: ./x.py -h
  Time (mean ± σ):      95.2 ms ±   1.5 ms    [User: 67.7 ms, System: 26.7 ms]
  Range (min … max):    92.9 ms …  99.6 ms    50 runs
```

Also a small microoptimisation in using string splitting rather than regex when reading toml, which saves a few more milliseconds (2-5 testing locally), but less important.

Profiling shows the remaining runtime is around half setting up the Python runtime, and the vast majority of the remaining time is spent in subprocess building and running bootstrap itself, so probably can't be improved much further.
2023-05-26 11:52:25 +00:00
clubby789
9a86ceb049 Improve startup time for bootstrap.py 2023-05-26 10:40:55 +00:00
klensy
9b6a6b13c5 deps: bump crates
update iana-time-zone-haiku to drop bumch of cxx* deps
cargo update -p iana-time-zone-haiku
    Updating crates.io index
    Updating cc v1.0.77 -> v1.0.79
    Removing codespan-reporting v0.11.1
    Removing cxx v1.0.94
    Removing cxx-build v1.0.94
    Removing cxxbridge-flags v1.0.94
    Removing cxxbridge-macro v1.0.94
    Updating iana-time-zone-haiku v0.1.1 -> v0.1.2
    Removing link-cplusplus v1.0.8
    Removing scratch v1.0.5

fixes known issue https://github.com/crossbeam-rs/crossbeam/pull/972
cargo update -p crossbeam-channel
    Updating crates.io index
    Updating crossbeam-channel v0.5.6 -> v0.5.8

dedupes memoffset versions
cargo update -p crossbeam-epoch
    Updating crates.io index
    Updating crossbeam-epoch v0.9.13 -> v0.9.14
    Removing memoffset v0.7.1

dedupes bstr versions
cargo update -p ignore -p opener
    Updating crates.io index
    Removing bstr v0.2.17
    Updating globset v0.4.9 -> v0.4.10
    Updating ignore v0.4.18 -> v0.4.20
    Updating opener v0.5.0 -> v0.5.2
2023-05-26 13:03:47 +03:00
sladynnunes
aa67ae2d9d Formatted file correctly 2023-05-26 02:28:20 -07:00
sladynnunes
df98e3e6ec Fixed tests 2023-05-26 02:22:00 -07:00
lcnr
b6b9611190 remove unnecessary .ok() calls 2023-05-26 11:07:20 +02:00
lcnr
e7fa993d89 do not prefer substs relate during coherence 2023-05-26 11:00:06 +02:00
bors
1221e43bdf Auto merge of #111984 - matthiaskrgr:rollup-6u7ynyv, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #111384 (Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files)
 - #111899 (CGU cleanups)
 - #111940 (Clarify safety concern of `io::Read::read` is only relevant in unsafe code)
 - #111947 (Add test for RPIT defined with different hidden types with different substs)
 - #111951 (Correct comment on privately uninhabited pattern.)

Failed merges:

 - #111954 (improve error message for calling a method on a raw pointer with an unknown pointee)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-26 08:58:40 +00:00
sladynnunes
9078fd51d6 Fix failing CI 2023-05-26 01:19:34 -07:00
onestacked
6827a413c8 Blesses UI tests, add known bug to typeid-equality-by-subtyping 2023-05-26 09:53:05 +02:00
Pietro Albini
cb68c05151
address review feedback 2023-05-26 09:47:21 +02:00
Matthias Krüger
dd74ae0929
Rollup merge of #111951 - cjgillot:uninh-comment, r=Nadrieril
Correct comment on privately uninhabited pattern.

Follow-up to https://github.com/rust-lang/rust/pull/111624#discussion_r1204767933

r? `@Nadrieril`
2023-05-26 08:24:09 +02:00
Matthias Krüger
39b633ece4
Rollup merge of #111947 - obeis:issue-111943, r=compiler-errors
Add test for RPIT defined with different hidden types with different substs

Close #111943
2023-05-26 08:24:08 +02:00
Matthias Krüger
2daecf7c45
Rollup merge of #111940 - zirconium-n:io-read-doc-change, r=thomcc
Clarify safety concern of `io::Read::read` is only relevant in unsafe code

We have this clarification note in other similar place like [Iterator::size_hint](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.size_hint).

The lack of clarification might lead to confusion to Rust beginners. [Relevant URLO post](https://users.rust-lang.org/t/can-read-overflow-a-buffer/94347).
2023-05-26 08:24:08 +02:00
Matthias Krüger
78cc117f7b
Rollup merge of #111899 - nnethercote:cgu-cleanups, r=wesleywiser
CGU cleanups

Some code clarity improvements I found when reading this code closely.

r? ``@wesleywiser``
2023-05-26 08:24:07 +02:00
Matthias Krüger
42c7b8a7de
Rollup merge of #111384 - bmisiak:issue-106021-fix, r=petrochenkov
Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files

Hello. My first rustc PR!

Issue #106021 prevents Rust code from being linked into Mac Catalyst applications. Apple's LD has started requiring object files to contain version information about the platform they were built for, such as:
* the "deployment target" (minimum supported OS version),
* the SDK version
* the type of the platform (macOS/iOS/catalyst/tvOS/watchOS all have a different number).

This is currently only enforced when building for Mac Catalyst.

Rust uses the `object` crate which added support for including this information starting with `0.31.0`. ~~I upgraded it along with `thorin-dwp` so that everything depends on 0.31.
Apparently 0.31 [pulls in](https://github.com/gimli-rs/object/issues/463) `ruzstd` due to a [new ELF standard](https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections) because its `compression` feature is enabled by thorin. If you find this objectionable, let me know what the best way to avoid pulling in those dependencies might be.~~

**(`object` upgraded in https://github.com/rust-lang/rust/pull/111413)**

I then added two commits:
* The first one adds very basic, hard-coded support for calling `set_macho_build_version` for `-macabi` (Catalyst) targets, where it claims deployment target of Catalyst 14.0 and SDK of 16.2.
* The second weaves the versioning through `rust_target::spec::TargetOptions`, so that we can stick to specifying all target-related info in one place.

Kudos to ``@ara4n`` for writing [this gist](https://gist.github.com/ara4n/320a53ea768aba51afad4c9ed2168536).
2023-05-26 08:24:07 +02:00
Deadbeef
be44860ab9 fix for Self not respecting tuple Ctor privacy
This fixes #111220 by checking the privacy of tuple constructors using `Self`, so the following code now errors

```rust
mod my {
    pub struct Foo(&'static str);
}

impl AsRef<str> for my::Foo {
    fn as_ref(&self) -> &str {
        let Self(s) = self; // previously compiled, now errors correctly
        s
    }
}
```
2023-05-26 06:23:03 +00:00
bors
be72f2587c Auto merge of #111918 - compiler-errors:custom-type-ops-err, r=lcnr
Use `ErrorGuaranteed` more in MIR type ops

Delay bugs more eagerly and pass them through type op infra instead of delaying them at all the usage-sites.

Follow up to: https://github.com/rust-lang/rust/pull/111741#discussion_r1203840588

r? `@lcnr`
2023-05-26 06:20:21 +00:00
jyn
6674dcda7a respect CARGOFLAGS in bootstrap.py 2023-05-25 22:42:12 -05:00
bors
c86212f9bc Auto merge of #111858 - clubby789:fluent-alphabetical, r=jyn514,compiler-errors
Ensure Fluent messages are in alphabetical order

Fixes #111847

This adds a tidy check to ensure Fluent messages are in alphabetical order, as well as sorting all existing messages. I think the error could be worded better, would appreciate suggestions.

<details>
<summary>Script used to sort files</summary>

```py
import sys
import re

fn = sys.argv[1]
with open(fn, 'r') as f:
    data = f.read().split("\n")

chunks = []
cur = ""
for line in data:
    if re.match(r"^([a-zA-Z0-9_]+)\s*=\s*", line):
        chunks.append(cur)
        cur = ""
    cur += line + "\n"
chunks.append(cur)
chunks.sort()

with open(fn, 'w') as f:
    f.write(''.join(chunks).strip("\n\n") + "\n")
```
</details>
2023-05-26 03:31:04 +00:00
jyn
b084c525d3 Generate docs for bootstrap itself
This verifies the intra-doc links are correct, and hopefully makes
things easier for new contributors.
2023-05-25 21:43:13 -05:00
Markus Everling
ea327915d8 Update current implementation comments for select_nth_unstable 2023-05-26 01:31:04 +00:00
clubby789
f97fddab91 Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
Ben Kimock
e1b8fad664 Add #[inline] to array TryFrom impls 2023-05-25 18:24:27 -04:00
Michael Howell
52bd82f522 rustc_data_structures: sync and atomic consistency
Co-authored-by: @lukas-code
2023-05-25 15:18:05 -07:00
Michael Howell
64cfc21289 bootstrap: use RUSTC_BOOTSTRAP in distcheck 2023-05-25 15:12:33 -07:00
bors
0004b3b984 Auto merge of #111960 - compiler-errors:rollup-onka2dl, r=compiler-errors
Rollup of 7 pull requests

Successful merges:

 - #107522 (Add Median of Medians fallback to introselect)
 - #111152 (update `pulldown-cmark` to `0.9.3`)
 - #111757 (Consider lint check attributes on match arms)
 - #111831 (Always capture slice when pattern requires checking the length)
 - #111929 (Don't print newlines in APITs)
 - #111945 (Migrate GUI colors test to original CSS color format)
 - #111950 (Remove ExpnKind::Inlined.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-25 22:04:33 +00:00
Nicholas Nethercote
e6b99a6521 Add struct for the return type of place_root_mono_items.
As per review request.
2023-05-26 07:28:02 +10:00
Obei Sideg
b37cdc67be Add test for RPIT defined with different hidden types with different substs 2023-05-26 00:14:12 +03:00
Nicholas Nethercote
ee013d83c3 Avoid some unnecessary local attr variables. 2023-05-26 07:00:26 +10:00
Michael Goulet
c2e3521bfb
Rollup merge of #111950 - cjgillot:expn-noinline, r=oli-obk
Remove ExpnKind::Inlined.

Suggested in https://github.com/rust-lang/rust/pull/111815#issuecomment-1561903339

r? ``@oli-obk``
2023-05-25 13:58:02 -07:00
Michael Goulet
cb5b40269f
Rollup merge of #111945 - GuillaumeGomez:migrate-gui-test-color-7, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? ``@notriddle``
2023-05-25 13:58:01 -07:00
Michael Goulet
5227b68493
Rollup merge of #111929 - compiler-errors:no-newline-apit, r=wesleywiser
Don't print newlines in APITs

This is kind of a hack, but it gets the job done because the only "special" formatting that (afaict) `rustc_ast_pretty` does is break with newlines sometimes.

Fixes rust-lang/measureme#207
2023-05-25 13:58:01 -07:00
Michael Goulet
dbdb509467
Rollup merge of #111831 - clubby789:capture-slice-pat, r=cjgillot
Always capture slice when pattern requires checking the length

Fixes #111751

cc ``@zirconium-n,`` I see you were assigned to this but I've fixed some similar issues in the past and had an idea on how to investigate this.
2023-05-25 13:58:00 -07:00
Michael Goulet
9d4527bc80
Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholk
Consider lint check attributes on match arms

Currently, lint check attributes on match arms have no effect for some lints. This PR makes some lint passes to take those attributes into account.

- `LateContextAndPass` for late lint doesn't update `last_node_with_lint_attrs` when it visits match arms. This leads to lint check attributes on match arms taking no effects on late lints that operate on the arms' pattern:

  ```rust
  match value {
      #[deny(non_snake_case)]
      PAT => {} // `non_snake_case` only warned due to default lint level
  }
  ```

  To be honest, I'm not sure whether this is intentional or just an oversight. I've dug the implementation history and searched up issues/PRs but couldn't find any discussion on this.

- `MatchVisitor` doesn't update its lint level when it visits match arms. This leads to check lint attributes on match arms taking no effect on some lints handled by this visitor, namely: `bindings_with_variant_name` and `irrefutable_let_patterns`.

  This seems to be a fallout from #108504. Before 05082f57af, when the visitor operated on HIR rather than THIR, check lint attributes for the said lints were effective. [This playground][play] compiles successfully on current stable (1.69) but fails on current beta and nightly.

  I wasn't sure where best to place the test for this. Let me know if there's a better place.

[play]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=38432b79e535cb175f8f7d6d236d29c3
[play-match]: https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=629aa71b7c84b269beadeba664e2221d
2023-05-25 13:58:00 -07:00
Michael Goulet
bd7e8b5ef9
Rollup merge of #111152 - lukas-code:markdown-parsers-are-hard, r=GuillaumeGomez
update `pulldown-cmark` to `0.9.3`

This PR updates `pulldown-cmark` to version `0.9.3`, which does two main things:
* Pulls in https://github.com/raphlinus/pulldown-cmark/pull/643 to fix https://github.com/rust-lang/rust/issues/111117
* Allows parsing strikethrough with single tildes, e.g. `~foo~` -> ~foo~. This matches the [GFM spec](https://github.github.com/gfm/#strikethrough-extension-).

Full changelog: https://github.com/raphlinus/pulldown-cmark/pull/646
2023-05-25 13:57:59 -07:00