Commit Graph

252498 Commits

Author SHA1 Message Date
Maybe Waffle
c2046c4b09 Add codegen tests for changed intrinsics 2024-04-16 12:35:22 +00:00
Maybe Waffle
7ce867f552 Add an assertion in const eval 2024-04-16 11:56:21 +00:00
Maybe Waffle
e4a854e495 Miri: adopt to new intrinsic types 2024-04-16 11:53:15 +00:00
Maybe Waffle
ceead1bda6 Change intrinsic types to use u32 instead of T to match stable reexports 2024-04-16 11:53:04 +00:00
bors
63f70b3d10 Auto merge of #123991 - fmease:rollup-96xcgnm, r=fmease
Rollup of 7 pull requests

Successful merges:

 - #123016 (Remove `TypeVariableOriginKind` and `ConstVariableOriginKind`)
 - #123462 (Cleanup: Rename `ModSep` to `PathSep`)
 - #123603 (Don't even parse an intrinsic unless the feature gate is enabled)
 - #123926 (Fix pretty HIR for anon consts in diagnostics)
 - #123973 (crashes: readme: add reminder to add Fixes #abcde to prs to automatically close issues.)
 - #123984 (sanitizers: Add rustc_sanitizers to triagebot.toml)
 - #123989 (Just use `type_dependent_def_id` to figure out what the method is for an expr)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-16 00:03:54 +00:00
León Orell Valerian Liehr
daa2ebc70c
Rollup merge of #123989 - compiler-errors:type-dependent-def-id, r=oli-obk
Just use `type_dependent_def_id` to figure out what the method is for an expr

The calls to `lookup_method_for_diagnostic` are overkill.

r? oli-obk
2024-04-16 01:12:39 +02:00
León Orell Valerian Liehr
445eb2e876
Rollup merge of #123984 - rcvalle:rust-triagebot-add-rustc-sanitizers, r=compiler-errors
sanitizers: Add rustc_sanitizers to triagebot.toml
2024-04-16 01:12:39 +02:00
León Orell Valerian Liehr
f0d235ac04
Rollup merge of #123973 - matthiaskrgr:crashs_fix_cmt, r=fmease
crashes: readme: add reminder to add Fixes #abcde to prs to automatically close issues.
2024-04-16 01:12:38 +02:00
León Orell Valerian Liehr
1069ad3982
Rollup merge of #123926 - compiler-errors:no-ann, r=estebank
Fix pretty HIR for anon consts in diagnostics

This removes the `NoAnn` printer which skips over nested bodies altogether, which is confusing, and requires users of `{ty|qpath|pat}_to_string` to pass in `&tcx` which now impleemnts `hir_pretty::PpAnn`.

There's one case where this "regresses" by actually printing out the body of the anon const -- we could suppress that, but I don't expect people to actually get anon consts like that unless they're fuzzing, tbh.

r? estebank
2024-04-16 01:12:38 +02:00
León Orell Valerian Liehr
1ad9fea871
Rollup merge of #123603 - compiler-errors:no-intrinsic, r=estebank
Don't even parse an intrinsic unless the feature gate is enabled

Don't return true in `tcx.is_intrinsic` if the function is defined locally and `#![feature(intrinsics)]` is not enabled. This is a slightly more general fix than #123526, since #123587 shows that we have simplifying assumptions about intrinsics elsewhere in the compiler.

This will make the code ICE again if the user **enables** `#[feature(intrinsics)]`, but I kind of feel like if we want to fix that, we should make the `INTERNAL_FEATURES` lint `Deny` again. Perhaps we could do that on non-nightly compilers. Or we should just stop compilation altogether if they have `#![feature]` enabled on a non-nightly compiler.

As for the UX of *real* cases of hitting these ICEs, I believe pretty strongly that if a compiler/stdlib dev is modifying internal intrinsics (intentionally, like when making a change to rustc) we have no guarantee to make the ICE better looking for them. Honestly, *not* spitting out a stack trace is probably a disservice to the people who hit those ICEs in that case.

