about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
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-2641/+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-2641/+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`
2022-09-30create def ids for impl traits during ast loweringSantiago Pastorino-2/+2
2022-09-30make query take `(LocalDefId, DefId)`Boxy-2/+2
2022-09-30make `compare_const_impl` a query and use it in `instance.rs`Boxy-0/+6
2022-09-30Stabilize map_first_lastest31-1/+0
2022-09-30don't repeat lifetime names from outer binder in printb-naber-12/+57
2022-09-30Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwcoMatthias Krüger-0/+13
Migrate rustc_codegen_gcc to SessionDiagnostics As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate. ``@rustbot`` label +A-translation
2022-09-30Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Kibors-0/+5
Serialize return-position `impl Trait` in trait hidden values in foreign libraries Fixes #101630
2022-09-29Auto merge of #101887 - nnethercote:shrink-Res, r=spastorinobors-1/+2
Shrink `hir::def::Res` r? `@spastorino`
2022-09-29Auto merge of #101893 - oli-obk:lift_derive, r=lcnrbors-0/+1
Fix perf regression from TypeVisitor changes Regression occurred in https://github.com/rust-lang/rust/pull/101858#issuecomment-1248732579 Instead of just reverting, we only fixed part of the regression. The main regression was due to actually correctly visiting a type that contains types and consts and should therefor be visited. This is not actually observable (yet?), but we should still do it correctly instead of risking major bugs in the future.
2022-09-29Rollup merge of #102399 - b-naber:binder-print-ice, r=lcnrYuki Okushi-4/+10
Account for use of index-based lifetime names in print of binder Fixes https://github.com/rust-lang/rust/issues/102374 r? ```@lcnr``` cc ```@steffahn```