Commit Graph

30026 Commits

Author SHA1 Message Date
Nicholas Nethercote
c16d3f32a4 Avoid unnecessary exports. 2023-11-23 14:06:57 +11:00
Nicholas Nethercote
ca741945f4 Remove indexes module.
It's not useful, and only obfuscates things.
2023-11-23 14:06:46 +11:00
Nicholas Nethercote
e7781c75f8 Move has_rustc_mir_with.
`lib.rs` is a strange place for it, and it's only used within
`rustc_peek.rs`, so it doesn't need to be `pub`.
2023-11-23 14:06:32 +11:00
Nicholas Nethercote
36b25f5386 Reorder some use items.
The current order is a mess.
2023-11-23 14:06:25 +11:00
Nicholas Nethercote
2052d2b17c Remove unused feature. 2023-11-23 08:15:11 +11:00
bors
cc4bb0de20 Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-dead
`rustc_ast_pretty` cleanups

Some improvements I found while looking at this code.

r? `@fee1-dead`
2023-11-22 05:09:33 +00:00
bors
739d556826 Auto merge of #117582 - compiler-errors:uplift-canonical-var, r=jackh726
Uplift `CanonicalVarInfo` and friends into `rustc_type_ir`

Depends on #117580 and #117578

Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` so they can be consumed by an interner-agnostic `Canonicalizer` implementation for the new trait solver ❤️

r? `@ghost`
2023-11-22 02:43:23 +00:00
bors
ed10a53025 Auto merge of #118152 - matthiaskrgr:rollup-bqcck4w, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #117972 (Add VarDebugInfo to Stable MIR)
 - #118109 (rustdoc-search: simplify `checkPath` and `sortResults`)
 - #118110 (Document `DefiningAnchor` a bit more)
 - #118112 (Don't ICE when ambiguity is found when selecting `Index` implementation in typeck)
 - #118135 (Remove quotation from filename in stable_mir)

Failed merges:

 - #118012 (Add support for global allocation in smir)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-22 00:30:56 +00:00
Nicholas Nethercote
6686221d29 Remove outdated reference to compiler plugins. 2023-11-22 11:06:24 +11:00
Nicholas Nethercote
9fe6bb4a10 Add some comments. 2023-11-22 11:06:16 +11:00
Matthias Krüger
914891fc58
Rollup merge of #118135 - ouz-a:fix_stable_span, r=celinval
Remove quotation from filename in stable_mir

Previously we had quotation marks in filenames which is obviously wrong this fixes that.

r? ```@celinval```
2023-11-21 23:46:20 +01:00
Matthias Krüger
802f71b294
Rollup merge of #118112 - compiler-errors:index-ambiguity-ice, r=aliemjay
Don't ICE when ambiguity is found when selecting `Index` implementation in typeck

Fixes #118111

The problem here is when we're manually "selecting" an impl for `base_ty: Index<?0>`, we don't consider placeholder region errors (leak check) or ambiguous predicates. Those can lead to us not actually emitting any fulfillment errors on line 3131.
2023-11-21 23:46:20 +01:00
Matthias Krüger
a11be28e13
Rollup merge of #118110 - compiler-errors:defining-anchor, r=aliemjay
Document `DefiningAnchor` a bit more

r? types
2023-11-21 23:46:19 +01:00
Matthias Krüger
a98698e9c4
Rollup merge of #117972 - ouz-a:stable_debuginfo, r=celinval
Add VarDebugInfo to Stable MIR

Previously we omitted `VarDebugInfo` because we didn't have `Projection` now that https://github.com/rust-lang/rust/pull/117517 is merged it's possible to add `VarDebugInfo` information in `Body`. This PR adds stable version of the `VarDebugInfo` to `Body`

r? ```@celinval```
2023-11-21 23:46:18 +01:00
Nicholas Nethercote
10c8b56af1 Factor out common code in PrintState.
The AST and HIR versions of `State::print_ident` are textually
identical, but the types differ slightly. This commit factors out the
common code they both have by replacing `print_ident` with `ann_post`,
which is a smaller function that still captures the type difference.
2023-11-22 08:13:21 +11:00
Nicholas Nethercote
e16b52d4f0 Streamline PrintState.
`PrintState` is a trait containing code that can be used by both AST and
HIR pretty-printing. But several of its methods are only used by AST
printing.

This commit moves those methods out of the trait and into the AST
`State` impl, so they are not exposed unnecessarily. This commit also
removes four unused methods: `param_to_string`,
`foreign_item_to_string`, `assoc_item_to_string`, and
`print_inner_attributes_inline`.
2023-11-22 08:13:21 +11:00
Nicholas Nethercote
c6a9027102 Remove unused PrintState::generic_params_to_string method. 2023-11-22 08:13:21 +11:00
Nicholas Nethercote
d9443f71c7 Remove or downgrade unnecessary pub visibility markers. 2023-11-22 08:13:21 +11:00
Nicholas Nethercote
33cee0b22c Remove NO_ANN.
This makes `rustc_hir_pretty` more like `rustc_ast_pretty`.
2023-11-22 08:13:21 +11:00
Nicholas Nethercote
ce363bb6e6 Remove IterDelimited.
itertools has `with_position` which does the same thing.
2023-11-22 08:13:21 +11:00
Nicholas Nethercote
3eadc6844b Update itertools to 0.11.
Because the API for `with_position` improved in 0.11 and I want to use
it.
2023-11-22 08:13:21 +11:00
Nicholas Nethercote
1d320ed387 Remove unnecessary derives. 2023-11-22 08:13:21 +11:00
Nicholas Nethercote
2f51f0b290 Remove unneeded features. 2023-11-22 08:13:21 +11:00
Nilstrieb
21a870515b Fix clippy::needless_borrow in the compiler
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.

Then I had to remove a few unnecessary parens and muts that were exposed
now.
2023-11-21 20:13:40 +01:00
Michael Goulet
d1daf0e841 Uplift CanonicalVarInfo and friends 2023-11-21 17:49:57 +00:00
Michael Goulet
f26e8ff3ac Uplift BoundVar 2023-11-21 17:49:56 +00:00
ouz-a
0b25415559 remove quotation from filename 2023-11-21 16:56:19 +03:00
Nilstrieb
fa8878bdcc
Rollup merge of #118091 - psumbera:solaris-target, r=compiler-errors
Remove now deprecated target x86_64-sun-solaris.
2023-11-21 14:36:15 +01:00
Nilstrieb
4bb3ae39b7
Rollup merge of #118035 - ouz-a:november_ice2, r=compiler-errors
Fix early param lifetimes in generic_const_exprs

In cases like below, we never actually be able to capture region name for two reasons, first `'static` becomes anonymous lifetime and second we never capture region if it doesn't have a name so this results in ICE.
```
struct DataWrapper<'static> {
    data: &'a [u8; Self::SIZE],
}

impl DataWrapper<'a> {
```

