about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-10-08Rollup merge of #102514 - b-naber:binder-print-fixes, r=jackh726Michael Howell-12/+63
Don't repeat lifetime names from outer binder in print Fixes https://github.com/rust-lang/rust/issues/102392 Fixes https://github.com/rust-lang/rust/issues/102414 r? ```@lcnr```
2022-10-08handle late-bound vars from inner binders correctly and add testb-naber-1/+1
2022-10-08Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgrbors-5/+42
Rollup of 8 pull requests Successful merges: - #101520 (Allow transmutes between the same types after erasing lifetimes) - #102675 (Remove `mir::CastKind::Misc`) - #102778 (Fix MIR inlining of asm_unwind) - #102785 (Remove `DefId` from some `SelectionCandidate` variants) - #102788 (Update rustc-dev-guide) - #102789 (Update browser UI test version) - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`) - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-08Rollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errorsMatthias Krüger-2/+2
Remove `DefId` from some `SelectionCandidate` variants They are both from `obligation.predicate.def_id()`, which do not need to be on the `SelectionCandidate`. cc ````@lcnr```` ````@compiler-errors````
2022-10-08Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obkMatthias Krüger-3/+40
Remove `mir::CastKind::Misc` As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast. r? ````@oli-obk````
2022-10-08Auto merge of #100720 - camsteffen:representable, r=cjgillotbors-5/+200
Rewrite representability * Improve placement of `Box` in the suggestion * Multiple items in a cycle emit 1 error instead of an error for each item in the cycle * Introduce `representability` query to avoid traversing an item every time it is used. * Also introduce `params_in_repr` query to avoid traversing generic items every time it is used.
2022-10-08Stabilize half_open_range_patternsUrgau-1/+1
2022-10-07Check hidden types in dead codeOli Scherer-1/+1
2022-10-07Remap hidden types from typeck before storing them in the TypeckResultOli Scherer-16/+31
2022-10-07Move ReverseMapper logic onto OpaqueHiddenTypeOli Scherer-0/+240
2022-10-07Unconditionally encode hidden types in typeck resultsOli Scherer-5/+3
2022-10-07First batch of review feedback changes from #102110Nathan Stocks-1/+20
2022-10-07Remove tuple candidate, nothing special about itMichael Goulet-14/+2
2022-10-07make const_err a hard errorRalf Jung-18/+1
2022-10-07Remove `DefId` from some `SelectionCandidate` variantsDeadbeef-2/+2
2022-10-07Rewrite representabilityCameron Steffen-5/+200
2022-10-06Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnrMatthias Krüger-0/+6
make `compare_const_impl` a query and use it in `instance.rs` Fixes #88365 the bug in #88365 was caused by some `instance.rs` code using the `PartialEq` impl on `Ty` to check that the type of the associated const in an impl is the same as the type of the associated const in the trait definition. This was wrong for two reasons: - the check typeck does is that the impl type is a subtype of the trait definition's type (see `mismatched_impl_ty_2.rs` which [was ICEing](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f6d60ebe6745011f0d52ab2bc712025d) before this PR on stable) - it assumes that if two types are equal then the `PartialEq` impl will reflect that which isnt true for higher ranked types or type level constants when `feature(generic_const_exprs)` is enabled (see `mismatched_impl_ty_3.rs` for higher ranked types which was [ICEing on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7af131a655ed515b035624626c62c71)) r? `@lcnr`
2022-10-06Remove `mir::CastKind::Misc`ouz-a-3/+40
2022-10-05Validate opaques in default trait bodies, don't normalize unless a body is ↵Michael Goulet-1/+1
provided
2022-10-05Fix test for default body with implMichael Goulet-0/+1
2022-10-04Rollup merge of #102651 - oli-obk:non_region_things, r=lcnrMatthias Krüger-17/+17
It's not about types or consts, but the lack of regions pulled out of https://github.com/rust-lang/rust/pull/101900 which adds a fourth kind of non-lifetime generic parameter, and the naming of these methods would get ridiculous.
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-17/+17
2022-10-04Auto merge of #102652 - Dylan-DPC:rollup-6ff8ct8, r=Dylan-DPCbors-1/+3
Rollup of 6 pull requests Successful merges: - #101189 (Implement `Ready::into_inner()`) - #101642 (Fix in-place collection leak when remaining element destructor panic) - #102489 (Normalize substs before resolving instance in `NoopMethodCall` lint) - #102559 (Don't ICE when trying to copy unsized value in const prop) - #102568 (Lint against nested opaque types that don't satisfy associated type bounds) - #102633 (Fix rustdoc ICE in invalid_rust_codeblocks lint) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-04Rollup merge of #102568 - compiler-errors:lint-unsatisfied-opaques, r=oli-obkDylan DPC-1/+3
Lint against nested opaque types that don't satisfy associated type bounds See the test failures for examples of places where this lint would fire. r? `@oli-obk`
2022-10-04Auto merge of #102622 - camsteffen:move-layout, r=fee1-deadbors-2639/+5
Move layout_of and friends from rustc_middle to rustc_ty_utils Breaks up the very large module that is `rustc_middle::ty::layout` by fork-lifting some queries into `rustc_ty_utils::{abi, layout}`. This does set back `rustc_ty_utils` to having untranslatable diagnostics. I'd like to leave this as a separate task.
2022-10-04Rollup merge of #102567 - compiler-errors:issue-102561, r=davidtwcoMatthias Krüger-1/+4
Delay evaluating lint primary message until after it would be suppressed Fixes #102561 Fixes #102572
2022-10-03Auto merge of #102632 - matthiaskrgr:rollup-h8s3zmo, r=matthiaskrgrbors-5/+10
Rollup of 7 pull requests Successful merges: - #98218 (Document the conditional existence of `alloc::sync` and `alloc::task`.) - #99216 (docs: be less harsh in wording for Vec::from_raw_parts) - #99460 (docs: Improve AsRef / AsMut docs on blanket impls) - #100470 (Tweak `FpCategory` example order.) - #101040 (Fix `#[derive(Default)]` on a generic `#[default]` enum adding unnecessary `Default` bounds) - #101308 (introduce `{char, u8}::is_ascii_octdigit`) - #102486 (Add diagnostic struct for const eval error in `rustc_middle`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-03Add diagnostic struct for const eval error in `rustc_middle`pierwill-5/+10
Co-authored-by: Michael Goulet <michael@errs.io>
2022-10-03Rollup merge of #102597 - compiler-errors:issue-102571, r=davidtwcoMatthias Krüger-1/+1
Avoid ICE in printing RPITIT type Fixes #102571
2022-10-03re-name params + add commentsb-naber-10/+16
2022-10-03Move utils from rustc_middle to rustc_ty_utilsCameron Steffen-2639/+5
2022-10-03Rollup merge of #102592 - WaffleLapkin:less_lifetimes, r=cjgillotMatthias Krüger-7/+6
Remove a couple lifetimes that can be infered From the review: https://github.com/rust-lang/rust/pull/101986#discussion_r974497497 r? `@cjgillot`
2022-10-02Avoid ICE in printing RPITIT typeMichael Goulet-1/+1
2022-10-02Lint for unsatisfied nested opaquesMichael Goulet-1/+3
2022-10-02Remove a couple lifetimes that could be inferedMaybe Waffle-7/+6
2022-10-02Rollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-deadDylan DPC-6/+26
Give `def_span` the same SyntaxContext as `span_with_body`. https://github.com/rust-lang/rust/issues/102217 I'm not sure how to add a test, since the erroneous span was crafted using a proc macro. The debug assertion in `def_span` will ensure we have the correct behaviour.
2022-10-02Delay evaluating lint primary message until after it would be suppressedMichael Goulet-1/+4
2022-10-01Use a SortedMap instead of a VecMap.Camille GILLOT-2/+2
2022-10-01Compute by owner instead of HirId.Camille GILLOT-9/+23
2022-10-01Do not fetch HIR node when iterating to find lint.Camille GILLOT-15/+15
2022-10-01Move lint level computation to rustc_middle::lint.Camille GILLOT-76/+69
2022-10-01Move code to rustc_lint.Camille GILLOT-149/+38
2022-10-01Remove unused tool_name.Camille GILLOT-2/+0
2022-10-01Compute `lint_levels` by definitionDeadbeef-37/+112
2022-10-01Allow query system to recover a HirId.Camille GILLOT-6/+32
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-23/+45
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01Move lint level source explanation to the bottomMaybe Waffle-2/+1
2022-10-01Refactor rustc lint APIMaybe Waffle-22/+45
2022-10-01Give `def_span` the same SyntaxContext as `span_with_body`.Camille GILLOT-6/+26
2022-09-30Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillotMatthias Krüger-2/+2
create def ids for impl traits during ast lowering r? `@cjgillot`