File tree Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -2542,14 +2542,21 @@ fn clean_generic_args<'tcx>(
25422542 let args = generic_args
25432543 . args
25442544 . iter ( )
2545- . map ( |arg| match arg {
2546- hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
2547- GenericArg :: Lifetime ( clean_lifetime ( * lt, cx) )
2548- }
2549- hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2550- hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty, cx) ) ,
2551- hir:: GenericArg :: Const ( ct) => GenericArg :: Const ( Box :: new ( clean_const ( ct, cx) ) ) ,
2552- hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2545+ . filter_map ( |arg| {
2546+ Some ( match arg {
2547+ hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
2548+ GenericArg :: Lifetime ( clean_lifetime ( * lt, cx) )
2549+ }
2550+ hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2551+ hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty, cx) ) ,
2552+ hir:: GenericArg :: Const ( ct)
2553+ if cx. tcx . has_attr ( ct. value . def_id , sym:: rustc_host) =>
2554+ {
2555+ return None ;
2556+ }
2557+ hir:: GenericArg :: Const ( ct) => GenericArg :: Const ( Box :: new ( clean_const ( ct, cx) ) ) ,
2558+ hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2559+ } )
25532560 } )
25542561 . collect :: < Vec < _ > > ( )
25552562 . into ( ) ;
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ pub(crate) fn ty_args_to_args<'tcx>(
104104 arg : index,
105105 } ) ,
106106 ) ) ) ,
107+ GenericArgKind :: Const ( ct) if let ty:: ConstKind :: Param ( p) = ct. kind ( ) && p. name == sym:: host => None ,
107108 GenericArgKind :: Const ( ct) => {
108109 Some ( GenericArg :: Const ( Box :: new ( clean_middle_const ( kind. rebind ( ct) , cx) ) ) )
109110 }
Original file line number Diff line number Diff line change 66#![ feature( array_methods) ]
77#![ feature( assert_matches) ]
88#![ feature( box_patterns) ]
9+ #![ feature( if_let_guard) ]
910#![ feature( impl_trait_in_assoc_type) ]
1011#![ feature( iter_intersperse) ]
1112#![ feature( lazy_cell) ]
Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ pub trait Tr {
77}
88
99// @has foo/fn.g.html
10- // @has - '//pre[@class="rust item-decl"]' 'pub const fn g<T: Tr<host> >()'
10+ // @has - '//pre[@class="rust item-decl"]' 'pub const fn g<T: Tr>()'
1111/// foo
1212pub const fn g < T : ~const Tr > ( ) { }
You can’t perform that action at this time.
0 commit comments