@@ -47,7 +47,7 @@ use rustc_middle::{bug, span_bug};
4747use  rustc_session:: lint:: builtin:: AMBIGUOUS_ASSOCIATED_ITEMS ; 
4848use  rustc_span:: edit_distance:: find_best_match_for_name; 
4949use  rustc_span:: symbol:: { kw,  Ident ,  Symbol } ; 
50- use  rustc_span:: { sym ,   Span ,  DUMMY_SP } ; 
50+ use  rustc_span:: { Span ,  DUMMY_SP } ; 
5151use  rustc_target:: spec:: abi; 
5252use  rustc_trait_selection:: infer:: InferCtxtExt ; 
5353use  rustc_trait_selection:: traits:: wf:: object_region_bounds; 
@@ -560,7 +560,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
560560        } 
561561        if  let  ty:: BoundConstness :: Const  | ty:: BoundConstness :: ConstIfConst  = constness
562562            && generics. has_self 
563-             && !tcx. has_attr ( def_id,  sym :: const_trait ) 
563+             && !tcx. is_const_trait ( def_id) 
564564        { 
565565            let  reported = tcx. dcx ( ) . emit_err ( crate :: errors:: ConstBoundForNonConstTrait  { 
566566                span, 
@@ -1848,19 +1848,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
18481848                    path. segments [ ..path. segments . len ( )  - 2 ] . iter ( ) , 
18491849                    GenericsArgsErrExtend :: None , 
18501850                ) ; 
1851-                 // HACK: until we support `<Type as ~const Trait>`, assume all of them are. 
1852-                 let  constness = if  tcx. has_attr ( tcx. parent ( def_id) ,  sym:: const_trait)  { 
1853-                     ty:: BoundConstness :: ConstIfConst 
1854-                 }  else  { 
1855-                     ty:: BoundConstness :: NotConst 
1856-                 } ; 
18571851                self . lower_qpath ( 
18581852                    span, 
18591853                    opt_self_ty, 
18601854                    def_id, 
18611855                    & path. segments [ path. segments . len ( )  - 2 ] , 
18621856                    path. segments . last ( ) . unwrap ( ) , 
1863-                     constness , 
1857+                     ty :: BoundConstness :: NotConst , 
18641858                ) 
18651859            } 
18661860            Res :: PrimTy ( prim_ty)  => { 
0 commit comments