Commit Graph

223601 Commits

Author SHA1 Message Date
bors
74c4821045 Auto merge of #111014 - klensy:no-rc, r=WaffleLapkin
try to downgrade Arc -> Lrc -> Rc -> no-Rc in few places

Expecting this be not slower on non-parallel compiler and probably faster on parallel (checked that this PR builds on it).
2023-05-04 20:49:23 +00:00
Maybe Waffle
ad0388df5e Fixup "since" dates for array_tuple_conv feature 2023-05-04 18:25:21 +00:00
bors
eb7a743421 Auto merge of #111210 - matthiaskrgr:rollup-doquh2n, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #108865 (Add a `sysroot` crate to represent the standard library crates)
 - #110651 (libtest: include test output in junit xml reports)
 - #110826 (Make PlaceMention a non-mutating use.)
 - #110982 (Do not recurse into const generic args when resolving self lifetime elision.)
 - #111009 (Add `ascii::Char` (ACP#179))
 - #111100 (check array type of repeat exprs is wf)
 - #111186 (Add `is_positive` method for signed non-zero integers.)
 - #111201 (bootstrap: add .gitmodules to the sources)

Failed merges:

 - #110954 (Reject borrows of projections in ConstProp.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-04 17:56:17 +00:00
Matthias Krüger
75e8f87673
Rollup merge of #111201 - krasimirgg:add_gitmodules, r=jyn514
bootstrap: add .gitmodules to the sources

The bootstrap builder now expects this file to exist: 6f8c0557e0/src/bootstrap/builder.rs (L494)

Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/missing.20llvm-project.2Fruntimes.20in.20beta.20srcs
2023-05-04 19:18:22 +02:00
Matthias Krüger
ab80b7a53d
Rollup merge of #111186 - jmillikin:nonzero-is-positive, r=dtolnay
Add `is_positive` method for signed non-zero integers.

ACP: https://github.com/rust-lang/libs-team/issues/105
2023-05-04 19:18:22 +02:00
Matthias Krüger
c0ca84b006
Rollup merge of #111100 - BoxyUwU:array_repeat_expr_wf, r=compiler-errors
check array type of repeat exprs is wf

Fixes #111091

