summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-01-21Encode whether foreign opaques are TAITs or notMichael Goulet-0/+7
2023-01-19Do not filter substs in `remap_generic_params_to_declaration_params`.Camille GILLOT-26/+1
The relevant filtering should have been performed by borrowck.
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-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-2/+2
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-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
2022-11-30Remove PredicateS typeOli Scherer-52/+28
2022-11-30Update documentationOli Scherer-5/+5
2022-11-30Remove TySOli Scherer-95/+32
2022-11-30move WithCachedTypeInfo to rustc_type_irOli Scherer-5/+8
2022-11-30s/WithStableHash/WithCachedTypeInfo/Oli Scherer-34/+35
2022-11-30Auto merge of #105070 - matthiaskrgr:rollup-9b25khj, r=matthiaskrgrbors-3/+19
Rollup of 14 pull requests Successful merges: - #103876 (type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds) - #104427 (Explain why `rematch_impl` fails to be infallible) - #104436 (Add slice to the stack allocated string comment) - #104523 (Don't use periods in target names) - #104627 (Print all features with --print target-features) - #104911 (Make inferred_outlives_crate return Clause) - #105002 (Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`) - #105023 (Statics used in reachable function's inline asm are reachable) - #105045 (`rustc_ast_{passes,pretty}`: remove `ref` patterns) - #105049 (Hermit: Minor build fixes) - #105051 (Replace a macro with a function) - #105062 (rustdoc: use shorthand background for rustdoc toggle CSS) - #105066 (move `candidate_from_obligation` out of assembly) - #105068 (Run patchelf also on rust-analyzer-proc-macro-srv.) Failed merges: - #105050 (Remove useless borrows and derefs) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-29Rollup merge of #104911 - spastorino:inferred_outlives_crate-return-clause, ↵Matthias Krüger-3/+19
r=oli-obk Make inferred_outlives_crate return Clause r? ``@oli-obk``
2022-11-29Auto merge of #94487 - oli-obk:stable_hash_ty, r=fee1-deadbors-28/+59
Also cache the stable hash of interned Predicates continuation of https://github.com/rust-lang/rust/pull/94299 This is a small perf improvement and shares more code between `Ty` and `Predicate`
2022-11-29Make TyCtxtFeed::def_id private.Camille GILLOT-5/+12
2022-11-29Feedable queries must allow hashing.Camille GILLOT-13/+1
2022-11-29Only allow feeding a value to newly created definitions.Camille GILLOT-28/+42
2022-11-29Allow to set a query's result as a side effect.Camille GILLOT-0/+69