Fixes https://github.com/rust-lang/rust/issues/118021
2023-11-21 14:36:14 +01:00
Nilstrieb
cbadb2e1c0
Rollup merge of #118029 - saethlin:allocid-gc, r=RalfJung
Expand Miri's BorTag GC to a Provenance GC

As suggested in https://github.com/rust-lang/miri/issues/3080#issuecomment-1732505573

We previously solved memory growth issues associated with the Stacked Borrows and Tree Borrows runtimes with a GC. But of course we also have state accumulation associated with whole allocations elsewhere in the interpreter, and this PR starts tackling those.

To do this, we expand the visitor for the GC so that it can visit a BorTag or an AllocId. Instead of collecting all live AllocIds into a single HashSet, we just collect from the Machine itself then go through an accessor `InterpCx::is_alloc_live` which checks a number of allocation data structures in the core interpreter. This avoids the overhead of all the inserts that collecting their keys would require.

r? ``@RalfJung``
2023-11-21 14:36:13 +01:00
Nilstrieb
aff407eef5
Rollup merge of #117522 - Urgau:check-cfg-cli-own-lint, r=petrochenkov
Remove `--check-cfg` checking of command line `--cfg` args

Back in https://github.com/rust-lang/rust/pull/100574 we added to the `unexpected_cfgs` lint the checking of `--cfg` CLI arguments and emitted unexpected names and values for them.

The implementation works as expected, but it's usability in particular when using it in combination with Cargo+`RUSTFLAGS` as people who set `RUSTFLAGS=--cfg=tokio_unstable` (or whatever) have `unexpected_cfgs` warnings on all of their crates is debatable. ~~To fix this issue this PR proposes that we split the CLI argument checking into it's own separate allow-by-default lint: `unexpected_cli_cfgs`.~~

~~This has the advantage of letting people who want CLI warnings have them (although not by default anymore), while still linting on every unexpected cfg name and values in the code.~~

After some discussion with the Cargo team ([Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/check-cfg.20and.20RUSTFLAGS.20interaction)) and member of the compiler team (see below), I propose that we follow the suggestion from `@epage:` never check `--cfg` arguments, but still reserve us the possibility to do it later.

We would still lint on unexpected cfgs found in the source code no matter the `--cfg` args passed. This mean reverting https://github.com/rust-lang/rust/pull/100574 but NOT https://github.com/rust-lang/rust/pull/99519.

r? `@petrochenkov`
2023-11-21 14:36:13 +01:00
ouz-a
d0dd19a6c9 de-structure variable and add stables 2023-11-21 15:38:45 +03:00
ouz-a
018b85986d Add VarDebugInfo to Stable MIR 2023-11-21 15:38:45 +03:00
bors
7bd385dc37 Auto merge of #117580 - compiler-errors:hash-stable-simplify-rustc_type_ir, r=jackh726
Add `HashStable_NoContext` to simplify `HashStable` implementations in `rustc_type_ir`

adds `derive(HashStable_NoContext)` which is a derived `HashStable` implementation that has no `HashStableContext` bound, and which adds `where` bounds for `HashStable` based off of *fields* and not generics.

This means we can `derive(HashStable_NoContext)` in more places in `rustc_type_ir` rather than having to hand-roll implementations.
2023-11-21 11:13:15 +00:00
bors
c5af061019 Auto merge of #118126 - Nilstrieb:rollup-5ogh896, r=Nilstrieb
Rollup of 7 pull requests

Successful merges:

 - #117790 (CFI: Add missing use core::ffi::c_int)
 - #118059 (Explicitly unset $CARGO for compiletest)
 - #118081 (`rustc_ty_utils` cleanups)
 - #118094 (feat: specialize `SpecFromElem` for `()`)
 - #118097 (Update books)
 - #118115 (Fix occurrences of old fn names in comment and tracing)
 - #118121 (`rustc_hir` cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-21 08:40:39 +00:00
Nilstrieb
f13f980900
Rollup merge of #118121 - nnethercote:rustc_hir, r=compiler-errors
`rustc_hir` cleanups

Just some improvements I found while looking at this code.

r? `@WaffleLapkin`
2023-11-21 09:06:30 +01:00
Nilstrieb
90e4c2dc3a
Rollup merge of #118115 - spastorino:fix-old-fn-names, r=compiler-errors
Fix occurrences of old fn names in comment and tracing
2023-11-21 09:06:30 +01:00
Nilstrieb
675cba073e
Rollup merge of #118081 - nnethercote:rustc_ty_utils, r=compiler-errors
`rustc_ty_utils` cleanups

Minor improvements I found while looking at this code.

r? ``@lcnr``
2023-11-21 09:06:28 +01:00
bors
85c42b751e Auto merge of #115691 - jsgf:typed-json-diags, r=est31,dtolnay
Add `$message_type` field to distinguish json diagnostic outputs

Currently the json-formatted outputs have no way to unambiguously determine which kind of message is being output. A consumer can look for specific fields in the json object (eg "message"), but there's no guarantee that in future some other kind of output will have a field of the same name.

This PR adds a `"type"` field to add json outputs which can be used to unambiguously determine which kind of output it is. The mapping is:

`diagnostic`: regular compiler diagnostics
`artifact`: artifact notifications
`future_incompat`: Future incompatibility report
`unused_extern`: Unused crate warnings/errors

This matches the "internally tagged" representation for serde enums.
2023-11-21 06:30:14 +00:00
Michael Goulet
c9143ea1d9 Unify HashStable implementations 2023-11-21 05:49:45 +00:00
Michael Goulet
426bc70ad6 Add HashStable_NoContext to simplify HashStable implementations in rustc_type_ir 2023-11-21 05:49:44 +00:00
Nicholas Nethercote
72653c1f50 Use macros to avoid expect_* boilerplate.
The majority of these aren't actually used, but I kept them anyway.
2023-11-21 15:36:15 +11:00
Nicholas Nethercote
ec10e3726c Remove some unused functions.
And remove `pub` from some local-only ones.
2023-11-21 15:35:59 +11:00
Nicholas Nethercote
c965a7608d Wrap a long line. 2023-11-21 15:34:41 +11:00
bors
390e3c8b66 Auto merge of #118015 - celinval:smir-place-ty, r=compiler-errors
Add place.ty() and Ty build from a kind to smir

Add a method to retrieve the type of a place and a few utility functions needed to build the projection type. I decided to return a result to avoid panicking if the user passes invalid inputs, such as wrong list of locals.

r? `@spastorino`
2023-11-21 04:32:03 +00:00
bors
baf4abff31 Auto merge of #118107 - matthiaskrgr:rollup-k5bfkfr, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #117327 (Add documentation for some queries)
 - #117835 (Note about object lifetime defaults in does not live long enough error)
 - #117851 (Uplift `InferConst` to `rustc_type_ir`)
 - #117973 (test: Add test for async-move in 2015 Rust proc macro)
 - #117992 (Don't require intercrate mode for negative coherence)
 - #118010 (Typeck break expr even if break is illegal)
 - #118026 (Don't consider regions in `deref_into_dyn_supertrait` lint)
 - #118089 (intercrate_ambiguity_causes: handle self ty infer + reservation impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-21 02:02:30 +00:00
Santiago Pastorino
8cf94c955f
Fix occurrences of old fn names in comment and tracing 2023-11-20 22:45:28 -03:00
David Tolnay
fe50c5359e
Update some more cases of "type" -> "$message_type" 2023-11-20 16:02:59 -08:00
Michael Goulet
273dc22b04 Don't ICE when ambiguity is found when selecting Index implementation in typeck 2023-11-20 23:37:04 +00:00
Michael Goulet
0000b35288 Document DefiningAnchor a bit more 2023-11-20 21:47:49 +00:00