diff options
| author | Michael Goulet <michael@errs.io> | 2024-06-14 14:46:32 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-06-14 16:54:29 -0400 |
| commit | 93ff86ed7c38b68644964d80155cff5e04bd5f42 (patch) | |
| tree | 62291a4907bd3ea5a4d9705f27cb62cd44379a91 /compiler/rustc_hir_analysis/src/coherence/mod.rs | |
| parent | d5c48ebc71280cb523b23f9be25ef8a66916e75d (diff) | |
| download | rust-93ff86ed7c38b68644964d80155cff5e04bd5f42.tar.gz rust-93ff86ed7c38b68644964d80155cff5e04bd5f42.zip | |
Use is_lang_item more aggressively
Diffstat (limited to 'compiler/rustc_hir_analysis/src/coherence/mod.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/coherence/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/mod.rs b/compiler/rustc_hir_analysis/src/coherence/mod.rs index eae41d28e89..e9961d3ad08 100644 --- a/compiler/rustc_hir_analysis/src/coherence/mod.rs +++ b/compiler/rustc_hir_analysis/src/coherence/mod.rs @@ -8,6 +8,7 @@ use crate::errors; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir::def_id::{DefId, LocalDefId}; +use rustc_hir::LangItem; use rustc_middle::query::Providers; use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt}; use rustc_session::parse::feature_err; @@ -49,7 +50,7 @@ fn enforce_trait_manually_implementable( ) -> Result<(), ErrorGuaranteed> { let impl_header_span = tcx.def_span(impl_def_id); - if tcx.lang_items().freeze_trait() == Some(trait_def_id) { + if tcx.is_lang_item(trait_def_id, LangItem::Freeze) { if !tcx.features().freeze_impls { feature_err( &tcx.sess, @@ -75,7 +76,7 @@ fn enforce_trait_manually_implementable( // Maintain explicit error code for `Unsize`, since it has a useful // explanation about using `CoerceUnsized` instead. - if Some(trait_def_id) == tcx.lang_items().unsize_trait() { + if tcx.is_lang_item(trait_def_id, LangItem::Unsize) { err.code(E0328); } |