Also makes sure that we actually renumber regions in the length of repeat exprs which we previously weren't doing and would cause ICEs in `adt_const_params` + `generic_const_exprs` from attempting to prove the wf goals when the length was an unevaluated constant with `'erased` in the `ty` field of `Const`

The duplicate errors are caused by the fact that `const_arg_to_const`/`array_len_to_const` in `FnCtxt` adds a `WellFormed` goal for the created `Const` which is also checked by the added `WellFormed(array_ty)`. I don't want to change this to just emit a `T: Sized` goal for the element type since that would ignore `ConstArgHasType` wf requirements and generally uncomfortable with the idea of trying to sync up `wf::obligations` for arrays and the code in hir typeck for repeat exprs.

r? `@compiler-errors`
2023-05-04 19:18:21 +02:00
Matthias Krüger
ea0b6504fa
Rollup merge of #111009 - scottmcm:ascii-char, r=BurntSushi
Add `ascii::Char` (ACP#179)

ACP second: https://github.com/rust-lang/libs-team/issues/179#issuecomment-1527900570
New tracking issue: https://github.com/rust-lang/rust/issues/110998

For now this is an `enum` as `@kupiakos` [suggested](https://github.com/rust-lang/libs-team/issues/179#issuecomment-1527959724), with the variants under a different feature flag.

There's lots more things that could be added here, and place for further doc updates, but this seems like a plausible starting point PR.

I've gone through and put an `as_ascii` next to every `is_ascii`: on `u8`, `char`, `[u8]`, and `str`.

As a demonstration, made a commit updating some formatting code to use this: https://github.com/scottmcm/rust/commit/ascii-char-in-fmt (I don't want to include that in this PR, though, because that brings in perf questions that don't exist if this is just adding new unstable APIs.)
2023-05-04 19:18:21 +02:00
Matthias Krüger
8d66f01ab5
Rollup merge of #110982 - cjgillot:elided-self-const, r=petrochenkov
Do not recurse into const generic args when resolving self lifetime elision.

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

r? `@petrochenkov`
2023-05-04 19:18:20 +02:00
Matthias Krüger
0ac8ebdf11
Rollup merge of #110826 - cjgillot:place-mention-use, r=JakobDegen,lcnr
Make PlaceMention a non-mutating use.

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

r? `@JakobDegen`

I don't agree with your statement in https://github.com/rust-lang/rust/issues/110781#issuecomment-1520841434. I suggest that we start fixing `PlaceContext` to be accurate enough for optimizations to use it. This structure is very convenient to use in visitors, and we perhaps have an opportunity to make it less of a footgun.
2023-05-04 19:18:19 +02:00
Matthias Krüger
bf72b64b96
Rollup merge of #110651 - durin42:xunit-stdout, r=cuviper
libtest: include test output in junit xml reports

Fixes #110336.
2023-05-04 19:18:18 +02:00
Matthias Krüger
0098cd4e83
Rollup merge of #108865 - Zoxc:library-dummy-crate, r=jyn514
Add a `sysroot` crate to represent the standard library crates

This adds a dummy crate named `sysroot` to represent the standard library target instead of using the `test` crate. This allows the removal of `proc_macro` as a dependency of `test` allowing these 2 crates to build in parallel saving around 9 seconds locally.
2023-05-04 19:18:17 +02:00
bors
eac35583d2 Auto merge of #111174 - matthiaskrgr:rollup-ncnqivh, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #110859 (Explicitly reject negative and reservation drop impls)
 - #111020 (Validate resolution for SelfCtor too.)
 - #111024 (Use the full Fingerprint when stringifying Svh)
 - #111027 (Remove `allow(rustc::potential_query_instability)` for `builtin_macros`)
 - #111039 (Encode def span for foreign return-position `impl Trait` in trait)
 - #111070 (Don't suffix `RibKind` variants)
 - #111094 (Add needs-unwind annotations to tests that need stack unwinding)
 - #111103 (correctly recurse when expanding anon consts)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-04 13:44:38 +00:00
Krasimir Georgiev
6530b1bd53 bootstrap: add .gitmodules to the sources
The bootstrap builder now expects this file to exist:
6f8c0557e0/src/bootstrap/builder.rs (L494)
2023-05-04 13:07:10 +00:00
Krasimir Georgiev
025c60310a bootstrap: add llvm-project/runtimes to the sources
This is needed to build libunwind for LLVM 16:
https://discourse.llvm.org/t/runtimes-removed-support-for-llvm-enable-projects-in-libcxx-libcxxabi-and-libunwind/65707

Doesn't work: with this, running `python3 x.py dist` produces a tar
archive that still doesn't contain the runtimes subdirectory?
2023-05-04 10:42:22 +00:00
John Millikin
70523fb0b1 Add is_positive method for signed non-zero integers. 2023-05-04 19:37:33 +09:00
Boxy
7d9130f3b9 do not allow rustc::pass_by_value lint 2023-05-04 11:22:40 +01:00
Boxy
c04106f9f1 check array type of repeat exprs is wf 2023-05-04 11:22:40 +01:00
Matthias Krüger
b4d992fec7
Rollup merge of #111103 - BoxyUwU:normal_fold_with_gce_norm, r=compiler-errors
correctly recurse when expanding anon consts

recursing with `super_fold_with` is wrong in case `bac` is itself normalizable, the test that was supposed to test for this being wrong did not actually test for this in reality because of the usage of `{ (N) }` instead of `{{ N }}`. The former resulting in a simple `ConstKind::Param` instead of `ConstKind::Unevaluated`. Tbh generally this test seems very brittle and it will be a lot easier to test once we have normalization of assoc consts since then we can just test that `T::ASSOC` normalizes to some `U::OTHER` which normalizes to some third thing.

r? `@compiler-errors`
2023-05-04 08:09:07 +02:00
Matthias Krüger
f2bc7e0684
Rollup merge of #111094 - bjorn3:fix_test_annotations, r=jyn514
Add needs-unwind annotations to tests that need stack unwinding

This allows filtering them out when running the rustc test suite for cg_clif.
2023-05-04 08:09:06 +02:00
Matthias Krüger
50754578f6
Rollup merge of #111070 - WaffleLapkin:break_ribs, r=lcnr
Don't suffix `RibKind` variants

This PR
- Removes `use RibKind::*`
- Renames `RibKind::{SomethingRibKind => Something}`

It seems unnecessary to have "RibKind" in the end of all variants, if we can just use it as a normal enum. Additionally previously it was weird that `MacroDefinition` is the only unsuffixed variant.
2023-05-04 08:09:06 +02:00
Matthias Krüger
b194b43bd1
Rollup merge of #111039 - compiler-errors:foreign-span-rpitit, r=tmiasko
Encode def span for foreign return-position `impl Trait` in trait

Fixes #111031, yet another def-span encoding issue :/

Includes a smaller repro than the issue, but I can confirm it ICEs:

```
query stack during panic:
#0 [def_span] looking up span for `rpitit::Foo::bar::{opaque#0}`
#1 [object_safety_violations] determining object safety of trait `rpitit::Foo`
#2 [check_is_object_safe] checking if trait `rpitit::Foo` is object safe
#3 [typeck] type-checking `main`
#4 [used_trait_imports] finding used_trait_imports `main`
#5 [analysis] running analysis passes on this crate
```

Luckily since this only affects nightly, this desn't need to be backported.
2023-05-04 08:09:05 +02:00
Matthias Krüger
6387eda3ba
Rollup merge of #111027 - clubby789:query-instability-builtin-macros, r=petrochenkov
Remove `allow(rustc::potential_query_instability)` for `builtin_macros`

cc #84447
2023-05-04 08:09:05 +02:00
Matthias Krüger
3ce6dd2a54
Rollup merge of #111024 - saethlin:stringify-full-svh, r=oli-obk
Use the full Fingerprint when stringifying Svh

Finally circling back, per https://github.com/rust-lang/rust/pull/110367#discussion_r1168340739

r? `@oli-obk`
2023-05-04 08:09:04 +02:00
Matthias Krüger
1187ce7213
Rollup merge of #111020 - cjgillot:validate-self-ctor, r=petrochenkov
Validate resolution for SelfCtor too.

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

r? `@petrochenkov`
2023-05-04 08:09:04 +02:00
Matthias Krüger
6fca1a9259
Rollup merge of #110859 - compiler-errors:no-negative-drop-impls, r=oli-obk
Explicitly reject negative and reservation drop impls

Fixes #110858

It doesn't really make sense for a type to have a `!Drop` impl. Or at least, I don't want us to implicitly assign a meaning to it by the way the compiler *currently* handles it (incompletely), and rather I would like to see a PR (or an RFC...) assign a meaning to `!Drop` if we actually wanted one for it.
2023-05-04 08:09:03 +02:00
bors
8518391e72 Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr
Replace `tcx.mk_trait_ref` with `TraitRef::new`

First step in implementing https://github.com/rust-lang/compiler-team/issues/616
r? `@lcnr`
2023-05-04 05:54:09 +00:00
bors
6f8c0557e0 Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr
Replace `tcx.mk_trait_ref` with `TraitRef::new`

First step in implementing https://github.com/rust-lang/compiler-team/issues/616
r? `@lcnr`
2023-05-04 05:54:09 +00:00
Scott McMurray
8c781b0906 Add the basic ascii::Char type 2023-05-03 22:09:33 -07:00
Nicholas Nethercote
723ca2a33d Factor out more repeated code in {write,read}_leb128!.
Make them generate the entire function, not just the function body.
2023-05-04 13:52:14 +10:00
Nicholas Nethercote
4ac959a3c0 Rename file_encoder_write_leb128!.
`MemEncoder` was recently removed, leaving `FileEncoder` as the only
encoder. So this prefix is no longer needed, and `write_leb128!` matches
the existing `read_leb128!`.
2023-05-04 13:51:20 +10:00
Nicholas Nethercote
6b70be2a34 Remove unneeded encode/decode methods.
In #110927 the encode/decode methods for `i8`, `char`, `bool`, and `str`
were made inherent. This commit removes some unnecessary implementations
of these methods that were missed in that PR.
2023-05-04 13:11:52 +10:00
Nicholas Nethercote
58002faca0 Reorder some MemDecoder methods.
So they match the order in the `Decoder` trait.
2023-05-04 13:11:51 +10:00
bors
129195f57c Auto merge of #111169 - Manishearth:rollup-55sfaad, r=Manishearth
Rollup of 10 pull requests

Successful merges:

 - #97594 (Implement tuple<->array convertions via `From`)
 - #105452 (Add cross-language LLVM CFI support to the Rust compiler)
 - #105695 (Replace generic thread parker with explicit no-op parker)
 - #110371 (rustdoc: restructure type search engine to pick-and-use IDs)
 - #110928 (tests: Add tests for LoongArch64)
 - #110970 (tidy: remove ENTRY_LIMIT maximum checking and set it to 900)
 - #111104 (Update ICU4X to 1.2)
 - #111127 (Constify slice flatten method)
 - #111146 (rustc_middle: Fix `opt_item_ident` for non-local def ids)
 - #111154 (Use builtin FFX isolation for Fuchsia test runner)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-04 02:20:26 +00:00
Nicholas Nethercote
b71ce293e8 Remove a low value comment. 2023-05-04 10:42:42 +10:00
Manish Goregaokar
31aeef28f8
Rollup merge of #111154 - djkoloski:use_builtin_ffx_isolation, r=tmandry
Use builtin FFX isolation for Fuchsia test runner

FFX has new builtin support for isolating the daemon's environment. This switches the manual isolation originally written to that new builtin feature.

r? ````@tmandry````
2023-05-03 16:42:52 -07:00
Manish Goregaokar
48c78248a3
Rollup merge of #111146 - petrochenkov:decident, r=compiler-errors
rustc_middle: Fix `opt_item_ident` for non-local def ids

Noticed while working on https://github.com/rust-lang/rust/pull/110855.
2023-05-03 16:42:51 -07:00
Manish Goregaokar
54cf561889
Rollup merge of #111127 - xfix:const-slice-flatten, r=scottmcm
Constify slice flatten method

ACP: https://github.com/rust-lang/libs-team/issues/218
2023-05-03 16:42:51 -07:00
Manish Goregaokar
8a0e4bebd3
Rollup merge of #111104 - Manishearth:icuup, r=compiler-errors
Update ICU4X to 1.2

Was released a couple weeks ago.

Also needed to make progress on https://github.com/rust-lang/rust/issues/109302 (though this PR does not achieve that part just yet)
2023-05-03 16:42:50 -07:00
Manish Goregaokar
1670fb93a6
Rollup merge of #110970 - est31:test_dirs_relax, r=petrochenkov
tidy: remove ENTRY_LIMIT maximum checking and set it to 900

Removes checking of `ENTRY_LIMIT` towards an actually reached maximum, and sets it to 900.

The number 900 is safely below github's limit of 1000 entries for a directory.
PRs to move tests can still decrease the sizes of various directories,
but adjusting the limit won't be neccessary any more. In fact, such reduction PRs are a great idea so that no unrelated PR is hitting the limit: ideally there would always be a (manually maintained) safety margin between the actually reached maximum and `ENTRY_LIMIT`, for all directories.

In general, the limit is a bad tool to direct people to put tests into
fitting directories because when those are available, usually the limit
is not hit, while the limit is hit in directories that have a weak
substructure themselves. I got into this situation myself when writing #110694: tests/ui/parser is hitting the limit, but has few directories of its own.

Suggested by ```@petrochenkov``` in https://github.com/rust-lang/rust/pull/110694#discussion_r1177694339.

r? ```@petrochenkov```
2023-05-03 16:42:50 -07:00
Manish Goregaokar
09839bfdb1
Rollup merge of #110928 - loongarch-rs:tests, r=petrochenkov
tests: Add tests for LoongArch64
2023-05-03 16:42:49 -07:00
Manish Goregaokar
ceef7e5ced
Rollup merge of #110371 - notriddle:notriddle/search-corrections, r=GuillaumeGomez
rustdoc: restructure type search engine to pick-and-use IDs

Fixes #110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
2023-05-03 16:42:49 -07:00
Manish Goregaokar
3fa0c087e4
Rollup merge of #105695 - joboet:remove_generic_parker, r=m-ou-se
Replace generic thread parker with explicit no-op parker

With #98391 merged, all platforms supporting threads now have their own parking implementations. Therefore, the generic implementation can be removed. On the remaining platforms (really just WASM without atomics), parking is not supported, so calls to `thread::park` now return instantly, which is [allowed by their API](https://doc.rust-lang.org/nightly/std/thread/fn.park.html). This is a change in behaviour, as spurious wakeups do not currently occur since all platforms guard against them. It is invalid to depend on this, but I'm still going to tag this as libs-api for confirmation.

````@rustbot```` label +T-libs +T-libs-api +A-atomic

r? rust-lang/libs
2023-05-03 16:42:48 -07:00
Manish Goregaokar
38bbc39895
Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3
Add cross-language LLVM CFI support to the Rust compiler

This PR adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395).

It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653.

Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).

Thank you again, ``@bjorn3,`` ``@nikic,`` ``@samitolvanen,`` and the Rust community for all the help!
2023-05-03 16:42:48 -07:00
Manish Goregaokar
84d8159ebf
Rollup merge of #97594 - WaffleLapkin:array_tuple_conv, r=ChrisDenton
Implement tuple<->array convertions via `From`

This PR adds the following impls that convert between homogeneous tuples and arrays of the corresponding lengths:
```rust
impl<T> From<[T; 1]> for (T,) { ... }
impl<T> From<[T; 2]> for (T, T) { ... }
/* ... */
impl<T> From<[T; 12]> for (T, T, T, T, T, T, T, T, T, T, T, T) { ... }

