diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-10-04 08:59:20 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-10-04 08:59:20 +0000 |
| commit | c72c6e01c8020c7a285b76a9b61934e3501b80f3 (patch) | |
| tree | 01541dd2c18f1f923a430c9511de92da304c5abd /compiler/rustc_passes/src/check_const.rs | |
| parent | 33bcea8f614f5019012f16b49dc3cd934326ca87 (diff) | |
| download | rust-c72c6e01c8020c7a285b76a9b61934e3501b80f3.tar.gz rust-c72c6e01c8020c7a285b76a9b61934e3501b80f3.zip | |
Merge the `~const` and `impl const` checks and add some explanatory notes
Diffstat (limited to 'compiler/rustc_passes/src/check_const.rs')
| -rw-r--r-- | compiler/rustc_passes/src/check_const.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 116aaf48349..e502b9b54e3 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -191,32 +191,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { self.tcx.hir() } - fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { - let tcx = self.tcx; - if let hir::ItemKind::Impl(hir::Impl { - constness: hir::Constness::Const, - of_trait: Some(trait_ref), - .. - }) = item.kind - && let Some(def_id) = trait_ref.trait_def_id() - { - let source_map = tcx.sess.source_map(); - if !tcx.has_attr(def_id, sym::const_trait) { - tcx.sess - .struct_span_err( - source_map.guess_head_span(item.span), - "const `impl`s must be for traits marked with `#[const_trait]`", - ) - .span_note( - source_map.guess_head_span(tcx.def_span(def_id)), - "this trait must be annotated with `#[const_trait]`", - ) - .emit(); - } - } - intravisit::walk_item(self, item); - } - fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) { let kind = Some(hir::ConstContext::Const); self.recurse_into(kind, None, |this| intravisit::walk_anon_const(this, anon)); |
