Commit Graph

227141 Commits

Author SHA1 Message Date
Matthias Krüger
3616388139
Rollup merge of #112620 - AntoniosBarotsis:master, r=Nilstrieb
Fix small typo

Fixes a small typo in the [`Successors`](https://doc.rust-lang.org/std/iter/struct.Successors.html) documentation.
2023-06-14 18:10:32 +02:00
Matthias Krüger
77b307ff20
Rollup merge of #112613 - GuillaumeGomez:fix-gui-test-windows, r=notriddle
Fix rustdoc-gui tests on Windows

The browser-ui-test update contains fixes needed for backslash handling (they were not correctly escaped).

Since we have a mix of slash and backslash in some tests, I replaced `DOC_FOLDER` variable backslashes with slashes.

And finally it seemed like the unicode escaped wasn't much appreciated on Windows for some reason so I used the character directly.

cc `@klensy`
r? `@notriddle`
2023-06-14 18:10:32 +02:00
Matthias Krüger
41d5aeccec
Rollup merge of #112612 - sginnett:issue-105150, r=compiler-errors
Fix explicit-outlives-requirements lint span

Fixes #105150 which caused the span reported by the explicit-outlives-requirements lint to be incorrect when
1) the lint should suggest the entire where clause to be removed and
2) there are inline bounds present that are not inferable outlives requirements

In particular, this would cause rustfix to leave a dangling empty where clause.
2023-06-14 18:10:31 +02:00
Matthias Krüger
8aff1122c6
Rollup merge of #112611 - compiler-errors:unconstrained-lt-in-rpitit, r=oli-obk
Error on unconstrained lifetime in RPITIT

Fixes #109468

The only thing is that I had to split `tests/ui/impl-trait/in-trait/method-signature-matches.rs` into a bunch of different revisions because some error aren't being emitted if all the different examples are all together in one file 🤔

r? `@oli-obk` just because i know you'll review it, feel free to re-roll
2023-06-14 18:10:31 +02:00
Matthias Krüger
c1b4d075a2
Rollup merge of #112506 - compiler-errors:const-infer-ice, r=b-naber
Properly check associated consts for infer placeholders

We only reported an error if it was in a "suggestable" position (according to `is_suggestable_infer_ty`) -- this isn't correct for infer tys that can show up in other places in the constant's type, like behind a dyn trait.

fixes #112491
2023-06-14 18:10:30 +02:00
Matthias Krüger
7240943b28
Rollup merge of #112605 - compiler-errors:negative-docs, r=spastorino
Improve docs/clean up negative overlap functions

Clean up some functions in ways that should not affect behavior, change some names to be clearer (`negative_impl` and `implicit_negative` are not really clear imo), and add some documentation examples.

r? `@spastorino`
2023-06-14 18:10:30 +02:00
Matthias Krüger
502ac47f8a
Rollup merge of #112600 - celinval:stable-mir-rvalue, r=oli-obk
Introduce a `Stable` trait to translate MIR to SMIR

This PR introduces a trait `Stable` which defines a type `T` and a `stable()` method to convert the current type to its stable MIR version.

This change is just an implementation detail, and I wanted to get some feedback to whether it would be cleaner than having the `rustc_<type>_to_<type>()` methods for every type we translate to SMIR.

r? `@oli-obk`
r? `@spastorino`
2023-06-14 18:10:30 +02:00
Matthias Krüger
38ed4e5a5c
Rollup merge of #112109 - Alexendoo:unsupported-split-debuginfo, r=b-naber
Don't print unsupported split-debuginfo modes with `-Zunstable-options`

