File tree 7 files changed +24
-26
lines changed
7 files changed +24
-26
lines changed Original file line number Diff line number Diff line change @@ -241,15 +241,11 @@ impl CheckAttrVisitor<'tcx> {
241
241
if let Some ( err) = match target {
242
242
Target :: Impl => Some ( "implementation block" ) ,
243
243
Target :: ForeignMod => Some ( "extern block" ) ,
244
- Target :: AssocConst | Target :: AssocTy => {
244
+ Target :: AssocTy => {
245
245
let parent_hir_id = self . tcx . hir ( ) . get_parent_item ( hir_id) ;
246
246
let containing_item = self . tcx . hir ( ) . expect_item ( parent_hir_id) ;
247
247
if Target :: from_item ( containing_item) == Target :: Impl {
248
- Some ( if target == Target :: AssocConst {
249
- "const in implementation block"
250
- } else {
251
- "type alias in implementation block"
252
- } )
248
+ Some ( "type alias in implementation block" )
253
249
} else {
254
250
None
255
251
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const QUERY = [
5
5
'StructFieldItem' ,
6
6
'StructMethodItem' ,
7
7
'ImplTraitItem' ,
8
- 'ImplAssociatedConstItem ' ,
8
+ 'StructImplConstItem ' ,
9
9
'ImplTraitFunction' ,
10
10
'EnumItem' ,
11
11
'VariantItem' ,
@@ -64,8 +64,16 @@ const EXPECTED = [
64
64
'others' : [ ] ,
65
65
} ,
66
66
{
67
- // ImplAssociatedConstItem
68
- 'others' : [ ] ,
67
+ // StructImplConstItem
68
+ 'others' : [
69
+ {
70
+ 'path' : 'doc_alias::Struct' ,
71
+ 'name' : 'ImplConstItem' ,
72
+ 'alias' : 'StructImplConstItem' ,
73
+ 'href' : '../doc_alias/struct.Struct.html#associatedconstant.ImplConstItem' ,
74
+ 'is_alias' : true
75
+ } ,
76
+ ] ,
69
77
} ,
70
78
{
71
79
'others' : [
@@ -197,6 +205,10 @@ const EXPECTED = [
197
205
'href' : '../doc_alias/constant.Const.html' ,
198
206
'is_alias' : true
199
207
} ,
208
+ {
209
+ 'path' : 'doc_alias::Struct' ,
210
+ 'name' : 'ImplConstItem' ,
211
+ } ,
200
212
] ,
201
213
} ,
202
214
{
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ pub struct Struct {
7
7
}
8
8
9
9
impl Struct {
10
+ #[ doc( alias = "StructImplConstItem" ) ]
11
+ pub const ImplConstItem : i32 = 0 ;
10
12
#[ doc( alias = "StructMethodItem" ) ]
11
13
pub fn method ( & self ) { }
12
14
}
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ extern {}
11
11
12
12
#[ doc( alias = "bar" ) ] //~ ERROR
13
13
impl Bar {
14
- #[ doc( alias = "const" ) ] //~ ERROR
15
- const A : u32 = 0 ;
14
+ #[ doc( alias = "const" ) ]
15
+ pub const A : u32 = 0 ;
16
16
}
17
17
18
18
#[ doc( alias = "foobar" ) ] //~ ERROR
Original file line number Diff line number Diff line change @@ -16,17 +16,11 @@ error: `#[doc(alias = "...")]` isn't allowed on implementation block
16
16
LL | #[doc(alias = "foobar")]
17
17
| ^^^^^^^^^^^^^^^^
18
18
19
- error: `#[doc(alias = "...")]` isn't allowed on const in implementation block
20
- --> $DIR/check-doc-alias-attr-location.rs:14:11
21
- |
22
- LL | #[doc(alias = "const")]
23
- | ^^^^^^^^^^^^^^^
24
-
25
19
error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation block
26
20
--> $DIR/check-doc-alias-attr-location.rs:20:11
27
21
|
28
22
LL | #[doc(alias = "assoc")]
29
23
| ^^^^^^^^^^^^^^^
30
24
31
- error: aborting due to 5 previous errors
25
+ error: aborting due to 4 previous errors
32
26
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ extern {}
12
12
13
13
#[ doc( alias = "bar" ) ] //~ ERROR
14
14
impl Bar {
15
- #[ doc( alias = "const" ) ] //~ ERROR
15
+ #[ doc( alias = "const" ) ]
16
16
const A : u32 = 0 ;
17
17
}
18
18
Original file line number Diff line number Diff line change @@ -16,17 +16,11 @@ error: `#[doc(alias = "...")]` isn't allowed on implementation block
16
16
LL | #[doc(alias = "foobar")]
17
17
| ^^^^^^^^^^^^^^^^
18
18
19
- error: `#[doc(alias = "...")]` isn't allowed on const in implementation block
20
- --> $DIR/check-doc-alias-attr-location.rs:15:11
21
- |
22
- LL | #[doc(alias = "const")]
23
- | ^^^^^^^^^^^^^^^
24
-
25
19
error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation block
26
20
--> $DIR/check-doc-alias-attr-location.rs:21:11
27
21
|
28
22
LL | #[doc(alias = "assoc")]
29
23
| ^^^^^^^^^^^^^^^
30
24
31
- error: aborting due to 5 previous errors
25
+ error: aborting due to 4 previous errors
32
26
You can’t perform that action at this time.
0 commit comments