r? `@Nilstrieb` `@estebank`
2024-04-16 01:12:37 +02:00
León Orell Valerian Liehr
c5665990c5
Rollup merge of #123462 - fmease:rn-mod-sep-to-path-sep, r=nnethercote
Cleanup: Rename `ModSep` to `PathSep`

`::` is usually referred to as the *path separator* (citation needed).

The existing name `ModSep` for *module separator* is a bit misleading since it in fact separates the segments of arbitrary path segments, not only ones resolving to modules. Let me just give a shout-out to associated items (`T::Assoc`, `<Ty as Trait>::function`) and enum variants (`Option::None`).

Motivation: Reduce friction for new contributors, prevent potential confusion.

cc `@petrochenkov`
r? nnethercote or compiler
2024-04-16 01:12:37 +02:00
León Orell Valerian Liehr
9cc26b598a
Rollup merge of #123016 - compiler-errors:no-type-var-origin, r=lcnr
Remove `TypeVariableOriginKind` and `ConstVariableOriginKind`

It's annoying to have to import `TypeVariableOriginKind` just to fill it with `MiscVariable` for almost every use. Every other usage other than `TypeParameterDefinition` wasn't even used -- I can see how it may have been useful once for debugging, but I do quite a lot of typeck debugging and I've never really needed it.

So let's just remove it, and keep around the only useful thing which is the `DefId` of the param for `var_for_def`.

This is based on #123006, which removed the special use of `TypeVariableOriginKind::OpaqueInference`, which I'm pretty sure I was the one that added.

r? lcnr or re-roll to types
2024-04-16 01:12:36 +02:00
Michael Goulet
2beb6a4782 Fix clippy 2024-04-15 18:48:12 -04:00
Michael Goulet
9d72808b1e Add test 2024-04-15 18:48:12 -04:00
Michael Goulet
619e044178 Fix pretty hir for anon consts in diagnostics 2024-04-15 18:48:12 -04:00
Michael Goulet
98890be9c4 Rebase fallout 2024-04-15 17:37:56 -04:00
bors
ccfcd950b3 Auto merge of #123451 - Kobzol:arbitrary-try-build, r=pietroalbini
CI: add a script for dynamically computing CI job matrix

It would be great if was easier to run specific CI workflows locally, and also to allow us to spawn a specific CI workflow by bors, to enable running arbitrary try builds. See discussion [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/CI.20workflows.20refactoring).

This PR is a first step in that direction.
- Moves the definition of CI runners and (for now) PR jobs into a separate `jobs.yml` file.
- Adds a simple Python script that reads the file, decides which jobs should be active for the current CI workflow, and prints them as JSON to their output.
- The PR job then reads this output and generates its job matrix based on it.

By moving the job definitions from `ci.yml` into a separate file, we can handle it programmatically, which should make it easier to both do local execution of CI jobs and also to do arbitrary try builds.
2024-04-15 21:28:25 +00:00
Michael Goulet
05bb3d2683 Just use type_dependent_def_id to figure out what the method is for an expr 2024-04-15 17:14:59 -04:00
Michael Goulet
25c0cf0a66 nits 2024-04-15 16:52:51 -04:00
Michael Goulet
ba6c166ee4 Account for Self params properly 2024-04-15 16:52:50 -04:00
Michael Goulet
eb6f856169 Remove ConstVariableOriginKind 2024-04-15 16:52:12 -04:00
Michael Goulet
34bce07e8e Remove TypeVariableOriginKind 2024-04-15 16:51:50 -04:00
Matthias Krüger
83d73e4929 crashes: readme: add reminder to add Fixes #abcde to prs to automatically close issues. 2024-04-15 21:44:04 +02:00
Ramon de C Valle
99e88e59c8 sanitizers: Add rustc_sanitizers to triagebot.toml 2024-04-15 12:41:32 -07:00
Jakub Beránek
72104e245b
Add comments 2024-04-15 21:21:45 +02:00
bors
3493a56529 Auto merge of #123982 - compiler-errors:rollup-m2v4epp, r=compiler-errors
Rollup of 4 pull requests

