about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-10-26 22:01:13 +0800
committerGitHub <noreply@github.com>2024-10-26 22:01:13 +0800
commitbafe790a2d3ac8f6f2092a86a4eb22df864481ac (patch)
tree36f05b170edb34e9972cd2d934e7eeb058ce8aaa /compiler/rustc_pattern_analysis/src
parent7981acaf7ee0ec379b12cf44cac6bb59f743ba11 (diff)
parentf2f67232a53b79b44c5b87fe5757ef1f18f4b590 (diff)
downloadrust-bafe790a2d3ac8f6f2092a86a4eb22df864481ac.tar.gz
rust-bafe790a2d3ac8f6f2092a86a4eb22df864481ac.zip
Rollup merge of #132169 - fee1-dead-contrib:consttraitsck, r=compiler-errors
Deny calls to non-`#[const_trait]` methods in MIR constck

This is a (potentially temporary) fix that closes off the mismatch in assumptions between MIR constck and typeck which does the const traits checking. Before this PR, MIR constck assumed that typeck correctly handled all calls to trait methods in const contexts if effects is enabled. That is not true because typeck only correctly handles callees that are const. For non-const callees (such as methods in a non-const_trait), typeck had never created an error.

https://github.com/rust-lang/rust/blob/45089ec19ebebec88bace6ec237244ff0eaa7ad3/compiler/rustc_hir_typeck/src/callee.rs#L876-L877

I called this potentially temporary because the const checks could be moved to HIR entirely. Alongside the recent refactor in const stability checks where that component could be placed would need more discussion. (cc ```@compiler-errors``` ```@RalfJung)```

Tests are updated, mainly due to traits not being const in core, so tests that call them correctly error.

This fixes https://github.com/rust-lang/project-const-traits/issues/12.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions