Pretty-print always-const trait predicates correctly#119476
Pretty-print always-const trait predicates correctly#119476bors merged 1 commit intorust-lang:masterfrom
Conversation
| | | ||
| LL | pub const EQ: bool = equals_self(&S); | ||
| | ----------- ^^ the trait `~const Foo` is not implemented for `S` | ||
| | ----------- ^^ the trait `const Foo` is not implemented for `S` |
There was a problem hiding this comment.
This regression is a bit unfortunate. Of course, from the perspective of the lowered code, it makes perfect sense that we register always-const trait predicate obligations in const item bodies, so technically speaking it's correct.
Still, it's bad that we're now basically saying S: const Trait is unsatisfied // required by bound ~const Trait in equals_self.
This comment has been minimized.
This comment has been minimized.
2d550a4 to
19e4eb2
Compare
compiler-errors
left a comment
There was a problem hiding this comment.
r=me unless you want a specific review
| // Calling `equals_self` with something that has a non-const impl should throw an error, despite | ||
| // it not using the impl. | ||
|
|
||
| // FIXME(effects): We should print `S: ~const Foo` here instead. |
There was a problem hiding this comment.
Why? I believe that S: const Foo makes sense here, since this is in an always-const context...
There was a problem hiding this comment.
It does make sense to me as I've written above, I'm just not super keen on the
diagnostic note required by this bound, *points at ~const*.
I can imagine ppl will open gh issues for that. Anyways.
| = note: expected constant `false` | ||
| found constant `true` |
There was a problem hiding this comment.
We may want to intercept the TypeError here and special-case it for host params (as a follow-up)...
19e4eb2 to
01ac44a
Compare
|
I've removed that FIXME. @bors r=compiler-errors rollup |
|
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…, r=compiler-errors Pretty-print always-const trait predicates correctly Follow-up to rust-lang#119099. r? fee1-dead
…, r=compiler-errors Pretty-print always-const trait predicates correctly Follow-up to rust-lang#119099. r? fee1-dead
Rollup of 21 pull requests Successful merges: - rust-lang#119086 (Query panic!() to useful diagnostic) - rust-lang#119239 (Remove unnecessary arm in `check_expr_yield`) - rust-lang#119298 (suppress change-tracker warnings in CI containers) - rust-lang#119319 (Document that File does not buffer reads/writes) - rust-lang#119434 (rc: Take *const T in is_dangling) - rust-lang#119444 (Rename `TyCtxt::is_closure` to `TyCtxt::is_closure_or_coroutine`) - rust-lang#119474 (Update tracking issue of naked_functions) - rust-lang#119476 (Pretty-print always-const trait predicates correctly) - rust-lang#119477 (rustdoc ui: adjust tooltip z-index to be above sidebar) - rust-lang#119479 (Remove two unused feature gates from rustc_query_impl) - rust-lang#119487 (Minor improvements in comment on `freshen.rs`) - rust-lang#119492 (Update books) - rust-lang#119494 (Deny defaults for higher-ranked generic parameters) - rust-lang#119498 (Update deadlinks of `strict_provenance` lints) - rust-lang#119505 (Don't synthesize host effect params for trait associated functions marked const) - rust-lang#119510 (Report I/O errors from rmeta encoding with emit_fatal) - rust-lang#119512 (Mark myself as back from leave) - rust-lang#119514 (coverage: Avoid a query stability hazard in `function_coverage_map`) - rust-lang#119523 (llvm: Allow `noundef` in codegen tests) - rust-lang#119534 (Update `thread_local` examples to use `local_key_cell_methods`) - rust-lang#119544 (Fix: Properly set vendor in i686-win7-windows-msvc target) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119476 - fmease:pp-always-const-trait-preds, r=compiler-errors Pretty-print always-const trait predicates correctly Follow-up to rust-lang#119099. r? fee1-dead
Follow-up to #119099.
r? fee1-dead