Successful merges:

 - #123900 (Stop using `PolyTraitRef` for closure/coroutine predicates already instantiated w placeholders)
 - #123924 (Fix various bugs in `ty_kind_suggestion`)
 - #123943 (Use the rustc_private libc less in tests)
 - #123970 (zkvm: fix references to `os_str` module)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-15 19:19:50 +00:00
Michael Goulet
27cb6bcb9b
Rollup merge of #123970 - risc0:erik/zkvm-fix-os-str, r=joboet
zkvm: fix references to `os_str` module

The `os_str` module has been moved to `sys`. This change fixes build issues by changing `use` to point to `crate::sys::os_str`.
2024-04-15 15:18:07 -04:00
Michael Goulet
89e55f7bef
Rollup merge of #123943 - saethlin:less-sysroot-libc, r=workingjubilee
Use the rustc_private libc less in tests

I started looking into our use of `rustc_private` + `extern crate libc;` in tests because of https://github.com/rust-lang/rust/pull/123938 and it looks like some fraction of the users of libc simply don't need the libc crate anymore.
2024-04-15 15:18:06 -04:00
Michael Goulet
20a5fb3b4a
Rollup merge of #123924 - compiler-errors:tuple-sugg, r=estebank
Fix various bugs in `ty_kind_suggestion`

Consolidates two implementations of `ty_kind_suggestion`
Fixes some misuse of the empty param-env
Fixes a problem where we suggested `(42)` instead of `(42,)` for tuple suggestions
Suggest a value when `return;`, making it consistent with `break;`
Fixes #123906
2024-04-15 15:18:06 -04:00
Michael Goulet
314dee528b
Rollup merge of #123900 - compiler-errors:nobound, r=lcnr
Stop using `PolyTraitRef` for closure/coroutine predicates already instantiated w placeholders

r? lcnr
2024-04-15 15:18:05 -04:00
bors
99d0186b1d Auto merge of #123968 - jieyouxu:rollup-1pnkxor, r=jieyouxu
Rollup of 12 pull requests

Successful merges:

 - #123423 (Distribute LLVM bitcode linker as a preview component)
 - #123548 (libtest: also measure time in Miri)
 - #123666 (Fix some typos in doc)
 - #123864 (Remove a HACK by instead inferring opaque types during expected/formal type checking)
 - #123896 (Migrate some diagnostics in `rustc_resolve` to session diagnostic)
 - #123919 (builtin-derive: tag → discriminant)
 - #123922 (Remove magic constants when using `base_n`.)
 - #123931 (Don't leak unnameable types in `-> _` recover)
 - #123933 (move the LargeAssignments lint logic into its own file)
 - #123934 (`rustc_data_structures::graph` mini refactor)
 - #123941 (Fix UB in LLVM FFI when passing zero or >1 bundle)
 - #123957 (disable create_dir_all_bare test on all(miri, windows))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-15 16:46:59 +00:00
Erik Kaneda
ee0aea5f65
zkvm: fix references to os_str module
The `os_str` module has been moved to `sys`.
2024-04-15 09:32:21 -07:00
Michael Goulet
9e630d3f21 PolyTraitRefs -> TraitRefs 2024-04-15 12:04:44 -04:00
许杰友 Jieyou Xu (Joe)
723c0e23bc
Rollup merge of #123957 - RalfJung:create_dir_all_bare, r=joboet
disable create_dir_all_bare test on all(miri, windows)
2024-04-15 16:56:19 +01:00
许杰友 Jieyou Xu (Joe)
4f3a39ba79
Rollup merge of #123941 - Mark-Simulacrum:fix-llvm-ub, r=nikic
Fix UB in LLVM FFI when passing zero or >1 bundle