impl<T> From<(T,)> for [T; 1] { ... }
impl<T> From<(T, T)> for [T; 2] { ... }
/* ... */
impl<T> From<(T, T, T, T, T, T, T, T, T, T, T, T)> for [T; 12] { ... }
```

IMO these are quite uncontroversial but note that they are, just like any other trait impls, insta-stable.
2023-05-03 16:42:47 -07:00
bors
f557a4fd46 Auto merge of #111141 - ChrisDenton:ps-exitcode, r=jyn514
Return error code from x.ps1

Fixes #111136

This works around a bug where `ExitCode` does not return the exit code. See: https://stackoverflow.com/a/23797762
2023-05-03 23:17:21 +00:00
Ramon de C Valle
9a02f65a22 Update documentation for LLVM CFI support
This commit updates the documentation for the LLVM Control Flow
Integrity (CFI) support in the Rust compiler.
2023-05-03 22:41:31 +00:00
Ramon de C Valle
004aa15b47 Add cross-language LLVM CFI support to the Rust compiler
This commit adds cross-language LLVM Control Flow Integrity (CFI)
support to the Rust compiler by adding the
`-Zsanitizer-cfi-normalize-integers` option to be used with Clang
`-fsanitize-cfi-icall-normalize-integers` for normalizing integer types
(see https://reviews.llvm.org/D139395).

It provides forward-edge control flow protection for C or C++ and Rust
-compiled code "mixed binaries" (i.e., for when C or C++ and Rust
-compiled code share the same virtual address space). For more
information about LLVM CFI and cross-language LLVM CFI support for the
Rust compiler, see design document in the tracking issue #89653.

Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and
-Zsanitizer-cfi-normalize-integers, and requires proper (i.e.,
non-rustc) LTO (i.e., -Clinker-plugin-lto).
2023-05-03 22:41:29 +00:00
bors
f9c1d155b4 Auto merge of #10716 - Icxolu:unitstruct_default_construction, r=Manishearth
Fixes #10609: Adds lint to detect construction of unit struct using `default`

Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name.

changelog: [`default_constructed_unit_structs`]: detects construction of unit structs using `default`

fixes #10609
2023-05-03 21:43:02 +00:00
Maybe Waffle
de105164ea Mention array<->tuple convs in docs 2023-05-03 20:34:47 +00:00
bors
473f916d83 Auto merge of #111153 - Dylan-DPC:rollup-0pq0hh3, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #107978 (Correctly convert an NT path to a Win32 path in `read_link`)
 - #110436 (Support loading version information from xz tarballs)
 - #110791 (Implement negative bounds for internal testing purposes)
 - #110874 (Adjust obligation cause code for `find_and_report_unsatisfied_index_impl`)
 - #110908 (resolve: One more attempt to simplify `module_children`)
 - #110943 (interpret: fail more gracefully on uninit unsized locals)
 - #111062 (Don't bail out early when checking invalid `repr` attr)
 - #111069 (remove pointless `FIXME` in `bootstrap::download`)
 - #111086 (Remove `MemEncoder`)
 - #111097 (Avoid ICEing miri on layout query cycles)
 - #111112 (Add some triagebot notifications for nnethercote.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-03 20:02:30 +00:00