File tree 6 files changed +84
-2
lines changed
6 files changed +84
-2
lines changed Original file line number Diff line number Diff line change 465
465
var res = buildHrefAndPath ( obj ) ;
466
466
obj . displayPath = pathSplitter ( res [ 0 ] ) ;
467
467
obj . fullPath = obj . displayPath + obj . name ;
468
+ if ( obj . ty === TY_KEYWORD ) {
469
+ // To be sure than it isn't considered as duplicate with items.
470
+ obj . fullPath += '|k' ;
471
+ }
468
472
obj . href = res [ 1 ] ;
469
473
out . push ( obj ) ;
470
474
if ( out . length >= MAX_RESULTS ) {
781
785
case "fn" :
782
786
return ( name == "method" || name == "tymethod" ) ;
783
787
case "type" :
784
- return ( name == "primitive" ) ;
788
+ return ( name == "primitive" || name == "keyword" ) ;
785
789
}
786
790
787
791
// No match
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #[ doc( keyword = "fn" ) ]
12
+ //
13
+ /// The `fn` keyword.
14
+ ///
15
+ /// The `fn` keyword is used to declare a function.
16
+ ///
17
+ /// Example:
18
+ ///
19
+ /// ```rust
20
+ /// fn some_function() {
21
+ /// // code goes in here
22
+ /// }
23
+ /// ```
24
+ ///
25
+ /// For more information about functions, take a look at the [Rust Book][book].
26
+ ///
27
+ /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html
28
+ mod fn_keyword { }
Original file line number Diff line number Diff line change @@ -547,3 +547,8 @@ pub use stdsimd::arch;
547
547
// the rustdoc documentation for primitive types. Using `include!`
548
548
// because rustdoc only looks for these modules at the crate level.
549
549
include ! ( "primitive_docs.rs" ) ;
550
+
551
+ // Include a number of private modules that exist solely to provide
552
+ // the rustdoc documentation for the existing keywords. Using `include!`
553
+ // because rustdoc only looks for these modules at the crate level.
554
+ include ! ( "keyword_docs.rs" ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // ignore-order
12
+
13
+ const QUERY = 'fn' ;
14
+
15
+ const EXPECTED = {
16
+ 'others' : [
17
+ { 'path' : 'std' , 'name' : 'fn' , ty : 15 } , // 15 is for primitive types
18
+ { 'path' : 'std' , 'name' : 'fn' , ty : 21 } , // 21 is for keywords
19
+ ] ,
20
+ } ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // should-fail
12
+
13
+ const QUERY = 'fn' ;
14
+
15
+ const EXPECTED = {
16
+ 'others' : [
17
+ { 'path' : 'std' , 'name' : 'fn' , ty : 14 } ,
18
+ ] ,
19
+ } ;
Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ function loadContent(content) {
164
164
m . _compile ( content , "tmp.js" ) ;
165
165
m . exports . ignore_order = content . indexOf ( "\n// ignore-order\n" ) !== - 1 ;
166
166
m . exports . exact_check = content . indexOf ( "\n// exact-check\n" ) !== - 1 ;
167
+ m . exports . should_fail = content . indexOf ( "\n// should-fail\n" ) !== - 1 ;
167
168
return m . exports ;
168
169
}
169
170
@@ -259,6 +260,7 @@ function main(argv) {
259
260
const query = loadedFile . QUERY ;
260
261
const ignore_order = loadedFile . ignore_order ;
261
262
const exact_check = loadedFile . exact_check ;
263
+ const should_fail = loadedFile . should_fail ;
262
264
var results = loaded . execSearch ( loaded . getQuery ( query ) , index ) ;
263
265
process . stdout . write ( 'Checking "' + file + '" ... ' ) ;
264
266
var error_text = [ ] ;
@@ -289,7 +291,11 @@ function main(argv) {
289
291
}
290
292
}
291
293
}
292
- if ( error_text . length !== 0 ) {
294
+ if ( error_text . length === 0 && should_fail === true ) {
295
+ errors += 1 ;
296
+ console . error ( "FAILED" ) ;
297
+ console . error ( "==> Test was supposed to fail but all items were found..." ) ;
298
+ } else if ( error_text . length !== 0 && should_fail === false ) {
293
299
errors += 1 ;
294
300
console . error ( "FAILED" ) ;
295
301
console . error ( error_text . join ( "\n" ) ) ;
You can’t perform that action at this time.
0 commit comments