|
2 | 2 | //! The main routine here is `ast_ty_to_ty()`; each use is parameterized by an
|
3 | 3 | //! instance of `AstConv`.
|
4 | 4 |
|
5 |
| -use errors::{Applicability, FatalError, DiagnosticId}; |
| 5 | +use errors::{Applicability, DiagnosticId}; |
6 | 6 | use hir::{self, GenericArg, GenericArgs};
|
7 | 7 | use hir::def::Def;
|
8 | 8 | use hir::def_id::DefId;
|
@@ -689,35 +689,21 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
689 | 689 | {
|
690 | 690 | self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1);
|
691 | 691 |
|
692 |
| - let trait_def_id = self.trait_def_id(trait_ref); |
693 | 692 | self.ast_path_to_mono_trait_ref(trait_ref.path.span,
|
694 |
| - trait_def_id, |
| 693 | + trait_ref.trait_def_id(), |
695 | 694 | self_ty,
|
696 | 695 | trait_ref.path.segments.last().unwrap())
|
697 | 696 | }
|
698 | 697 |
|
699 |
| - /// Get the `DefId` of the given trait ref. It _must_ actually be a trait. |
700 |
| - fn trait_def_id(&self, trait_ref: &hir::TraitRef) -> DefId { |
701 |
| - let path = &trait_ref.path; |
702 |
| - match path.def { |
703 |
| - Def::Trait(trait_def_id) => trait_def_id, |
704 |
| - Def::TraitAlias(alias_def_id) => alias_def_id, |
705 |
| - Def::Err => { |
706 |
| - FatalError.raise(); |
707 |
| - } |
708 |
| - _ => unreachable!(), |
709 |
| - } |
710 |
| - } |
711 |
| - |
712 |
| - /// The given trait ref must actually be a trait. |
| 698 | + /// The given trait-ref must actually be a trait. |
713 | 699 | pub(super) fn instantiate_poly_trait_ref_inner(&self,
|
714 | 700 | trait_ref: &hir::TraitRef,
|
715 | 701 | self_ty: Ty<'tcx>,
|
716 | 702 | poly_projections: &mut Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>,
|
717 | 703 | speculative: bool)
|
718 | 704 | -> (ty::PolyTraitRef<'tcx>, Option<Vec<Span>>)
|
719 | 705 | {
|
720 |
| - let trait_def_id = self.trait_def_id(trait_ref); |
| 706 | + let trait_def_id = trait_ref.trait_def_id(); |
721 | 707 |
|
722 | 708 | debug!("instantiate_poly_trait_ref({:?}, def_id={:?})", trait_ref, trait_def_id);
|
723 | 709 |
|
|
0 commit comments