Rust passes a `*const &OperandBundleDef` to these APIs, usually from a `Vec<&OperandBundleDef>` or so. Previously we were dereferencing that pointer and passing it to the ArrayRef constructor with some length (N).

This meant that if the length was 0, we were dereferencing a pointer to nowhere (if the vector on the Rust side didn't actually get allocated or so), and if the length was >1 then loading the *second* element somewhere in LLVM would've been reading past the end.

Since Rust can't hold OperandBundleDef by-value we're forced to indirect through a vector that copies out the OperandBundleDefs from the by-reference list on the Rust side in order to match the LLVM expected API.
2024-04-15 16:56:19 +01:00
许杰友 Jieyou Xu (Joe)
5580ae9795
Rollup merge of #123934 - WaffleLapkin:graph-mini-refactor, r=fmease
`rustc_data_structures::graph` mini refactor

Who doesn't love to breathe dust from the ancient times?
2024-04-15 16:56:18 +01:00
许杰友 Jieyou Xu (Joe)
b79d0b0849
Rollup merge of #123933 - RalfJung:large-assignments, r=michaelwoerister
move the LargeAssignments lint logic into its own file

The collector is a file full of very subtle logic, so let's try to keep that separate from the logic that only serves to implement this lint.
2024-04-15 16:56:18 +01:00
许杰友 Jieyou Xu (Joe)
313b02a86b
Rollup merge of #123931 - compiler-errors:variance-unnameables, r=fmease
Don't leak unnameable types in `-> _` recover

Fixes #123899
2024-04-15 16:56:17 +01:00
许杰友 Jieyou Xu (Joe)
1870e2d09f
Rollup merge of #123922 - TDecking:base_n_magic_removal, r=jieyouxu
Remove magic constants when using `base_n`.

Some use cases of `base_n` use number literals instead of the predefined constants. The latter are more descriptive so it might be better to use those instead.
2024-04-15 16:56:17 +01:00
许杰友 Jieyou Xu (Joe)
b1d1e081be
Rollup merge of #123919 - RalfJung:discriminant, r=compiler-errors
builtin-derive: tag → discriminant

As far as I can tell, all of this operates on the discriminant, not the tag. After all, with something like `Option<&T>`, the "tag" of the `Some` variant is basically just the reference value, which is never what you want to compare when figuring out which variant the enum is in.

See [here](https://rustc-dev-guide.rust-lang.org/appendix/glossary.html) for an explanation of the difference between tag and discriminant.
2024-04-15 16:56:16 +01:00
许杰友 Jieyou Xu (Joe)
18e6bb2851
Rollup merge of #123896 - JeanCASPAR:rustc_resolve-to-session-diagnostic, r=jieyouxu
Migrate some diagnostics in `rustc_resolve` to session diagnostic

Hello, I migrated some diagnostics in `rustc_resolve` to session diagnostic.

r? ``@davidtwco``
2024-04-15 16:56:15 +01:00
许杰友 Jieyou Xu (Joe)
699612fb8a
Rollup merge of #123864 - oli-obk:define_opaque_types3, r=compiler-errors
Remove a HACK by instead inferring opaque types during expected/formal type checking

I was wondering why I couldn't come up with a test that hits the code path of the argument check checking the types we inferred from the return type... Turns out we reject those attempts early during fudging.

I have absolutely no information for you as to what kind of type inference changes this may incur, but I think we should just land this out of two reasons:

* had I found the other place to use opaque type inference on before I added the hack, we'd be using that today and this PR would never have happened
* if it is possible to hit this path, it requires some god awful recursive RPIT logic that I doubt anyone would have written without actively trying to write obscure code

r? ``@ghost``
2024-04-15 16:56:15 +01:00
许杰友 Jieyou Xu (Joe)
4d2a8e3692
Rollup merge of #123666 - mountcount:master, r=lqd
Fix some typos in doc
2024-04-15 16:56:14 +01:00
许杰友 Jieyou Xu (Joe)
2074631732
Rollup merge of #123548 - RalfJung:what-is-time, r=joboet
libtest: also measure time in Miri

A long time ago we disabled timekeeping of the default test harness in Miri, as otherwise it would fail to run without `-Zmiri-disable-isolation`. However, since then Miri gained a "fake clock" that lets it present some deterministic notion of time when isolation is enabled.

So we could now let libtest do timekeeping again when running in Miri. That's nice as it can help detect tests that run too long. However it can also be confusing as the results with isolation can be quite different than the real time.

``@rust-lang/miri`` what do you think?
2024-04-15 16:56:14 +01:00
许杰友 Jieyou Xu (Joe)
e07d18fb2f
Rollup merge of #123423 - kjetilkjeka:llvm_bitcode_linker_component, r=Mark-Simulacrum
Distribute LLVM bitcode linker as a preview component

The self-contained LLVM bitcode linker was recently added in #117458. It is currently only in use to link the Nvidia ptx assembly tests when running rustc tests (local or CI). In fact, the linker itself is currently only usable for the `nvptx64-nvidia-cuda` target, but more targets will be supported in the future.

The reason a new linker was needed for the ptx format is that the [old one](https://github.com/denzp/rust-ptx-linker) has not been updated the last few years. It worked fine for a while, but as LLVM changed it broke and the nvptx tests was [disabled in rustc back in 2019](f8f9a2869c). It was ad-hoc patched and have been used in a sub-optimal state by the community until now.

If this PR is merged, the LLVM bitcode linker will be distributed as a preview component that can be used as a replacement for the old ptx-linker for development in addition to rustc tests. In addition to installing the `llvm-bitcode-linker` component, also the `llvm-tools` component must be installed as the `llvm-bitcode-linker` works by calling llvm tools.

Even though the LLVM bitcode linker is in its early stages it already now provides a lot of value over the old ptx-linker just by working and using up-to-date llvm tooling. By shipping it as a component it will be easier to gather user experience and improving it.

``@petrochenkov`` when installing as a component it will be installed in the self-contained folder and will not work with `-Clink-self-contained=no` (although for some reason I expect to be a bug `-Clink-self-contained=-linker` doesn't properly disable it). However, when building using `x.py build` it will be placed in the `lib/rustlib/<target>/bin` directory and will be available for internal tests even if `-Clink-self-contained=no` is passed.

CC: ``@Mark-Simulacrum`` as I very briefly discussed it with you some months ago https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/.E2.9C.94.20How.20to.20ship.20a.20new.20tool.20.28embedded.20linker.29.20to.20users.3F
2024-04-15 16:56:13 +01:00
bors
023084804e Auto merge of #123937 - RalfJung:miri-link-section, r=oli-obk
Miri on Windows: run .CRT$XLB linker section on thread-end

Hopefully fixes https://github.com/rust-lang/rust/issues/123583

First commit is originally by `@bjorn3`

r? `@oli-obk`
Cc `@ChrisDenton`
2024-04-15 14:36:12 +00:00
Michael Goulet
d2ec957680 Stop using PolyTraitRef for closure/coroutine predicates already instantiated w placeholders 2024-04-15 10:32:21 -04:00
Maybe Waffle
435db9b9bd Use RPITIT for Successors and Predecessors traits
Now with RPITIT instead of GAT!
2024-04-15 13:34:08 +00:00
Kjetil Kjeka
235d45e9c9 Distribute LLVM bitcode linker as a preview component 2024-04-15 15:11:28 +02:00
Ben Kimock
7457a0d441 Use the rustc_private libc less in tests 2024-04-15 08:54:11 -04:00