Skip to content

Commit d706482

Browse files
Do not enforce ~const constness effects in typeck if rustc_do_mot_const_check
1 parent 298c746 commit d706482

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: compiler/rustc_hir_typeck/src/callee.rs

+5
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
851851
return;
852852
}
853853

854+
// If we have `rustc_do_not_const_check`, do not check `~const` bounds.
855+
if self.tcx.has_attr(self.body_id, sym::rustc_do_not_const_check) {
856+
return;
857+
}
858+
854859
let host = match self.tcx.hir().body_const_context(self.body_id) {
855860
Some(hir::ConstContext::Const { .. } | hir::ConstContext::Static(_)) => {
856861
ty::HostPolarity::Const

Diff for: tests/ui/traits/const-traits/do-not-const-check.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ check-pass
2-
#![feature(const_trait_impl, rustc_attrs)]
2+
#![feature(const_trait_impl, rustc_attrs, effects)]
3+
//~^ WARN the feature `effects` is incomplete
34

45
#[const_trait]
56
trait IntoIter {

0 commit comments

Comments
 (0)