Currently unsupported `split-debuginfo` options are enabled by `-Zunstable-options`, for projects that have `-Zunstable-options` for other reasons this can be [an unexpected interaction](https://github.com/rust-lang/rust-clippy/pull/10516#issuecomment-1562604764)

This PR makes it so that `--print split-debuginfo -Zunstable-options` doesn't print unsupported modes, so that a cargo config of e.g.

```toml
[profile.dev]
split-debuginfo = "unpacked"
```

Would not cause an unsupported mode to be enabled on `x86_64-pc-windows-msvc`
2023-06-14 18:10:29 +02:00
Matthias Krüger
2759a7d2f1
Rollup merge of #112584 - loongarch-rs:remove-env, r=petrochenkov
loongarch64-none*: Remove environment component from llvm target

A warning is reported when the LLVM triple-implied ABI conflicts with the provided target-abi.

```
warning: triple-implied ABI conflicts with provided target-abi ‘lp64s', using target-abi
```

Specifically, the ABI hint comes from the environment component of the triple. When only the target-abi is provided and no environment, there is no conflict. This PR removes the environment component from the LLVM target name of the `loongarch64-unknown-none-softfloat` target.
2023-06-14 18:10:29 +02:00
Matthias Krüger
c451f7bedb
Rollup merge of #111974 - Sp00ph:update_guarantees, r=Amanieu
Update runtime guarantee for `select_nth_unstable`

#106933 changed the runtime guarantee for `select_nth_unstable` from O(n) to O(n log n), since the old guarantee wasn't actually met by the implementation at the time. Now with #107522, `select_nth_unstable` should be truly linear in runtime, so we can revert its runtime guarantee to O(n). Since #106933 was considered a bug fix, this will probably need an FCP because it counts as a new API guarantee.

r? `@Amanieu`
2023-06-14 18:10:29 +02:00
Matthias Krüger
b8f71eaf01
Rollup merge of #109814 - est31:stabilize_string_leak, r=Amanieu
Stabilize String::leak

Stabilizes the following API:

```Rust
impl String {
    pub fn leak(self) -> &'static mut str;
}
```

closes #102929

blocked by having an FCP for stabilization.
2023-06-14 18:10:28 +02:00
Matthias Krüger
d54bb505d0
Rollup merge of #107619 - stepancheg:hash-set-insert, r=Amanieu
Specify behavior of HashSet::insert

`HashSet::insert` does not replace the value with equal value.

Fixes #107581.
2023-06-14 18:10:28 +02:00
Matthias Krüger
4efdb5c001
Rollup merge of #98202 - aticu:impl_tryfrom_osstr_for_str, r=Amanieu
Implement `TryFrom<&OsStr>` for `&str`

Recently when trying to work with `&OsStr` I was surprised to find this `impl` missing.

Since the `to_str` method already existed the actual implementation is fairly non-controversial, except for maybe the choice of the error type. I chose an opaque error here instead of something like `std::str::Utf8Error`, since that would already make a number of assumption about the underlying implementation of `OsStr`.

As this is a trait implementation, it is insta-stable, if I'm not mistaken?
Either way this will need an FCP.
I chose "1.64.0" as the version, since this is unlikely to land before the beta cut-off.

`@rustbot` modify labels: +T-libs-api

API Change Proposal: rust-lang/rust#99031 (accepted)
2023-06-14 18:10:27 +02:00
Pavel Grigorenko
cfe2e4660d
Mention env! in option_env!'s docs 2023-06-14 18:29:08 +03:00
danakj
4b83156a5c Move the comment on fixing paths to where it belongs 2023-06-14 10:58:08 -04:00
Antonios Barotsis
cb093fc648 Fix typo 2023-06-14 16:52:29 +02:00
danakj
7e07271eaf Avoid absolute sysroot paths in the MSVC linker command line
When the `--sysroot` is specified as relative to the current working
directory, the sysroot's rlibs should also be specified as relative
paths. Otherwise, the current working directory ends up in the
absolute paths, and in the linker command line. And the entire linker
command line appears in the PDB file generated by the MSVC linker.

When adding an rlib to the linker command line, if the rlib's canonical
path is in the sysroot's canonical path, then use the current sysroot
path + filename instead of the full absolute path to the rlib. This
means that when `--sysroot=foo` is specified, the linker command line
will contain `foo/rustlib/target/lib/lib*.rlib` instead of the full
absolute path to the same.

This addresses https://github.com/rust-lang/rust/issues/112586
2023-06-14 10:44:00 -04:00
bors
9c967d3809 Auto merge of #15053 - Veykril:crate-root-module-id, r=Veykril
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
2023-06-14 14:41:06 +00:00
Guillaume Gomez
fced6383c2 Fix href attribute value check on Windows (DOC_PATH lacks an extra /) 2023-06-14 16:23:05 +02:00
bors
afa9fef709 Auto merge of #112418 - ferrocene:pa-mir-opt-panic, r=ozkanonur,saethlin
Add support for targets without unwinding in `mir-opt`, and improve `--bless` for it

The main goal of this PR is to add support for targets without unwinding support in the `mir-opt` test suite, by adding the `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment. Similarly to 32bit vs 64bit, when that comment is present, blessed output files will have the `.panic-unwind` or `.panic-abort` suffix, and the right one will be chosen depending on the target's panic strategy.

The `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment replaced all the `ignore-wasm32` comments in the `mir-opt` test suite, as those comments were added due to `wasm32` being a target without unwinding support. The comment was also added on other tests that were only executed on x86 but were still panic strategy dependent.

The `mir-opt` suite was then blessed, which caused a ton of churn as most of the existing output files had to be renamed and (mostly) duplicated with the abort strategy.

---

After [asking on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mir-opt.20tests.20and.20panic.3Dabort), the main concern about this change is it'd make blessing the `mir-opt` suite even harder, as you'd need to both bless it with an unwinding target and an aborting target. This exacerbated the current situation, where you'd need to bless it with a 32bit and a 64bit target already.

Because of that, this PR also makes significant enhancements to `--bless` for the `mir-opt` suite, where it will automatically bless the suite four times with different targets, while requiring minimal cross-compilation.

To handle the 32bit vs 64bit blessing, there is now an hardcoded list of target mapping between 32bit and 64bit. The goal of the list is to find a related target that will *probably* work without requiring additional cross-compilation toolchains on the system. If a mapping is found, bootstrap will bless the suite with both targets, otherwise just with the current target.

To handle the panic strategy blessing (abort vs unwind), I had to resort to what I call "synthetic targets". For each of the target we're blessing (so either the current one, or a 32bit and a 64bit depending on the previous paragraph), bootstrap will extract the JSON spec of the target and change it to include `"panic-strategy": "abort"`. It will then build the standard library with this synthetic target, and bless the `mir-opt` suite with it.

As a result of these changes, blessing the `mir-opt` suite will actually bless it two or four times with different targets, ensuring all possible variants are actually blessed.

---

This PR is best reviewed commit-by-commit.

r? `@jyn514`
cc `@saethlin` `@oli-obk`
2023-06-14 14:20:59 +00:00
jyn
be9b1334a0 Suggest bumping download-ci-llvm-stamp if the build config for llvm is changed 2023-06-14 09:01:40 -05:00
Lukas Wirth
cf178cba8f internal: Add a CrateRootModuleId that encodes a module id that is always a crate root 2023-06-14 15:41:06 +02:00
ponyii
b07490ffe9 made the add_missing_impl_members and add_missing_default_members assists transform default generic types 2023-06-14 17:37:34 +04:00
Pietro Albini
f67809ac1d
yet another dry run fix 2023-06-14 15:14:19 +02:00
Rémy Rakic
9395e2771a make mir dataflow graphviz dumps opt-in 2023-06-14 12:30:13 +00:00
bors
51939db8d3 Auto merge of #15052 - lnicola:fmt-arguments, r=Veykril
minor: Rename minicore ArgumentV1 to match libcore
2023-06-14 12:13:58 +00:00
bors
7b0eac438a Auto merge of #112400 - WaffleLapkin:vtable_stats, r=compiler-errors
Collect VTable stats & add `-Zprint-vtable-sizes`

This is a bit hacky/buggy, but I'm not entirely sure how to fix it, so I want to ask reviewers for help...

To try this, use either of those:
- `cargo clean && RUSTFLAGS="-Zprint-vtable-sizes" cargo +toolchain b`
- `cargo clean && cargo rustc +toolchain -Zprint-vtable-sizes`
- `rustc +toolchain -Zprint-vtable-sizes ./file.rs`
2023-06-14 11:24:42 +00:00
Guillaume Gomez
df9a46f60f Replace unicode value with character in shortcuts.goml test 2023-06-14 10:37:56 +02:00
Guillaume Gomez
fd4320ca07 Transform backslash into slashes in DOC_FOLDER variable for browser-ui-test 2023-06-14 10:37:56 +02:00
Guillaume Gomez
2f9fac024c Update browser-ui-test version to 0.16.7 2023-06-14 10:37:56 +02:00
bors
3ed2a10d17 Auto merge of #110662 - bryangarza:safe-transmute-reference-types, r=compiler-errors
Safe Transmute: Enable handling references

This patch enables support for references in Safe Transmute, by generating nested obligations during trait selection. Specifically, when we call `confirm_transmutability_candidate(...)`, we now recursively traverse the `rustc_transmute::Answer` tree and create obligations for all the `Answer` variants, some of which include multiple nested `Answer`s.
2023-06-14 08:26:22 +00:00
The 8472
0c5f442db4 update miri test 2023-06-14 09:28:56 +02:00
The 8472
479be6ac43 update hashbrown and replace Hash{Set,Map}::DrainFilter with ExtractIf 2023-06-14 09:28:56 +02:00
The 8472
18c9a12d13 remove hash_drain_filter feature uses 2023-06-14 09:28:56 +02:00
The 8472
114d5f221c s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
The 8472
b7ce7edd87 remove drain-on-drop behavior from linked_list::DrainFilter and add #[must_use] 2023-06-14 09:24:51 +02:00
The 8472
b687e84aeb remove drain-on-drop behavior from BTree{Set,Map}::DrainFilter and add #[must_use] 2023-06-14 09:24:51 +02:00
The 8472
c0df1c8c43 remove drain-on-drop behavior from vec::DrainFilter and add #[must_use] 2023-06-14 09:24:51 +02:00
Sam Ginnett
72531b7463 Fix explicit-outlives-requirements lint span 2023-06-13 23:04:00 -07:00
bors
57c215b08e Auto merge of #112609 - matthiaskrgr:rollup-er6weld, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #112197 (Erase regions even if normalization fails in writeback (in new solver))
 - #112495 (fix(resolve): update shadowed_glob more precision)
 - #112520 (Fix the overflow issue for transmute_generic_consts)
 - #112571 (rustdoc-search: search never type with `!`)
 - #112581 ([rustdoc] Fix URL encoding of % sign)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-14 05:37:08 +00:00
Michael Goulet
bc78d0cbf1 Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
Scott McMurray
e94f26a40a Bump stdarch 2023-06-13 21:45:04 -07:00
Laurențiu Nicola
6d6354e5b5 Rename minicore ArgumentV1 to match libcore 2023-06-14 07:33:37 +03:00
Matthias Krüger
623b1d4b62
Rollup merge of #112581 - TumoiYorozu:fix_url_encoding_of_percent_sign, r=notriddle
[rustdoc] Fix URL encoding of % sign

Fix #112580

The % is encoded as %%, but the correct encoding is %25.
2023-06-14 06:25:50 +02:00
Matthias Krüger
e3021b4a42
Rollup merge of #112571 - notriddle:notriddle/never-search, r=GuillaumeGomez
rustdoc-search: search never type with `!`

This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for diverging functions. Part of #60485

It's already possible to do this search with `primitive:never`, but that's not what the Rust language itself uses, so nobody will try it if they aren't told or helped along.
2023-06-14 06:25:49 +02:00
Matthias Krüger
269ea4bd6b
Rollup merge of #112520 - chenyukang:yukang-fix-112505, r=fee1-dead
Fix the overflow issue for transmute_generic_consts

Fixes #112505
2023-06-14 06:25:49 +02:00
Matthias Krüger
98f6e9644b
Rollup merge of #112495 - bvanjoi:fix-109153, r=petrochenkov
fix(resolve): update shadowed_glob more precision

- Fixes #109153
- Fixes #109962

## Why does it panic?

We use #109153 as an illustration.

The process of `resolve_imports` is:

| Iter | resolve     | resolution of **`(Mod(root), Ident(bar) in type ns)`** |
| -    | -           | -      |
| 0 | `use foo::*`   | `binding` -> foo::bar, `shallowed_glob` -> `None` |
| 1 | `use bar::bar` | `binding` -> foo::bar::bar, `shallowed_glob` -> foo::bar    |
| 2 | `use bar::*`   | `binding` -> foo::bar::bar, `shallowed_glob` -> foo::bar::bar::bar |

So during `finalize_import`, the `root::bar` in `use bar::bar` had been pointed to `foo::bar::bar::bar`, which is different from the `initial_module` valued of `foo::bar`, therefore, the panic had been triggered.

## Try to solve it

~I think #109153 should check-pass rather than throw an ambiguous error. Following this idea, there are two ways to solve this problem:~

~1. Give up the `initial_module` and update `import.imported_module` after each resolution update. However, I think this method may have too much impact.~
~2. Do not update the `shadowed_glob` when it is defined.~

~To be honest, I am not sure if this is the right way to solve this ICE. Perhaps there is a better resolution.~

Edit: we had made the `resolution.shadowed_glob` update more detailed.

r? `@petrochenkov`
2023-06-14 06:25:48 +02:00
Matthias Krüger
6fc50dacd4
Rollup merge of #112197 - compiler-errors:next-solver-erase, r=lcnr
Erase regions even if normalization fails in writeback (in new solver)

Or else we ICE during writeback on some programs that error
2023-06-14 06:25:48 +02:00
bors
fa8762b7b6 Auto merge of #112448 - nnethercote:no-tiny-cgus, r=wesleywiser
Introduce a minimum CGU size in non-incremental builds.

Because tiny CGUs slow down compilation *and* result in worse generated code.

r? `@wesleywiser`
2023-06-14 02:34:17 +00:00
Michael Goulet
9e210522bc Improve docs/clean up negative overlap functions 2023-06-14 02:18:30 +00:00