rust/compiler
许杰友 Jieyou Xu (Joe) bafe790a2d
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.

45089ec19e/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.
2024-10-26 22:01:13 +08:00
..
rustc
rustc_abi Make rustc_abi compile on stable again 2024-10-21 15:11:20 +02:00
rustc_arena move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
rustc_ast Rollup merge of #132106 - maxcabrajac:ident_ref, r=petrochenkov 2024-10-25 20:33:11 +02:00
rustc_ast_ir Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
rustc_ast_lowering Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
rustc_ast_passes Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead 2024-10-26 06:29:47 +02:00
rustc_ast_pretty Print safety correctly in extern static items 2024-10-24 00:41:27 +00:00
rustc_attr Re-do recursive const stability checks 2024-10-25 20:31:40 +02:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #131756 - compiler-errors:deeply-normalize-type-err, r=lcnr 2024-10-24 14:19:55 +11:00
rustc_builtin_macros Auto merge of #131349 - RalfJung:const-stability-checks, r=compiler-errors 2024-10-25 23:29:40 +00:00
rustc_codegen_cranelift Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors 2024-10-26 06:29:48 +02:00
rustc_codegen_gcc Effects cleanup 2024-10-26 10:19:07 +08:00
rustc_codegen_llvm Rollup merge of #132124 - Zalathar:consolidate-covstar, r=jieyouxu 2024-10-26 22:01:12 +08:00
rustc_codegen_ssa Effects cleanup 2024-10-26 10:19:07 +08:00
rustc_const_eval Deny calls to non-#[const_trait] methods in MIR constck 2024-10-26 11:35:56 +08:00
rustc_data_structures Replace an FTP link in comments with an equivalent HTTPS link 2024-10-24 17:02:11 +11:00
rustc_driver
rustc_driver_impl Rollup merge of #130899 - bjorn3:wasi_bootstrap_fixes, r=davidtwco 2024-10-07 11:10:53 -07:00
rustc_error_codes terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it) 2024-10-22 07:37:54 +01:00
rustc_error_messages
rustc_errors "innermost", "outermost", "leftmost", and "rightmost" don't need hyphens 2024-10-23 02:45:24 -07:00
rustc_expand Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead 2024-10-26 06:29:47 +02:00
rustc_feature Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead 2024-10-26 06:29:47 +02:00
rustc_fluent_macro use tracked_path in rustc_fluent_macro 2024-10-19 22:32:38 +08:00
rustc_fs_util
rustc_graphviz
rustc_hir Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
rustc_hir_analysis Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors 2024-10-26 06:29:48 +02:00
rustc_hir_pretty Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
rustc_hir_typeck tcx.is_const_fn doesn't work the way it is described, remove it 2024-10-25 20:52:39 +02:00
rustc_incremental nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
rustc_index Rollup merge of #130625 - heiseish:issue-124028-fix, r=jieyouxu 2024-10-10 12:49:18 +02:00
rustc_index_macros Remove 'apostrophes' from rustc_parse_format 2024-10-14 23:22:51 +02:00
rustc_infer Implement const effect predicate in new solver 2024-10-24 09:46:36 +00:00
rustc_interface rust_for_linux: -Zregparm=<N> commandline flag for X86 (#116972) 2024-10-18 00:29:31 +07:00
rustc_lexer Reserve guarded string literals (RFC 3593) 2024-10-08 18:21:16 -06:00
rustc_lint Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead 2024-10-26 06:29:47 +02:00
rustc_lint_defs Revert "Emit error when calling/declaring functions with unavailable vectors." 2024-10-25 20:42:09 +00:00
rustc_llvm coverage: Emit MC/DC intrinsics using the normal helper method 2024-10-25 14:01:36 +11:00
rustc_log
rustc_macros
rustc_metadata tcx.is_const_fn doesn't work the way it is described, remove it 2024-10-25 20:52:39 +02:00
rustc_middle Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors 2024-10-26 06:29:48 +02:00
rustc_mir_build Rollup merge of #129248 - compiler-errors:raw-ref-deref, r=nnethercote 2024-10-24 10:35:39 +02:00
rustc_mir_dataflow "innermost", "outermost", "leftmost", and "rightmost" don't need hyphens 2024-10-23 02:45:24 -07:00
rustc_mir_transform Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors 2024-10-26 06:29:48 +02:00
rustc_monomorphize Auto merge of #132171 - matthiaskrgr:rollup-tp75ge7, r=matthiaskrgr 2024-10-26 06:53:53 +00:00
rustc_next_trait_solver Add support for ~const item bounds 2024-10-24 23:43:31 +00:00
rustc_parse "innermost", "outermost", "leftmost", and "rightmost" don't need hyphens 2024-10-23 02:45:24 -07:00
rustc_parse_format Remove 'apostrophes' from rustc_parse_format 2024-10-14 23:22:51 +02:00
rustc_passes Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead 2024-10-26 06:29:47 +02:00
rustc_pattern_analysis nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
rustc_privacy Implement const effect predicate in new solver 2024-10-24 09:46:36 +00:00
rustc_query_impl Handle rustc_query_impl cases of rustc::potential_query_instability lint 2024-10-03 12:47:08 +03:00
rustc_query_system Introduce Enabled{Lang,Lib}Feature 2024-10-25 10:30:37 +08:00
rustc_resolve Pass Ident by reference in ast Visitor 2024-10-24 11:10:49 -03:00
rustc_sanitizers Rollup merge of #131049 - compiler-errors:more-validation, r=spastorino 2024-10-22 15:28:38 +02:00
rustc_serialize Fix explicit_iter_loop in rustc_serialize 2024-10-16 15:44:16 +02:00
rustc_session Limited -Zregparm support (no Rust calling conv) descriptions 2024-10-20 18:18:01 +07:00
rustc_smir Effects cleanup 2024-10-26 10:19:07 +08:00
rustc_span Re-do recursive const stability checks 2024-10-25 20:31:40 +02:00
rustc_symbol_mangling Effects cleanup 2024-10-26 10:19:07 +08:00
rustc_target Revert "Emit error when calling/declaring functions with unavailable vectors." 2024-10-25 20:42:09 +00:00
rustc_trait_selection tcx.is_const_fn doesn't work the way it is described, remove it 2024-10-25 20:52:39 +02:00
rustc_traits Implement const effect predicate in new solver 2024-10-24 09:46:36 +00:00
rustc_transmute Fix transmute goal 2024-10-19 18:07:35 +00:00
rustc_ty_utils Be better at enforcing that const_conditions is only called on const items 2024-10-24 09:46:36 +00:00
rustc_type_ir Implement const effect predicate in new solver 2024-10-24 09:46:36 +00:00
rustc_type_ir_macros do not relate Abi and Safety 2024-10-22 23:13:04 +02:00
stable_mir Rollup merge of #132085 - celinval:update-smir-doc, r=compiler-errors 2024-10-24 23:23:55 -07:00