about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-12-11Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-deadMatthias Krüger-11/+0
compiler: remove unnecessary imports and qualified paths Some of these imports were necessary before Edition 2021, others were already in the prelude. I hope it's fine that this PR is so spread-out across files :/
2022-12-10Introduce `with_forced_trimmed_paths`Esteban Küber-17/+111
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-11/+0
2022-12-10Rollup merge of #105410 - TaKO8Ki:fix-105257, r=BoxyUwUMatthias Krüger-0/+9
Consider `parent_count` for const param defaults Fixes #105257
2022-12-10Rollup merge of #105234 - JakobDegen:unneeded-field, r=oli-obkMatthias Krüger-41/+10
Remove unneeded field from `SwitchTargets` This had a fixme already. The only change in behavior is that the mir dumps now no longer contains labels for the types of the integers on the edges of a switchint: Before: ![image](https://user-images.githubusercontent.com/51179609/205467622-34401a68-dca6-43eb-915e-b9fda1988860.png) After: ![image](https://user-images.githubusercontent.com/51179609/205467634-b5b2a259-9cb4-4843-845c-592c500f0f9c.png) I don't think that's a problem though. The information is still available to a user that really cares by checking the type of `_2`, so it honestly feels like a bit of an improvement to me. r? mir
2022-12-10Auto merge of #105525 - matthiaskrgr:rollup-ricyw5s, r=matthiaskrgrbors-0/+76
Rollup of 10 pull requests Successful merges: - #98391 (Reimplement std's thread parker on top of events on SGX) - #104019 (Compute generator sizes with `-Zprint_type_sizes`) - #104512 (Set `download-ci-llvm = "if-available"` by default when `channel = dev`) - #104901 (Implement masking in FileType comparison on Unix) - #105082 (Fix Async Generator ABI) - #105109 (Add LLVM KCFI support to the Rust compiler) - #105505 (Don't warn about unused parens when they are used by yeet expr) - #105514 (Introduce `Span::is_visible`) - #105516 (Update cargo) - #105522 (Remove wrong note for short circuiting operators) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-10Rollup merge of #104019 - compiler-errors:print-generator-sizes, r=wesleywiserMatthias Krüger-0/+76
Compute generator sizes with `-Zprint_type_sizes` Fixes #103887 r? `@pnkfelix`
2022-12-09Fold `Definitions` into the untracked dataOli Scherer-33/+14
2022-12-09Move the untracked cstore and source_span into a structOli Scherer-50/+33
2022-12-09Remove unneeded field from `SwitchTargets`Jakob Degen-41/+10
2022-12-09Help rust-analyzer normalize query return typesMaybe Waffle-1/+97
2022-12-09Rollup merge of #105455 - lcnr:correct-reveal-in-validate, r=jackh726Matthias Krüger-0/+8
use the correct `Reveal` during validation supersedes #105454. Deals with https://github.com/rust-lang/rust/issues/105009#issuecomment-1342395333, not closing #105009 as the ICE may leak into beta The issue was the following: - we optimize the mir, using `Reveal::All` - some optimization relies on the hidden type of an opaque type - we then validate using `Reveal::UserFacing` again which is not able to observe the hidden type r? `@jackh726`
2022-12-08Rollup merge of #105423 - oli-obk:symbols, r=jackh726Matthias Krüger-2/+2
Use `Symbol` for the crate name instead of `String`/`str` It always got converted to a symbol anyway
2022-12-08Rollup merge of #105317 - RalfJung:retag-rework, r=oli-obkMatthias Krüger-1/+1
make retagging work even with 'unstable' places This is based on top of https://github.com/rust-lang/rust/pull/105301. Only the last two commits are new. While investigating https://github.com/rust-lang/unsafe-code-guidelines/issues/381 I realized that we would have caught this issue much earlier if the add_retag pass wouldn't bail out on assignments of the form `*ptr = ...`. So this PR changes our retag strategy: - When a new reference is created via `Rvalue::Ref` (or a raw ptr via `Rvalue::AddressOf`), we do the retagging as part of just executing that address-taking operation. - For everything else, we still insert retags -- these retags basically serve to ensure that references stored in local variables (and their fields) are always freshly tagged, so skipping this for assignments like `*ptr = ...` is less egregious. r? ```@oli-obk```
2022-12-08Rollup merge of #104922 - estebank:fur-elize, r=oli-obkMatthias Krüger-11/+20
Detect long types in E0308 and write them to disk On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-12-08validate: use the correct reveal during optslcnr-0/+8
2022-12-08add a test case for `generic_const_exprs` in trait itemsTakayuki Maeda-2/+2
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-2/+2
2022-12-07Move closure/generator type info methods to TyCtxtMichael Goulet-0/+76
2022-12-07Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obkMatthias Krüger-4/+8
Don't ICE in ExprUseVisitor on FRU for non-existent struct Fixes #104613 Fixes #105202
2022-12-07Auto merge of #104799 - pcc:linkage-fn, r=tmiaskobors-1/+4
Support Option and similar enums as type of static variable with linkage attribute Compiler MCP: rust-lang/compiler-team#565
2022-12-07consider `parent_count` for const param defaultsTakayuki Maeda-0/+9
2022-12-06Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiserMatthias Krüger-170/+57
Put all cached values into a central struct instead of just the stable hash cc `@nnethercote` this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-06Rollup merge of #105342 - compiler-errors:note_cause_code-takes-predicate, ↵Matthias Krüger-9/+9
r=fee1-dead Make `note_obligation_cause_code` take a `impl ToPredicate` for predicate The only usecase that wasn't `impl ToPredicate` was noting overflow errors while revealing opaque types, which passed in an `Obligation<'tcx, Ty<'tcx>>`... Since this only happens in a `RevealAll` environment, which is after typeck (and probably primarily within `normalize_erasing_regions`) we're unlikely to display anything useful while noting this code, evidenced by the lack of UI test changes.
2022-12-06Rollup merge of #105287 - compiler-errors:issue-105275, r=eholkMatthias Krüger-2/+41
Synthesize substitutions for bad auto traits in dyn types Auto traits are stored as just `DefId`s inside a `dyn Trait`'s existential predicates list. This is usually fine, since auto traits are forbidden to have generics -- but this becomes a problem for an ill-formed auto trait. But since this will always result in an error, just synthesize some dummy (error) substitutions which are used at least to keep trait selection code happy about the number of substs in a trait ref. Fixes #104808
2022-12-06make retagging work even with 'unstable' placesRalf Jung-1/+1
2022-12-06Auto merge of #105220 - oli-obk:feeding, r=cjgillotbors-26/+45
feed resolver_for_lowering instead of storing it in a field r? `@cjgillot` opening this as * a discussion for `no_hash` + `feedable` queries. I think we'll want those, but I don't quite understand why they are rejected beyond a double check of the stable hashes for situations where the query is fed but also read from incremental caches. * and a discussion on removing all untracked fields from TyCtxt and setting it up so that they are fed queries instead
2022-12-06Add GenericParamDef::to_error and InternalSubsts::extend_with_errorMichael Goulet-13/+32
2022-12-06drive-by: Default param for ToPredicateMichael Goulet-9/+9
2022-12-05Move linkage type check to HIR analysis and fix semantics issues.Peter Collingbourne-1/+4
This ensures that the error is printed even for unused variables, as well as unifying the handling between the LLVM and GCC backends. This also fixes unusual behavior around exported Rust-defined variables with linkage attributes. With the previous behavior, it appears to be impossible to define such a variable such that it can actually be imported and used by another crate. This is because on the importing side, the variable is required to be a pointer, but on the exporting side, the type checker rejects static variables of pointer type because they do not implement `Sync`. Even if it were possible to import such a type, it appears that code generation on the importing side would add an unexpected additional level of pointer indirection, which would break type safety. This highlighted that the semantics of linkage on Rust-defined variables is different to linkage on foreign items. As such, we now model the difference with two different codegen attributes: linkage for Rust-defined variables, and import_linkage for foreign items. This change gives semantics to the test src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was previously expected to fail to compile. Therefore, convert it into a test that is expected to successfully compile. The update to the GCC backend is speculative and untested.
2022-12-05feed resolver_for_lowering instead of storing it in a fieldOli Scherer-14/+26
2022-12-05Allow arbitrary keys in feeding APIOli Scherer-12/+19
2022-12-05Synthesize generics for bad auto traits in dyn typesMichael Goulet-2/+22
2022-12-04drive-by: move field_index to typeck resultsMichael Goulet-4/+8
2022-12-04Auto merge of #105121 - oli-obk:simpler-cheaper-dump_mir, r=nnethercotebors-54/+32
Cheaper `dump_mir` take two alternative to #105083 r? `@nnethercote`
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-1/+1
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-12-03Auto merge of #105133 - oli-obk:promoted_def_ids, r=cjgillotbors-5/+10
Ensure query backtraces work for `DefId`s created after ast lowering r? `@cjgillot`
2022-12-02Rollup merge of #105162 - compiler-errors:fn-sig-arity, r=cjgillotMatthias Krüger-5/+15
Properly synthesize `FnSig` value during cycle Get the arity correct when creating a `FnSig` type during `tcx.fn_sig` cycle recovery Fixes #105152
2022-12-02Use zero based indexing for pass_countOli Scherer-2/+2
2022-12-02Remove an impl and replace its only use with a method callOli Scherer-6/+0
2022-12-01Properly synthesize fn sig value during cycleMichael Goulet-5/+15
2022-12-01Fill in `def_span` when creating def ids.Oli Scherer-1/+8
This makes sure that ICEing because of def ids created outside of ast lowering will be able to produce a query backtrace and not cause a double panic because of trying to call the `def_span` query
2022-12-01Don't allow feeding a query cache entry twiceOli Scherer-4/+2
2022-12-01Create `format_args` as late as possibleOli Scherer-17/+15
2022-12-01Remove needless `Cow`Oli Scherer-6/+2
2022-12-01Don't go through the formatting infrastructure just to get the name of a phaseOli Scherer-24/+14
2022-12-01Auto merge of #105095 - matthiaskrgr:rollup-9pu7vrx, r=matthiaskrgrbors-0/+6
Rollup of 9 pull requests Successful merges: - #103065 (rustdoc-json: Document and Test that args can be patterns.) - #104865 (Don't overwrite local changes when updating submodules) - #104895 (Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code) - #105063 (Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.) - #105064 (rustdoc: add comment to confusing CSS `main { min-width: 0 }`) - #105074 (Add Nicholas Bishop to `.mailmap`) - #105081 (Add a regression test for #104322) - #105086 (rustdoc: clean up sidebar link CSS) - #105091 (add Tshepang Mbambo to .mailmap) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-30Rollup merge of #104895 - chenyukang:yukang/fix-104884-serde, r=TaKO8KiMatthias Krüger-0/+6
Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code Fixes #104884
2022-11-30Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obkbors-10/+88
Allow to feed a value in another query's cache Restricted version of https://github.com/rust-lang/rust/pull/96840 A query can create new definitions. If those definitions are created after HIR lowering, they do not appear in the initial HIR map, and information for them cannot be provided in the normal pull-based way. In order to make those definitions useful, we allow to feed values as query results for the newly created definition. The API is as follows: ```rust let feed = tcx.create_def(<parent def id>, <DefPathData>); // `feed` is a TyCtxtFeed<'tcx>. // Access the created definition. let def_id: LocalDefId = feed.def_id; // Assign `my_query(def_id) := my_value`. feed.my_query(my_value). ``` This PR keeps the consistency checks introduced by https://github.com/rust-lang/rust/pull/96840, even if they are not reachable. This allows to extend the behaviour later without forgetting them. cc `@oli-obk` `@spastorino`
2022-11-30Generalize some InternedInSet implsOli Scherer-36/+6