Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc examples for range::RangeArgument::{start,end}. #35041

Merged
merged 1 commit into from
Aug 5, 2016

Conversation

frewsxcv
Copy link
Member

No description provided.

@frewsxcv
Copy link
Member Author

r? @GuillaumeGomez

///
/// extern crate collections;
///
/// # fn main() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work without putting main function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extern crate and feature flags here shouldn't be within main, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't but it works and it is not (the generation is "clever" normally).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works because rustdoc knows what lines to extract and put them outside main?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info! Fixed in the latest force push.

@frewsxcv frewsxcv force-pushed the range-rangeargument branch 2 times, most recently from 0b50a50 to 195de83 Compare July 28, 2016 12:56
@GuillaumeGomez
Copy link
Member

---- range::RangeArgument::end_0 stdout ----
    <anon>:9:5: 9:38 error: unresolved import `collections::range::RangeArgument`. Did you mean `self::collections::range`? [E0432]
<anon>:9 use collections::range::RangeArgument;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:11:18: 11:21 error: no method named `end` found for type `std::ops::RangeFrom<_>` in the current scope 
<anon>:11 assert_eq!((3..).end(), None);
                           ^~~
<anon>:11:1: 11:31 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:11:18: 11:21 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it: 
<anon>:11:18: 11:21 help: candidate #1: `use main::collections::range::RangeArgument` 
<anon>:12:20: 12:23 error: no method named `end` found for type `std::ops::Range<_>` in the current scope 
<anon>:12 assert_eq!((3..10).end(), Some(&10));
                             ^~~
<anon>:12:1: 12:38 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:12:20: 12:23 note: did you mean to write `(3..10).end`? 
<anon>:12 assert_eq!((3..10).end(), Some(&10));
                             ^~~
<anon>:12:1: 12:38 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:12:20: 12:23 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it: 
<anon>:12:20: 12:23 help: candidate #1: `use main::collections::range::RangeArgument` 
error: aborting due to previous error(s) 
thread 'range::RangeArgument::end_0' panicked at 'Box<Any>', src/librustc/session/mod.rs:165
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- range::RangeArgument::start_0 stdout ----
    <anon>:9:5: 9:38 error: unresolved import `collections::range::RangeArgument`. Did you mean `self::collections::range`? [E0432]
<anon>:9 use collections::range::RangeArgument;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:11:19: 11:24 error: no method named `start` found for type `std::ops::RangeTo<_>` in the current scope 
<anon>:11 assert_eq!((..10).start(), None);
                            ^~~~~
<anon>:11:1: 11:34 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:11:19: 11:24 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it: 
<anon>:11:19: 11:24 help: candidate #1: `use main::collections::range::RangeArgument` 
<anon>:12:20: 12:25 error: no method named `start` found for type `std::ops::Range<_>` in the current scope 
<anon>:12 assert_eq!((3..10).start(), Some(&3));
                             ^~~~~
<anon>:12:1: 12:39 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:12:20: 12:25 note: did you mean to write `(3..10).start`? 
<anon>:12 assert_eq!((3..10).start(), Some(&3));
                             ^~~~~
<anon>:12:1: 12:39 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:12:20: 12:25 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it: 
<anon>:12:20: 12:25 help: candidate #1: `use main::collections::range::RangeArgument` 
error: aborting due to previous error(s) 
thread 'range::RangeArgument::start_0' panicked at 'Box<Any>', src/librustc/session/mod.rs:165

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 2, 2016

@GuillaumeGomez Check out the latest commit. It seems to fix the build. Have any idea why? I don't have too much time right now, so I might just squash the commits.

@GuillaumeGomez
Copy link
Member

No idea. Certainly because of the "extern crate". However, I'm a bit surprised there is an external import for collections.

@GuillaumeGomez
Copy link
Member

The situation of this trait is really strange, however it's used in std stable code so let's merge it. Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 2, 2016

📌 Commit 727d929 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Aug 2, 2016

⌛ Testing commit 727d929 with merge 1329da6...

@bors
Copy link
Contributor

bors commented Aug 2, 2016

💔 Test failed - auto-win-msvc-64-opt-no-mir

@alexcrichton
Copy link
Member

@bors: retry

On Tue, Aug 2, 2016 at 12:09 PM, bors [email protected] wrote:

💔 Test failed - auto-win-msvc-64-opt-no-mir
https://buildbot.rust-lang.org/builders/auto-win-msvc-64-opt-no-mir/builds/1


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#35041 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAD95NPckCnUsRSvkbZRjnLCpkXxtcCCks5qb5X-gaJpZM4JUwIq
.

sanxiyn added a commit to sanxiyn/rust that referenced this pull request Aug 3, 2016
…llaumeGomez

Add doc examples for `range::RangeArgument::{start,end}`.

None
bors added a commit that referenced this pull request Aug 3, 2016
Rollup of 7 pull requests

- Successful merges: #34319, #35041, #35042, #35175, #35181, #35182, #35189
- Failed merges:
bors added a commit that referenced this pull request Aug 3, 2016
Rollup of 7 pull requests

- Successful merges: #34319, #35041, #35042, #35175, #35181, #35182, #35189
- Failed merges:
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 4, 2016
…llaumeGomez

Add doc examples for `range::RangeArgument::{start,end}`.

None
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 4, 2016
…llaumeGomez

Add doc examples for `range::RangeArgument::{start,end}`.

None
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 5, 2016
…llaumeGomez

Add doc examples for `range::RangeArgument::{start,end}`.

None
bors added a commit that referenced this pull request Aug 5, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 5, 2016
…llaumeGomez

Add doc examples for `range::RangeArgument::{start,end}`.

None
bors added a commit that referenced this pull request Aug 5, 2016
@bors bors merged commit 727d929 into rust-lang:master Aug 5, 2016
@frewsxcv frewsxcv deleted the range-rangeargument branch October 2, 2016 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants