Commit Graph

237030 Commits

Author SHA1 Message Date
Celina G. Val
421631a3a1 Remove unsafe and Rc 2023-10-23 14:22:04 -07:00
Matthias Krüger
85e1a5b159
Rollup merge of #117086 - amandasystems:patch-1, r=Mark-Simulacrum
Update .mailmap to promote my livename

I had apparently forgotten to update the Rust mailmap file for my previous commits. I was sent here from [the about page!](https://thanks.rust-lang.org/about/).

Note that the second rule only fires for commits I do at my current place of work, but reclaim them under my personal email address that I expect to use for longer.
2023-10-23 22:26:32 +02:00
Matthias Krüger
4ffc0acdf9
Rollup merge of #117074 - ouz-a:remove_smir, r=compiler-errors
Remove smir from triage and add me to stablemir

As we discussed this in [weekly ](https://rust-lang.zulipchat.com/#narrow/stream/320896-project-stable-mir/topic/.5Bbi-weekly.5D.202023-10-20)meeting we don't really care for changes that happens in `smir`, we only care about changes that happen to `stable_mir` so I removed smir triage ping and added myself to `stable_mir` ping list
2023-10-23 22:26:31 +02:00
Matthias Krüger
22c9731ce4
Rollup merge of #117070 - notriddle:notriddle/cleanx, r=fmease
rustdoc: wrap Type with Box instead of Generics

When these `Box<Generics>` types were introduced, `Generics` was made with `Vec` and much larger. Now that it's made with `ThinVec`, `Type` is bigger and should be boxed instead.
2023-10-23 22:26:30 +02:00
Matthias Krüger
7e607e8e32
Rollup merge of #117046 - bvanjoi:fix-116186, r=oli-obk
return unfixed len if pat has reported error

- Fixes #116186
- Fixes #113021

This issue arises due to the creation of a fixed-length pattern, as a result of the mir body corruption. The corruption taints `tcx.eval_to_allocation_raw`, causing it to return `AlreadyReported`. Consequently, this prevents `len.try_eval_target_usize` from evaluating correctly and returns `None`. Lastly, it results in the return of `[usize; min_len]`.

To rectify this issue, my approach is that to return unfixed when encountering `ErrorHandled::Reported`. Additionally, in instances of `ErrorHandled::TooGeneric`, the previous logic has been reinstated.
2023-10-23 22:26:30 +02:00
Matthias Krüger
8af4a3f9cd
Rollup merge of #116859 - Nilstrieb:more-more-funny-pretty-printers, r=oli-obk
Make `ty::print::Printer` take `&mut self` instead of `self`

based on #116815

This simplifies the code by removing all the `self` assignments and
makes the flow of data clearer - always into the printer.
Especially in v0 mangling, which already used  `&mut self` in some
places, it gets a lot more uniform.
2023-10-23 22:26:29 +02:00
Matthias Krüger
d287861309
Rollup merge of #107159 - devnexen:random_fbsd_update, r=workingjubilee
rand use getrandom for freebsd (available since 12.x)
2023-10-23 22:26:29 +02:00
bors
41aa06ecf9 Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkov
report `unused_import` for empty reexports even it is pub

Fixes #116032

An easy fix. r? `@petrochenkov`

(Discovered this issue while reviewing #115993.)
2023-10-23 20:24:09 +00:00
Michael Goulet
a387a3cf9d Let's see what those opaque types actually are 2023-10-23 16:18:35 -04:00
Michael Goulet
fd92bc6021 Handle ReErased in responses in new solver 2023-10-23 16:12:32 -04:00
David Tolnay
6a02e20fb5
Update since stability attributes in tests 2023-10-23 13:04:47 -07:00
David Tolnay
82ed3f5e8b
Validate since value in stable attribute 2023-10-23 13:04:35 -07:00
David Tolnay
01b909174b
Fix stable feature names in tests 2023-10-23 13:03:11 -07:00
David Tolnay
67ea7986c7
Fix invalid stability attribute features in standard library 2023-10-23 13:03:10 -07:00
David Tolnay
9853f6132f
Validate #[stable(feature = "…")] identifier 2023-10-23 13:02:18 -07:00
Michael Goulet
269d5a322e Remove redundant type parameter 2023-10-23 16:02:05 -04:00
Michael Goulet
8951342911 Naming nits 2023-10-23 16:02:05 -04:00
Peter Collingbourne
aad44b3b54 Improve android-ndk property interface
PR #105716 added support for NDK r25b, and removed support for r15. Since
the switch to r25b would have broken existing r15 users anyway, let's
take the opportunity to make the interface more user friendly.

Firstly move the android-ndk property to [build] instead of the
targets. This is possible now that the NDK has obsoleted the concept of
target-specific toolchains.

Also make the property take the NDK root directory instead of the
"toolchains/llvm/prebuilt/<host tag>" subdirectory.
2023-10-23 12:15:20 -07:00
Celina G. Val
f613b26cfb Add internal() method counterpart to stable()
Note: We do not expect to provide internalizing methods for all
StableMIR constructs. They exist only to help migrating efforts to allow
users to mix StableMIR and internal constructs.
2023-10-23 12:11:07 -07:00
bjorn3
93a5433f17 Update Cranelift to 0.101.1
This patch release fixes an ABI incompatibility with LLVM.

Fixes #1395
2023-10-23 19:06:04 +00:00
Celina G. Val
66a554b045 Add method to convert internal to stable constructs 2023-10-23 12:01:39 -07:00
bors
1322f92634 Auto merge of #107009 - cjgillot:jump-threading, r=pnkfelix
Implement jump threading MIR opt

This pass is an attempt to generalize `ConstGoto` and `SeparateConstSwitch` passes into a more complete jump threading pass.

This pass is rather heavy, as it performs a truncated backwards DFS on MIR starting from each `SwitchInt` terminator. This backwards DFS remains very limited, as it only walks through `Goto` terminators.

It is build to support constants and discriminants, and a propagating through a very limited set of operations.

The pass successfully manages to disentangle the `Some(x?)` use case and the DFA use case. It still needs a few tests before being ready.
2023-10-23 18:05:44 +00:00
rustbot
c1fb05cdf2 Update books 2023-10-23 13:00:51 -04:00
bors
e2068cdb09 Auto merge of #117087 - matthiaskrgr:rollup-08kkjkz, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #116960 (Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only)
 - #116978 (Rewrite gdb pretty-printer registration)
 - #117040 (coverage: Add UI tests for values accepted by `-Cinstrument-coverage`)
 - #117064 (Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly)
 - #117073 (Fix suggestion for renamed coroutines feature)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-23 16:04:48 +00:00
Oğuz Ağcayazı
dc1cd4c2cd Remove smir from triage and add me to stablemir 2023-10-23 18:49:35 +03:00
Matthias Krüger
f4dfd8d497
Rollup merge of #117073 - yotamofek:fix-coroutines-feature-rename-suggestion, r=lqd
Fix suggestion for renamed coroutines feature

This fixes a small typo from #116958
2023-10-23 16:23:54 +02:00
Matthias Krüger
6814eb1052
Rollup merge of #117064 - dtolnay:handleerrors, r=cjgillot
Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly

Suggested in https://github.com/rust-lang/rust/pull/116773#pullrequestreview-1691411257.

This `handle_errors` function is originally from https://github.com/rust-lang/rust/pull/34531, in which it was useful because it allowed error messages and error codes (`E0542`) for multiple occurrences of the same error to be centralized in one place. For example rather than repeating this diagnostic in 2 places:

```rust
span_err!(diagnostic, attr.span, E0542, "missing 'since'");
```

one could repeat this instead:

```rust
handle_errors(diagnostic, attr.span, AttrError::MissingSince);
```

ensuring that all "missing 'since'" errors always remained consistent in message and error code.

Over time as error messages and error codes got factored to fluent diagnostics (https://github.com/rust-lang/rust/pull/100836), this rationale no longer applies. The new code has the same benefit while being less verbose (+73, -128).

```rust
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
```

r? `@cjgillot`
2023-10-23 16:23:53 +02:00
Matthias Krüger
46d7038b03
Rollup merge of #117040 - Zalathar:instrument-coverage-ui, r=cjgillot
coverage: Add UI tests for values accepted by `-Cinstrument-coverage`

I wanted to clean up the code in `parse_instrument_coverage`, but it occurred to me that we currently don't have any UI tests for the various stable and unstable values supported by this flag.

---

Normally it might be overkill to individually test all the different variants of `on`/`off`, but in this case the parsing of those values is mixed in with some other custom code, so I think it's worthwhile being thorough.
2023-10-23 16:23:53 +02:00
Matthias Krüger
5f96976e82
Rollup merge of #116978 - tromey:rust-printers-cleanup, r=Mark-Simulacrum
Rewrite gdb pretty-printer registration

Currently, the Rust pretty-printers are registered in gdb using the uninformative name "lookup":

    (gdb) info pretty-printer
    global pretty-printers:
    [...]
    objfile /home/tromey/[...]
      lookup

It's nicer for users if the top-level registration is given a clear name.  Additionally, gdb lets users individually enable and disable specific printers, provided they are registered correctly.

This patch implements both these ideas.  Now the output looks like:

    (gdb) info pretty-printer
    global pretty-printers:
    [...]
    objfile /home/tromey/[...]
      rust
	StdArc
	StdBTreeMap
	StdBTreeSet
	StdCell
	StdHashMap
	StdHashSet
	StdNonZeroNumber
	StdOsString
	StdRc
	StdRef
	StdRefCell
	StdRefMut
	StdSlice
	StdStr
	StdString
	StdVec
	StdVecDeque
2023-10-23 16:23:52 +02:00
Matthias Krüger
726709bca4
Rollup merge of #116960 - lqd:applied-member-constraints-scope, r=matthewjasper
Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only

The location-insensitive analysis considered loans to escape if there were member constraints, which makes *some* sense for scopes and matches the scopes that NLL computes on all the tests.

However, polonius and NLLs differ on the fuzzed case #116657, where an SCC has member constraints but no applied ones (and is kinda surprising). The existing UI tests with member constraints impacting scopes all have some constraint applied.

This PR changes the location-insensitive analysis to consider a loan to escape if there are applied member constraints, and for extra paranoia/insurance via fuzzing and crater: actually checks the constraint's min choice is indeed a universal region as we expect. (This could be turned into a `debug_assert` and early return as a slight optimization after these periods of verification)

The 4 UI tests where member constraints are meaningful for computing scopes still pass obviously, and this also fixes #116657.

r? `@matthewjasper`
2023-10-23 16:23:52 +02:00
Amanda Stjerna
320ca83be3
Update .mailmap to promote my livename
I had apparently forgotten to update the Rust mailmap file for my previous commits!
2023-10-23 16:16:10 +02:00
bohan
6de40abc89 return unfixed len if pat has reported error 2023-10-23 22:14:39 +08:00
bjorn3
a558968dbe Implement all llvm intrinsics necessary for the image crate
Fixes #1379
2023-10-23 14:10:22 +00:00
bors
858a42bf46 Auto merge of #116837 - oli-obk:smir_run_macro, r=spastorino
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes https://github.com/rust-lang/rust/pull/116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
2023-10-23 13:57:19 +00:00
Michael Howell
f1a1ef68c7
Remove FIXME after fix
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-10-23 06:52:29 -07:00
bjorn3
efd3081083 Update rust-analyzer config 2023-10-23 13:24:46 +00:00
GoodDaisy
0d780b108b fix typos in comments 2023-10-23 20:52:14 +08:00
bjorn3
e5ba1e8417 Implement llvm intrinsics necessary for rav1e
Fixes #1399
2023-10-23 14:06:47 +02:00
bors
8501f1c7ba Auto merge of #116835 - oli-obk:evaluated_static_in_metadata2, r=RalfJung
Various const eval cleanups

This pulls out the pure refactorings from https://github.com/rust-lang/rust/pull/116564

r? `@RalfJung`
2023-10-23 12:01:17 +00:00
Oli Scherer
3cc26c6aaf Try to work around 32 bit mingw issues 2023-10-23 10:04:47 +00:00
bors
a56bd2b944 Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillot
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-23 09:59:40 +00:00
Oli Scherer
4a5fecb187 Avoid having rustc_smir depend on rustc_interface or rustc_driver 2023-10-23 09:48:15 +00:00
bjorn3
ed8c515cc4 Avoid collect_and_partition_mono_items call when not doing codegen
Fixes #1401
2023-10-23 09:35:15 +00:00
Yotam Ofek
a6c2481a36 Fix suggestion for renamed coroutines feature 2023-10-23 09:16:13 +00:00
Oli Scherer
066ec1273a Ensure that eval_to_allocation_raw isn't called on static items from miri 2023-10-23 08:35:27 +00:00
Oli Scherer
fec0b54978 Split eval_to_allocation_raw_provider 2023-10-23 08:35:26 +00:00
Oli Scherer
f85b139704 Pull out const error reporting into its own function 2023-10-23 08:35:26 +00:00
Oli Scherer
5784e9e83e Pull mplace validation logic out into an interpreter method 2023-10-23 08:35:26 +00:00
Oli Scherer
0fce74e1c0 The mutability was ignored anyway, so just check for staticness 2023-10-23 08:35:26 +00:00
Oli Scherer
fe8ebb1890 Allow ensure queries to return Result<(), ErrorGuaranteed> 2023-10-23 08:20:29 +00:00