diff options
| author | bors <bors@rust-lang.org> | 2023-08-08 19:23:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-08 19:23:41 +0000 |
| commit | f88a8b71cebb730cbd5058c45ebcae1d4d9be377 (patch) | |
| tree | cb6151402989f498dd13def70bbab6d54dc50878 /compiler/rustc_middle/src | |
| parent | f525bb4e2afac6d2491a86c178aa98e3f3931130 (diff) | |
| parent | 057be381c60bf9b5c26497a42ad51917c3027b65 (diff) | |
| download | rust-f88a8b71cebb730cbd5058c45ebcae1d4d9be377.tar.gz rust-f88a8b71cebb730cbd5058c45ebcae1d4d9be377.zip | |
Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obk
correctly lower `impl const` to bind to host effect param r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 6446f48bd1a..8ac1d02ce50 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2041,9 +2041,9 @@ impl<'tcx> TyCtxt<'tcx> { matches!( node, hir::Node::Item(hir::Item { - kind: hir::ItemKind::Impl(hir::Impl { constness: hir::Constness::Const, .. }), + kind: hir::ItemKind::Impl(hir::Impl { generics, .. }), .. - }) + }) if generics.params.iter().any(|p| self.has_attr(p.def_id, sym::rustc_host)) ) } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 27ade16739d..e5b4232431b 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2841,6 +2841,11 @@ define_print_and_forward_display! { ty::TraitPredicate<'tcx> { p!(print(self.trait_ref.self_ty()), ": "); + if let Some(idx) = cx.tcx().generics_of(self.trait_ref.def_id).host_effect_index { + if self.trait_ref.args.const_at(idx) != cx.tcx().consts.true_ { + p!("~const "); + } + } // FIXME(effects) print `~const` here if let ty::ImplPolarity::Negative = self.polarity { p!("!"); |
