summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2017-08-17doc tests: use the filename from the source file for doc test programs, ↵Nick Cameron-4/+4
rather than a dummy name
2017-07-09Add spacing between trait functionsGuillaume Gomez-2/+14
2017-07-05Auto merge of #40939 - jseyfried:proc_macro_api, r=nrcbors-1/+1
proc_macro: implement `TokenTree`, `TokenKind`, hygienic `quote!`, and other API All new API is gated behind `#![feature(proc_macro)]` and may be used with `#[proc_macro]`, `#[proc_macro_attribute]`, and `#[proc_macro_derive]` procedural macros. More specifically, this PR adds the following in `proc_macro`: ```rust // `TokenStream` constructors: impl TokenStream { fn empty() -> TokenStream { ... } } impl From<TokenTree> for TokenStream { ... } impl From<TokenKind> for TokenStream { ... } impl<T: Into<TokenStream>> FromIterator<T> for TokenStream { ... } macro quote($($t:tt)*) { ... } // A hygienic `TokenStream` quoter // `TokenStream` destructuring: impl TokenStream { fn is_empty(&self) -> bool { ... } } impl IntoIterator for TokenStream { type Item = TokenTree; ... } struct TokenTree { span: Span, kind: TokenKind } impl From<TokenKind> for TokenTree { ... } impl Display for TokenTree { ... } struct Span { ... } // a region of source code along with expansion/hygiene information impl Default for Span { ... } // a span from the current procedural macro definition impl Span { fn call_site() -> Span { ... } } // the call site of the current expansion fn quote_span(span: Span) -> TokenStream; enum TokenKind { Group(Delimiter, TokenStream), // A delimited sequence, e.g. `( ... )` Term(Term), // a unicode identifier, lifetime ('a), or underscore Op(char, Spacing), // a punctuation character (`+`, `,`, `$`, etc.). Literal(Literal), // a literal character (`'a'`), string (`"hello"`), or number (`2.3`) } enum Delimiter { Parenthesis, // `( ... )` Brace, // `[ ... ]` Bracket, // `{ ... }` None, // an implicit delimiter, e.g. `$var`, where $var is `...`. } struct Term { ... } // An interned string impl Term { fn intern(string: &str) -> Symbol { ... } fn as_str(&self) -> &str { ... } } enum Spacing { Alone, // not immediately followed by another `Op`, e.g. `+` in `+ =`. Joint, // immediately followed by another `Op`, e.g. `+` in `+=` } struct Literal { ... } impl Display for Literal { ... } impl Literal { fn integer(n: i128) -> Literal { .. } // unsuffixed integer literal fn float(n: f64) -> Literal { .. } // unsuffixed floating point literal fn u8(n: u8) -> Literal { ... } // similarly: i8, u16, i16, u32, i32, u64, i64, f32, f64 fn string(string: &str) -> Literal { ... } fn character(ch: char) -> Literal { ... } fn byte_string(bytes: &[u8]) -> Literal { ... } } ``` For details on `quote!` hygiene, see [this example](https://github.com/rust-lang/rust/pull/40939/commits/20a90485c040df87a667e9b6ee38e4d8a7d7fc5d) and [declarative macros 2.0](https://github.com/rust-lang/rust/pull/40847). r? @nrc
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-20/+33
2017-07-05Auto merge of #42972 - GuillaumeGomez:fix-toggles-rustdoc, r=QuietMisdreavusbors-21/+28
Toggle wrappers are now generated correctly Fixes #42674.
2017-06-29Toggle wrappers are now generated correctlyGuillaume Gomez-21/+28
2017-06-29Change some terminology around keywords and reserved identifierspetrochenkov-1/+1
2017-06-29Rollup merge of #42219 - pwoolcoc:add-allow-fail-to-libtest, r=GuillaumeGomezAriel Ben-Yehuda-18/+27
add `allow_fail` test attribute This change allows the user to add an `#[allow_fail]` attribute to tests that will cause the test to compile & run, but if the test fails it will not cause the entire test run to fail. The test output will show the failure, but in yellow instead of red, and also indicate that it was an allowed failure. Here is an example of the output: http://imgur.com/a/wt7ga
2017-06-26Auto merge of #42885 - ollie27:rustdoc_empty_glob_path, r=GuillaumeGomezbors-1/+5
rustdoc: Don't ICE on `use *;` Fixes #42875
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-1/+1
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-24rustdoc: Don't ICE on `use *;`Oliver Middleton-1/+5
2017-06-24Shorten some lines so this can pass the tidy checksPaul Woolcock-15/+19
2017-06-24add `allow_fail` test attributePaul Woolcock-18/+23
This change allows the user to add an `#[allow_fail]` attribute to tests that will cause the test to compile & run, but if the test fails it will not cause the entire test run to fail. The test output will show the failure, but in yellow instead of red, and also indicate that it was an allowed failure.
2017-06-23rustdoc: Fix a few issues with associated constsOliver Middleton-40/+26
* Make sure private consts are stripped. * Don't show a code block for the value if there is none. * Make sure default values are shown in impls. * Make sure docs from the trait are used if the impl has no docs.
2017-06-23Removed as many "```ignore" as possible.kennytm-1/+1
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-12Rollup merge of #42594 - ollie27:rustdoc_assoc_type_links, r=steveklabnikCorey Farwell-23/+19
rustdoc: Link directly to associated types Rather than just linking to the trait. Also simplifies the logic used to decide whether to render the full QPath.
2017-06-12Rollup merge of #42592 - ollie27:rustdoc_empty_modules, r=steveklabnikCorey Farwell-15/+4
rustdoc: Stop stripping empty modules There is no good reason to strip empty modules with no documentation and doing so causes subtle problems. Fixes #42590
2017-06-12Auto merge of #42572 - ollie27:rustdoc_create_dir_all, r=GuillaumeGomezbors-20/+5
rustdoc: Use `create_dir_all` to create output directory Currently rustdoc will fail if passed `-o foo/doc` if the `foo` directory doesn't exist. Also remove unneeded `mkdir` as `create_dir_all` can now handle concurrent invocations since #39799.
2017-06-11rustdoc: Stop stripping empty modulesOliver Middleton-15/+4
There is no good reason to strip empty modules with no documentation and doing so causes subtle problems.
2017-06-11rustdoc: Link directly to associated typesOliver Middleton-23/+19
Rather than just linking to the trait. Also simplifies the logic used to decide whether to render the full QPath.
2017-06-09Rollup merge of #42307 - clarcharr:js-license, r=frewsxcvCorey Farwell-9/+11
Make rustdoc.js use license comments. This will ensure that JS minifiers and the like will preserve the license statement even after minimisation.
2017-06-09rustdoc: Use `create_dir_all` to create output directoryOliver Middleton-20/+5
Currently rustdoc will fail if passed `-o foo/doc` if the `foo` directory doesn't exist. Also remove unneeded `mkdir` as `create_dir_all` can now handle concurrent invocations.
2017-06-09Document direct implementations on type aliases.Michael Killough-2/+20
This improves #32077, but is not a complete fix. For a type alias `type NewType = AliasedType`, it will include any `impl NewType` and `impl Trait for NewType` blocks in the documentation for `NewType`. A complete fix would include the implementations from the aliased type in the type alias' documentation, so that users have a complete picture of methods that are available on the alias. However, to do this properly would require a fix for #14072, as the alias may affect the type parameters of the type alias, making the documentation difficult to understand. (That is, for `type Result = std::result::Result<(), ()>` we would ideally show documentation for `impl Result<(), ()>`, rather than generic documentation for `impl<T, E> Result<T, E>`). I think this improvement is worthwhile, as it exposes implementations which are not currently documented by rustdoc. The documentation for the implementations on the aliased type are still accessible by clicking through to the docs for that type. (Although perhaps it's now less obvious to the user that they should click-through to get there).
2017-06-07Make rustdoc.js use license comments.Clar Charr-9/+11
2017-06-06Auto merge of #42394 - ollie27:rustdoc_deref_box, r=QuietMisdreavusbors-7/+12
rustdoc: Hide `self: Box<Self>` in list of deref methods These methods can never be called through deref so there is no point including them. For example you can't call [`into_boxed_bytes`](https://doc.rust-lang.org/nightly/std/string/struct.String.html#method.into_boxed_bytes) or [`into_string`](https://doc.rust-lang.org/nightly/std/string/struct.String.html#method.into_string) on `String`.
2017-06-02rustdoc: Hide `self: Box<Self>` in list of deref methodsOliver Middleton-7/+12
These methods can never be called through deref so there is no point including them. For example you can't call `into_boxed_bytes` or `into_string` on `String`.
2017-06-01rustdoc: Rename `Vector` and `FixedVector` to `Slice` and `Array`Oliver Middleton-11/+4
Also store the array length as a usize rather than a String. This is just a minor refactor.
2017-05-31rustdoc: Cleanup associated const value renderingOliver Middleton-155/+55
Rather than (ab)using Debug for outputting the type in plain text use the alternate format parameter which already does exactly that. This fixes type parameters for example which would output raw HTML. Also cleans up adding parens around references to trait objects.
2017-05-30Fix signature by adding parens when neededGuillaume Gomez-14/+23
2017-05-21Update to trait bounds CSS in rustdocDaniel Lockyer-0/+2
Fixed resubmission of #40719.
2017-05-19Rollup merge of #42096 - ollie27:rustdoc_js_impls, r=GuillaumeGomezMark Simulacrum-3/+3
rustdoc: Fix implementors list javascript * Use a different loop variable, `i` was already taken. This caused missing items in the implementors list. * Use `.getAttribute('href')` rather than `.href` to get the relative URL which is what it needs to actually fix the links. More fallout from #41307. r? @GuillaumeGomez
2017-05-19rustdoc: Fix implementors list javascriptOliver Middleton-3/+3
* Use a different loop variable, `i` was already taken. This caused missing items in the implementors list. * Use `.getAttribute('href')` rather than `.href` to get the relative URL which is what it needs to actually fix the links.
2017-05-18Make documentation works again by removing two unnecessary ES6 pieces.pravic-3/+3
2017-05-16Rollup merge of #42011 - rap2hpoutre:patch-5, r=GuillaumeGomezMark Simulacrum-0/+5
improve collapse toggle render (css) The `[-]` toggle for functions in docs _seems_ too big. It's just an impression, but it's something I noticed long time ago (maybe I have bad taste). I never thought to fix it, but, today I think: "Ok, why not suggest it.". Feel free to close without explanation! Preview changes below: From this: <img width="1003" alt="capture d ecran 2017-05-15 a 17 14 45" src="https://cloud.githubusercontent.com/assets/1575946/26064816/5c84de86-3992-11e7-976b-41c625cace0f.png"> To this: <img width="996" alt="capture d ecran 2017-05-15 a 17 15 02" src="https://cloud.githubusercontent.com/assets/1575946/26064854/78325dac-3992-11e7-88f6-2c43db43421c.png">
2017-05-16improve collapse toggle render (css)Raphaël Huchet-0/+5
2017-05-15rustdoc: Display `extern "C" fn` instead of `extern fn`Oliver Middleton-1/+0
2017-05-13Rollup merge of #41950 - GuillaumeGomez:rustdoc-links, r=frewsxcvMark Simulacrum-4/+8
Fix anchor invalid redirection to search Fixes #41933. r? @rust-lang/docs
2017-05-12Rollup merge of #41951 - Eijebong:master, r=GuillaumeGomezMark Simulacrum-0/+1
rustdoc: Break words in the location box of the sidebar. This prevents long names from overflowing. Before: ![before](https://img.bananium.fr/eijebong/afcfe18b-393e-4d3b-bc11-fe3def6659b9.png) After: ![after](https://img.bananium.fr/eijebong/9483466b-3b6c-4509-ab0f-fd0c6572ef27.png)
2017-05-12Fix anchor invalid redirection to searchGuillaume Gomez-4/+8
2017-05-12rustdoc: Break words in the location box of the sidebar.Bastien Orivel-0/+1
This prevents long names from overflowing.
2017-05-11Fix search when looking to sourcesGuillaume Gomez-0/+3
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-2/+2
2017-05-07Auto merge of #41785 - Mark-Simulacrum:issue-41783, r=GuillaumeGomezbors-27/+48
Allow # to appear in rustdoc code output. "##" at the start of a trimmed rustdoc line is now cut to "#" and then shown. If the user wanted to show "##", they can type "###". I'm somewhat concerned about the potential implications for users, since this does make a potentially backwards-incompatible change. Previously, `##` had no special handling, and now we do change it. However, I'm not really sure what we can do here to improve this, and I can't think of any cases where `##` would likely be correct in a code block, though of course I could be wrong. Fixes #41783.
2017-05-06Allow # to appear in rustdoc code output.Mark Simulacrum-27/+48
"##" at the start of a trimmed rustdoc line is now cut to "#" and then shown. If the user wanted to show "##", they can type "###".
2017-05-05Rollup merge of #41307 - GuillaumeGomez:jquery-removal, r=frewsxcvCorey Farwell-245/+456
Remove jquery dependency r? @rust-lang/docs Fixes #39159.
2017-05-02Remove jquery dependencyGuillaume Gomez-245/+456
2017-05-02Address reviewest31-1/+1
2017-05-02Removal pass for anonymous parametersest31-2/+6
Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685.
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-5/+5
reproducible builds.
2017-04-22Fix line displayGuillaume Gomez-8/+4