about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-06-04Rollup merge of #97737 - jackh726:verbose-pretty-printing-fix, r=compiler-errorsMatthias Krüger-24/+30
Fix pretty printing named bound regions under -Zverbose Fixed regression introduced in #97023 r? `@compiler-errors` cc `@cjgillot`
2022-06-04Rollup merge of #97609 - Elliot-Roberts:unused-trait-refactor, r=cjgillotMatthias Krüger-7/+7
Iterate over `maybe_unused_trait_imports` when checking dead trait imports Closes #96873 r? `@cjgillot` Some questions, if you have time: - Is there a way to shorten the `rustc_data_structures::fx::FxIndexSet` path in the query declaration? I wasn't sure where to put a `use`. - Was returning by reference from the query the right choice here? - How would I go about evaluating the importance of the `is_dummy()` call in `check_crate`? I don't see failing tests when I comment it out. Should I just try to determine whether dummy spans can ever be put into `maybe_unused_trait_imports`? - Am I doing anything silly with the various ID types? - Is that `let-else` with `unreachable!()` bad? (i.e is there a better idiom? Would `panic!("<explanation>")` be better?) - If I want to evaluate the perf of using a `Vec` as mentioned in #96873, is the best way to use the CI or is it feasible locally? Thanks :)
2022-06-04Fix pretty printing named bound regions under -ZverboseJack Huey-24/+30
2022-06-04use precise spans for recursive const evaluationRalf Jung-3/+16
2022-06-04Iterate over `maybe_unused_trait_imports` when checking dead trait importsElliot Roberts-7/+7
2022-06-04Completely remove LifetimeScopeForPath.Camille GILLOT-26/+2
2022-06-04Compute lifetimes in scope at diagnostic time.Camille GILLOT-3/+6
2022-06-03Fully stabilize NLLJack Huey-40/+1
2022-06-03Make hir().get_generics and generics_of consistent.Camille GILLOT-21/+1
2022-06-03Normalize consts' tys when relating with adt_const_paramsMichael Goulet-4/+9
2022-06-03Auto merge of #85993 - bjorn3:serde_json, r=wesleywiserbors-7/+7
Remove all json handling from rustc_serialize Json is now handled using serde_json. Where appropriate I have replaced json usage with binary serialization (rmeta files) or manual string formatting (emcc linker arg generation). This allowed for removing and simplifying a lot of code, which hopefully results in faster serialization/deserialization and faster compiles of rustc itself. Where sensible we now use serde. Metadata and incr cache serialization keeps using a heavily modified (compared to crates.io) rustc-serialize version that in the future could probably be extended with zero-copy deserialization or other perf tricks that serde can't support due to supporting more than one serialization format. Note that I had to remove `-Zast-json` and `-Zast-json-noexpand` as the relevant AST types don't implement `serde::Serialize`. Fixes #40177 See also https://github.com/rust-lang/compiler-team/issues/418
2022-06-03Remove emit_unitbjorn3-6/+6
It doesn't do anything for all encoders
2022-06-03Use serde_json for target spec jsonbjorn3-1/+1
2022-06-03Replace `&Vec<_>`s with `&[_]`sMaybe Waffle-5/+13
2022-06-03Auto merge of #97694 - Dylan-DPC:rollup-2yxo7ce, r=Dylan-DPCbors-8/+18
Rollup of 3 pull requests Successful merges: - #97415 (Compute `is_late_bound_map` query separately from lifetime resolution) - #97471 (Provide more context when denying invalid type params ) - #97681 (Add more eslint checks) Failed merges: - #97446 (Make hir().get_generics and generics_of consistent.) r? `@ghost` `@rustbot` modify labels: rollup
2022-06-03Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebankDylan DPC-8/+18
Compute `is_late_bound_map` query separately from lifetime resolution This query is actually very simple, and is only useful for functions and method. It can be computed directly by fetching the HIR, with no need to embed it within the lifetime resolution visitor. Based on https://github.com/rust-lang/rust/pull/96296
2022-06-03Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebankbors-1/+34
rewrite error handling for unresolved inference vars Pretty much completely rewrites `fn emit_inference_failure_err`. This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments. Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs. r? `@estebank` `@petrochenkov`
2022-06-03Compute `is_late_bound` in a separate query.Camille GILLOT-2/+13
The computation is actually much simpler, and can be done by directly fetching the HIR for the `FnDecl` and its generics.
2022-06-03Manipulate lifetimes by LocalDefId for region resolution.Camille GILLOT-6/+5
2022-06-03Rollup merge of #97664 - estebank:suggest-bound-derive-copy, r=compiler-errorsDylan DPC-1/+4
On E0204 suggest missing type param bounds ``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-06-03Rollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obkDylan DPC-1/+7
add cast kind of from_exposed_addr (int-to-ptr casts) This is basically the dual to https://github.com/rust-lang/rust/pull/97582, for int2ptr casts. Cc `@tmiasko` https://github.com/rust-lang/rust/issues/97649
2022-06-02On E0204 suggest missing type param boundsEsteban Küber-1/+4
``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-06-02add cast kind of from_exposed_addr (int-to-ptr casts)Ralf Jung-1/+7
2022-06-02Rollup merge of #97023 - cjgillot:uniform-anon, r=estebankDylan DPC-43/+28
Diagnose anonymous lifetimes errors more uniformly between async and regular fns Async fns and regular fns are desugared differently. For the former, we create a generic parameter at HIR level. For the latter, we just create an anonymous region for typeck. I plan to migrate regular fns to the async fn desugaring. Before that, this PR attempts to merge the diagnostics for both cases. r? ```@estebank```
2022-06-02add new `emit_inference_failure_err`lcnr-1/+34
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-4/+5
2022-05-31Add a pointer to address cast kindTomasz Miąsko-17/+10
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-30Auto merge of #97025 - ouz-a:mini-derefer-generator, r=davidtwcobors-3/+5
Add validation layer for Derefer _Follow up work to #96549 #96116 #95857 #95649_ This adds validation for Derefer making sure it is always the first projection. r? rust-lang/mir-opt
2022-05-30validate derefer, run derefer inside generatorouz-a-3/+5
2022-05-30Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errorsbors-3/+6
Replace `#[default_method_body_is_const]` with `#[const_trait]` pulled out of #96077 related issues: #67792 and #92158 cc `@fee1-dead` This is groundwork to only allowing `impl const Trait` for traits that are marked with `#[const_trait]`. This is necessary to prevent adding a new default method from becoming a breaking change (as it could be a non-const fn).
2022-05-30Add a helper function for checking whether a default function in a trait can ↵Oli Scherer-1/+6
be treated as `const`
2022-05-30Remove `#[default..]` and add `#[const_trait]`Deadbeef-3/+1
2022-05-30Add support for emitting functions with `coldcc` in LLVMScott McMurray-1/+2
The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
2022-05-29Auto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbinibors-4/+3
Finish bumping stage0 It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though. This now brings us to cfg-clean, with the exception of check-cfg-features in bootstrap; I'd prefer to leave that for a separate PR at this time since it's likely to be more tricky. cc https://github.com/rust-lang/rust/pull/97147#issuecomment-1132845061 r? `@pietroalbini`
2022-05-29Stop pretty-printing anonymous lifetimes.Camille GILLOT-43/+28
2022-05-28Make TyCtxt implement Interner, make HashStable generic and move to ↵Michael Goulet-108/+81
rustc_type_ir
2022-05-28Remove some comments, inline interner fnMichael Goulet-38/+2
2022-05-28Fix TyKind lint, make consts no longer fn, etcMichael Goulet-211/+19
2022-05-28Initial fixes on top of type interner commitMichael Goulet-72/+69
2022-05-28Move things to rustc_type_irWilco Kusee-226/+229
2022-05-28Auto merge of #97383 - dingxiangfei2009:restore-region-scope-tree-query, ↵bors-8/+7
r=dingxiangfei2009 Try to cache region_scope_tree as a query This PR will attempt to restore `region_scope_tree` as a query so that caching works again. It seems that `region_scope_tree` could be re-computed for nested items after all, which could explain the performance regression introduced by #95563. cc `@Mark-Simulacrum` `@pnkfelix` I will try to trigger a perf run here.
2022-05-28Auto merge of #97158 - JakobDegen:dse, r=tmiasko,cjgillotbors-0/+17
Split dead store elimination off dest prop This splits off a part of #96451 . I've added this in as its own pass for now, so that it actually runs, can be tested, etc. In the dest prop PR, I'll stop invoking this as its own pass, so that it doesn't get invoked twice. r? `@tmiasko`
2022-05-28Auto merge of #97284 - b-naber:constraint-dyn-impl-suggestion, r=estebankbors-6/+9
Add suggestion for relaxing static lifetime bounds on dyn trait impls in NLL This PR introduces suggestions for relaxing static lifetime bounds on impls of dyn trait items for NLL similar to what is already available in lexical region diagnostics. Fixes https://github.com/rust-lang/rust/issues/95701 r? `@estebank`
2022-05-28Rollup merge of #97453 - lcnr:comment, r=jackh726Matthias Krüger-1/+1
rename `TyKind` to `RegionKind` in comment in rustc_middle
2022-05-27fix commentlcnr-1/+1
2022-05-27Finish bumping stage0Mark Rousskov-4/+3
It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though.
2022-05-27Auto merge of #96046 - oli-obk:const_typeck, r=cjgillotbors-11/+0
Move various checks to typeck so them failing causes the typeck result to get tainted Fixes #69487 fixes #79047 cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
2022-05-26clippy::complexity fixesMatthias Krüger-2/+1
clone_on_copy useless_format bind_instead_of_map filter_map_identity useless_conversion map_flatten unnecessary_unwrap
2022-05-26rebase, use Ty in CallArgument and re-insert static_assert_size on ↵b-naber-4/+10
ConstraintCategory
2022-05-25add def_id and substs to ConstraintCategory::CallArgumentb-naber-9/+6