Skip to content

Commit 7da9a5e

Browse files
committed
Auto merge of #45589 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests - Successful merges: #45421, #45449, #45505, #45535, #45549, #45574, #45585 - Failed merges:
2 parents 75277c7 + 0b02377 commit 7da9a5e

File tree

8 files changed

+54
-42
lines changed

8 files changed

+54
-42
lines changed

src/Cargo.lock

+1-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/flags.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
136136
let subcommand = match subcommand {
137137
Some(s) => s,
138138
None => {
139-
// No subcommand -- show the general usage and subcommand help
139+
// No or an invalid subcommand -- show the general usage and subcommand help
140+
// An exit code will be 0 when no subcommand is given, and 1 in case of an invalid
141+
// subcommand.
140142
println!("{}\n", subcommand_help);
141-
process::exit(1);
143+
let exit_code = if args.is_empty() { 0 } else { 1 };
144+
process::exit(exit_code);
142145
}
143146
};
144147

src/doc/unstable-book/src/language-features/on-unimplemented.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ For example:
1515
```rust,compile_fail
1616
#![feature(on_unimplemented)]
1717
18-
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an \
19-
iterator over elements of type `{A}`"]
18+
#[rustc_on_unimplemented="an iterator over elements of type `{A}` \
19+
cannot be built from a collection of type `{Self}`"]
2020
trait MyIterator<A> {
2121
fn next(&mut self) -> A;
2222
}
@@ -37,9 +37,9 @@ error[E0277]: the trait bound `&[{integer}]: MyIterator<char>` is not satisfied
3737
--> <anon>:14:5
3838
|
3939
14 | iterate_chars(&[1, 2, 3][..]);
40-
| ^^^^^^^^^^^^^ the trait `MyIterator<char>` is not implemented for `&[{integer}]`
40+
| ^^^^^^^^^^^^^ an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
4141
|
42-
= note: a collection of type `&[{integer}]` cannot be built from an iterator over elements of type `char`
42+
= help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
4343
= note: required by `iterate_chars`
4444
4545
error: aborting due to previous error

src/librustc/diagnostics.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,6 @@ fn bar(x: &str, y: &str) -> &str { }
401401
fn baz<'a>(x: &'a str, y: &str) -> &str { }
402402
```
403403
404-
Here's an example that is currently an error, but may work in a future version
405-
of Rust:
406-
407-
```compile_fail,E0106
408-
struct Foo<'a>(&'a str);
409-
410-
trait Quux { }
411-
impl Quux for Foo { }
412-
```
413-
414404
Lifetime elision in implementation headers was part of the lifetime elision
415405
RFC. It is, however, [currently unimplemented][iss15872].
416406
@@ -1875,7 +1865,7 @@ fn main() {
18751865
"##,
18761866

18771867
E0601: r##"
1878-
No `main` function was found in a binary crate. To fix this error, just add a
1868+
No `main` function was found in a binary crate. To fix this error, add a
18791869
`main` function. For example:
18801870
18811871
```

src/librustc/session/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,12 @@ pub fn build_session_(sopts: config::Options,
776776
let print_fuel_crate = sopts.debugging_opts.print_fuel.clone();
777777
let print_fuel = Cell::new(0);
778778

779-
let working_dir = env::current_dir().unwrap().to_string_lossy().into_owned();
779+
let working_dir = match env::current_dir() {
780+
Ok(dir) => dir.to_string_lossy().into_owned(),
781+
Err(e) => {
782+
panic!(p_s.span_diagnostic.fatal(&format!("Current directory is invalid: {}", e)))
783+
}
784+
};
780785
let working_dir = file_path_mapping.map_prefix(working_dir);
781786

782787
let sess = Session {

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ doctest = false
1313
[dependencies]
1414
env_logger = { version = "0.4", default-features = false }
1515
log = "0.3"
16-
pulldown-cmark = { version = "0.0.14", default-features = false }
16+
pulldown-cmark = { version = "0.1.0", default-features = false }
1717
html-diff = "0.0.4"
1818

1919
[build-dependencies]

src/librustdoc/html/markdown.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
371371
match self.inner.next() {
372372
Some(Event::FootnoteReference(ref reference)) => {
373373
let entry = self.get_entry(&reference);
374-
let reference = format!("<sup id=\"supref{0}\"><a href=\"#ref{0}\">{0}\
374+
let reference = format!("<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{0}\
375375
</a></sup>",
376376
(*entry).1);
377377
return Some(Event::Html(reference.into()));
@@ -394,15 +394,15 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
394394
v.sort_by(|a, b| a.1.cmp(&b.1));
395395
let mut ret = String::from("<div class=\"footnotes\"><hr><ol>");
396396
for (mut content, id) in v {
397-
write!(ret, "<li id=\"ref{}\">", id).unwrap();
397+
write!(ret, "<li id=\"fn{}\">", id).unwrap();
398398
let mut is_paragraph = false;
399399
if let Some(&Event::End(Tag::Paragraph)) = content.last() {
400400
content.pop();
401401
is_paragraph = true;
402402
}
403403
html::push_html(&mut ret, content.into_iter());
404404
write!(ret,
405-
"&nbsp;<a href=\"#supref{}\" rev=\"footnote\">↩</a>",
405+
"&nbsp;<a href=\"#fnref{}\" rev=\"footnote\">↩</a>",
406406
id).unwrap();
407407
if is_paragraph {
408408
ret.push_str("</p>");

src/libstd/net/udp.rs

+33-4
Original file line numberDiff line numberDiff line change
@@ -721,16 +721,45 @@ impl UdpSocket {
721721

722722
/// Moves this UDP socket into or out of nonblocking mode.
723723
///
724-
/// On Unix this corresponds to calling fcntl, and on Windows this
725-
/// corresponds to calling ioctlsocket.
724+
/// This will result in `recv`, `recv_from`, `send`, and `send_to`
725+
/// operations becoming nonblocking, i.e. immediately returning from their
726+
/// calls. If the IO operation is successful, `Ok` is returned and no
727+
/// further action is required. If the IO operation could not be completed
728+
/// and needs to be retried, an error with kind
729+
/// [`io::ErrorKind::WouldBlock`] is returned.
730+
///
731+
/// On Unix platforms, calling this method corresponds to calling `fcntl`
732+
/// `FIONBIO`. On Windows calling this method corresponds to calling
733+
/// `ioctlsocket` `FIONBIO`.
734+
///
735+
/// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock
726736
///
727737
/// # Examples
728738
///
739+
/// Create a UDP socket bound to `127.0.0.1:7878` and read bytes in
740+
/// nonblocking mode:
741+
///
729742
/// ```no_run
743+
/// use std::io;
730744
/// use std::net::UdpSocket;
731745
///
732-
/// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
733-
/// socket.set_nonblocking(true).expect("set_nonblocking call failed");
746+
/// let socket = UdpSocket::bind("127.0.0.1:7878").unwrap();
747+
/// socket.set_nonblocking(true).unwrap();
748+
///
749+
/// # fn wait_for_fd() { unimplemented!() }
750+
/// let mut buf = [0; 10];
751+
/// let (num_bytes_read, _) = loop {
752+
/// match socket.recv_from(&mut buf) {
753+
/// Ok(n) => break n,
754+
/// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
755+
/// // wait until network socket is ready, typically implemented
756+
/// // via platform-specific APIs such as epoll or IOCP
757+
/// wait_for_fd();
758+
/// }
759+
/// Err(e) => panic!("encountered IO error: {}", e),
760+
/// }
761+
/// };
762+
/// println!("bytes: {:?}", &buf[..num_bytes_read]);
734763
/// ```
735764
#[stable(feature = "net2_mutators", since = "1.9.0")]
736765
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {

0 commit comments

Comments
 (0)