about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-11-26Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errorsGuillaume Gomez-0/+12
Use the power of adding helper function to simplify code w/ `Mutability` r? `@compiler-errors`
2022-11-26Auto merge of #104731 - compiler-errors:early-binder-iter-size-hint, r=cjgillotbors-0/+12
Add size hints to early binder iterator adapters probably doesn't do anything, but definitely doesn't hurt
2022-11-26Rollup merge of #104675 - SarthakSingh31:issue-101666, r=jyn514Matthias Krüger-2/+5
Unsupported query error now specifies if its unsupported for local or external crate Fixes #101666. I had to move `keys.rs` from `rustc_query_impl` to `rustc_middle`. I don't know if that is problematic. I couldn't think of any other way to get the needed information inside `rustc_middle`. r? ```@jyn514```
2022-11-26interpret: remove PartialOrd from a bunch of types that do not have or need ↵Ralf Jung-7/+7
a sensible order
2022-11-26Do not record unresolved const vars in generator interiorMichael Goulet-0/+9
2022-11-26simplify some binder shifting logicMichael Goulet-23/+24
2022-11-25Auto merge of #99798 - JulianKnodt:ac1, r=BoxyUwUbors-204/+203
Add `ConstKind::Expr` Starting to implement `ty::ConstKind::Abstract`, most of the match cases are stubbed out, some I was unsure what to add, others I didn't want to add until a more complete implementation was ready. r? `@lcnr`
2022-11-25Rename normalize_opaque_types to reveal_opaque_types_in_boundsMichael Goulet-6/+6
2022-11-25Auto merge of #104902 - matthiaskrgr:rollup-oo27a4u, r=matthiaskrgrbors-41/+6
Rollup of 8 pull requests Successful merges: - #104716 (move 2 candidates into builtin candidate) - #104760 (Clarify `SyntaxExtensionKind::LegacyDerive`.) - #104797 (rustc_codegen_ssa: write `.dwp` in a streaming fashion) - #104835 (Use infcx.partially_normalize_associated_types_in) - #104853 (Fix typo in miri sysroot) - #104879 (jsondoclint: Recognise Typedef as valid kind for Type::ResolvedPath) - #104887 (rustbuild: Don't build doc::SharedAssets when building JSON docs.) - #104896 (rustdoc: fix broken tooltip CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-25Cache Predicates' hash within themselvesOli Scherer-28/+59
2022-11-25Auto merge of #104846 - ↵bors-65/+94
spastorino:santa-clauses-make-goals-early-christmas-🎄, r=oli-obk Branch Clause from Predicate r? `@oli-obk` This is part of what's proposed in https://github.com/rust-lang/compiler-team/issues/531
2022-11-25remove `TypeError::ObjectUnsafeCoercion`lcnr-4/+1
2022-11-25Add documentation for `has_escaping_bound_vars`Deadbeef-1/+7
2022-11-25add commentlcnr-0/+6
2022-11-25move 2 candidates into builtin candidatelcnr-41/+0
2022-11-25Fix mk_const_listkadmin-1/+1
2022-11-25Make `expand_abstract_consts` infallibleBoxy-55/+21
2022-11-25`super_relate_consts` do not spurriously fail on assoc constsBoxy-16/+9
2022-11-25add FIXME'sBoxy-0/+3
2022-11-25correctly intern `List<Const<'tcx>>`Boxy-1/+4
2022-11-25fmtBoxy-3/+3
2022-11-25Add expand_abstract_constkadmin-53/+64
Adds the ability to directly expand a const to an expr without having to deal with intermediate steps.
2022-11-25Add empty ConstKind::Abstractkadmin-192/+215
Initial pass at expr/abstract const/s Address comments Switch to using a list instead of &[ty::Const], rm `AbstractConst` Remove try_unify_abstract_consts Update comments Add edits Recurse more More edits Prevent equating associated consts Move failing test to ui Changes this test from incremental to ui, and mark it as failing and a known bug. Does not cause the compiler to ICE, so should be ok.
2022-11-25Add helper method to `ScalarInt`Oli Scherer-0/+12
2022-11-25Auto merge of #104602 - petrochenkov:effvisperf5, r=oli-obkbors-50/+57
privacy: Fix more (potential) issues with effective visibilities Continuation of https://github.com/rust-lang/rust/pull/103965. See individual commits for more detailed description of the changes. The shortcuts removed in https://github.com/rust-lang/rust/pull/104602/commits/4eb63f618e601efee657d24cd4e8833fb03fac4c and https://github.com/rust-lang/rust/pull/104602/commits/c7c7d1672739e38c8d39ae861b284486aefd5b48 could actually be correct (or correct after some tweaks), but they used global reasoning like "we can skip this update because if the code compiles then some other update should do the same thing eventually". I have some expertise in this area, but I still have doubt whether such global reasoning was correct or not, especially in presence of all possible exotic cases with imports. After this PR all table changes should be "locally correct" after every update, even if it may be overcautious. If similar optimizations are introduced again they will need detailed comments explaining why it's legal to do what they do and providing proofs. Fixes https://github.com/rust-lang/rust/issues/104249. Fixes https://github.com/rust-lang/rust/issues/104539.
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-48/+75
2022-11-25get rid of to_poly_trait_predicateOli Scherer-17/+19
2022-11-24Auto merge of #104845 - matthiaskrgr:rollup-tckj956, r=matthiaskrgrbors-3/+3
Rollup of 11 pull requests Successful merges: - #104514 (Use node_ty_opt to avoid ICE in visit_ty) - #104704 (Allow power10-vector feature in PowerPC) - #104747 (resolve: Don't use constructor def ids in the map for field names) - #104773 (OpaqueCast projections are always overlapping, they can't possibly be disjoint) - #104774 (Document split{_ascii,}_whitespace() for empty strings) - #104780 (make `error_reported` check for delayed bugs) - #104782 (Bump the const eval step limit) - #104792 (rustdoc: simplify `.search-results-title` CSS) - #104796 (lint: do not warn unused parens around higher-ranked function pointers) - #104820 (Remove normalize_projection_type) - #104822 (with_query_mode -> new) Failed merges: - #104716 (move 2 candidates into builtin candidate) - #104841 (Assert that we don't capture escaping bound vars in `Fn` trait selection) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-24Rollup merge of #104782 - oli-obk:const_eval_limit_bump, r=pnkfelixMatthias Krüger-1/+1
Bump the const eval step limit fixes https://github.com/rust-lang/rust/issues/103814 https://github.com/rust-lang/rust/pull/103877 has too much of an impact to beta backport. So let's just increase the limit, avoiding the immediate breakage. r? ``@pnkfelix``
2022-11-24Rollup merge of #104780 - BoxyUwU:error_reported_not_be_bad, r=oli-obkMatthias Krüger-2/+2
make `error_reported` check for delayed bugs Fixes #104768 `error_reported()` was only checking if there were errors emitted, not for `delay_bug`s which can also be a source of `ErrorGuaranteed`. I assume the same is true of `lint_err_count` but i dont know
2022-11-24Auto merge of #103693 - HKalbasi:master, r=oli-obkbors-203/+102
Make rustc_target usable outside of rustc I'm working on showing type size in rust-analyzer (https://github.com/rust-lang/rust-analyzer/pull/13490) and I currently copied rustc code inside rust-analyzer, which works, but is bad. With this change, I would become able to use `rustc_target` and `rustc_index` directly in r-a, reducing the amount of copy needed. This PR contains some feature flag to put nightly features behind them to make crates buildable on the stable compiler + makes layout related types generic over index type + removes interning of nested layouts.
2022-11-24Use kw::Empty for elided lifetimes in path.Camille GILLOT-16/+21
2022-11-24Record in HIR whether lifetime elision was succesful.Camille GILLOT-0/+2
2022-11-24Auto merge of #104321 - Swatinem:async-gen, r=oli-obkbors-0/+47
Avoid `GenFuture` shim when compiling async constructs Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through. --- Given this demo code: ```rust pub async fn a(arg: u32) -> Backtrace { let bt = b().await; let _arg = arg; bt } pub async fn b() -> Backtrace { Backtrace::force_capture() } ``` I would get the following with the latest stable compiler (on Windows): ``` 4: async_codegen::b::async_fn$0 at .\src\lib.rs:10 5: core::future::from_generator::impl$1::poll<enum2$<async_codegen::b::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 6: async_codegen::a::async_fn$0 at .\src\lib.rs:4 7: core::future::from_generator::impl$1::poll<enum2$<async_codegen::a::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 ``` whereas now I get a much cleaner stack trace: ``` 3: async_codegen::b::async_fn$0 at .\src\lib.rs:10 4: async_codegen::a::async_fn$0 at .\src\lib.rs:4 ```
2022-11-24Unsupported query error now specifies if its unsupported for local or ↵Sarthak Singh-2/+5
external crate
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-73/+76
2022-11-24move some layout logic to rustc_target::abi::layouthkalbasi-186/+82
2022-11-24make rustc_target usable outside of rustchkalbasi-4/+4
2022-11-24make `error_reported` check for delayed bugsBoxy-2/+2
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-0/+47
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
2022-11-24Auto merge of #103808 - cjgillot:vec-cache, r=TaKO8Kibors-2/+600
Use an IndexVec to cache queries with index-like key Revival of an old idea. Let's see if it has more effect. r? `@ghost`
2022-11-24effective visibility: Always add table entries for nodes used as parentsVadim Petrochenkov-33/+37
Previously if the parent was not in the table, and there was nothing to inherit from, the child's private visibility was used, but that's not correct - the parent may have a larger visibility so we should set it to at least the parent's private visibility. That parent's private visibility is also inserted into the table for caching, so it's not recalculated later if used again.
2022-11-24effective visibility: Remove questionable optimizationsVadim Petrochenkov-7/+0
First, they require eagerly calculating private visibility (current normal module), which is somewhat expensive. Private visibilities are also lost once calculated, instead of being cached in the table. Second, I cannot prove that the optimizations are correct. Maybe they can be partially reinstated in the future in cases when it's cheap and provably correct to do them. They will also probably be merged into `fn update` in that case. Partially fixes https://github.com/rust-lang/rust/issues/104249 Fixes https://github.com/rust-lang/rust/issues/104539
2022-11-24effective visibility: Satisfy borrow checker to use resolver lazily from a ↵Vadim Petrochenkov-10/+20
closure
2022-11-23Simplify creation of `AutoBorrowMutability`Maybe Waffle-0/+12
2022-11-23use no type in ProjectionElem::Field for PlaceBuilder::UpVarb-naber-13/+38
2022-11-23Separate lifetime ident from resolution in HIR.Camille GILLOT-5/+4
2022-11-23Bump the const eval step limitOli Scherer-1/+1
2022-11-22Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnrManish Goregaokar-23/+47
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases r? ````@lcnr```` fixes #99840
2022-11-23Rollup merge of #104728 - WaffleLapkin:require-lang-items-politely, ↵Yuki Okushi-3/+5
r=compiler-errors Use `tcx.require_lang_item` instead of unwrapping lang items I clearly remember esteban telling me that there is `require_lang_item` but he was from a phone atm and I couldn't find it, so I didn't use it. Stumbled on it today, so here we are :)