Skip to content

Rollup of 8 pull requests #44156

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

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
None => {
// No subcommand -- show the general usage and subcommand help
println!("{}\n", subcommand_help);
process::exit(0);
process::exit(1);
}
};

Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ extern crate build_helper;
extern crate serde_derive;
#[macro_use]
extern crate lazy_static;
extern crate serde;
extern crate serde_json;
extern crate cmake;
extern crate filetime;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ tool!(
Linkchecker, "src/tools/linkchecker", "linkchecker", Mode::Libstd;
CargoTest, "src/tools/cargotest", "cargotest", Mode::Libstd;
Compiletest, "src/tools/compiletest", "compiletest", Mode::Libtest;
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Librustc;
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Libstd;
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::Libstd;
RustInstaller, "src/tools/rust-installer", "rust-installer", Mode::Libstd;
);
Expand Down
9 changes: 8 additions & 1 deletion src/librustc_lint/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
}

if !(ty_warned || fn_warned) {
cx.span_lint(UNUSED_RESULTS, s.span, "unused result");
match t.sty {
// Historically, booleans have not been considered unused
// results. (See Issue #44119.)
ty::TyBool => return,
_ => {
cx.span_lint(UNUSED_RESULTS, s.span, "unused result");
}
}
}

fn check_must_use(cx: &LateContext, def_id: DefId, sp: Span, describe_path: &str) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl<'a> fmt::Display for WhereClause<'a> {
}

if end_newline {
//add a space so stripping <br> tags and breaking spaces still renders properly
// add a space so stripping <br> tags and breaking spaces still renders properly
if f.alternate() {
clause.push(' ');
} else {
Expand Down
6 changes: 2 additions & 4 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1523,17 +1523,15 @@ impl<'a> fmt::Display for Item<'a> {
} else {
write!(fmt, "Module ")?;
},
clean::FunctionItem(..) | clean::ForeignFunctionItem(..) =>
write!(fmt, "Function ")?,
clean::FunctionItem(..) | clean::ForeignFunctionItem(..) => write!(fmt, "Function ")?,
clean::TraitItem(..) => write!(fmt, "Trait ")?,
clean::StructItem(..) => write!(fmt, "Struct ")?,
clean::UnionItem(..) => write!(fmt, "Union ")?,
clean::EnumItem(..) => write!(fmt, "Enum ")?,
clean::TypedefItem(..) => write!(fmt, "Type Definition ")?,
clean::MacroItem(..) => write!(fmt, "Macro ")?,
clean::PrimitiveItem(..) => write!(fmt, "Primitive Type ")?,
clean::StaticItem(..) | clean::ForeignStaticItem(..) =>
write!(fmt, "Static ")?,
clean::StaticItem(..) | clean::ForeignStaticItem(..) => write!(fmt, "Static ")?,
clean::ConstantItem(..) => write!(fmt, "Constant ")?,
_ => {
// We don't generate pages for any other type.
Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ h4 > code, h3 > code, .invisible > code {
display: inline-block;
}

.in-band > code {
display: inline-block;
}

#main { position: relative; }
#main > .since {
top: inherit;
Expand Down Expand Up @@ -447,7 +451,8 @@ a {
}

.in-band:hover > .anchor {
display: initial;
display: inline-block;
position: absolute;
}
.anchor {
display: none;
Expand Down
16 changes: 16 additions & 0 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ pub fn main_args(args: &[String]) -> isize {
// Check for unstable options.
nightly_options::check_nightly_options(&matches, &opts());

// check for deprecated options
check_deprecated_options(&matches);

if matches.opt_present("h") || matches.opt_present("help") {
usage("rustdoc");
return 0;
Expand Down Expand Up @@ -538,3 +541,16 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
});
rx.recv().unwrap()
}

/// Prints deprecation warnings for deprecated options
fn check_deprecated_options(matches: &getopts::Matches) {
if matches.opt_present("input-format") ||
matches.opt_present("output-format") ||
matches.opt_present("plugin-path") ||
matches.opt_present("plugins") ||
matches.opt_present("no-defaults") ||
matches.opt_present("passes") {
eprintln!("WARNING: this flag is considered deprecated");
eprintln!("WARNING: please see https://github.com/rust-lang/rust/issues/44136");
}
}
88 changes: 66 additions & 22 deletions src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,30 +705,74 @@ impl hash::Hash for SocketAddrV6 {
///
/// # Examples
///
/// Creating a [`SocketAddr`] iterator that yields one item:
///
/// ```
/// use std::net::{ToSocketAddrs, SocketAddr};
///
/// let addr = SocketAddr::from(([127, 0, 0, 1], 443));
/// let mut addrs_iter = addr.to_socket_addrs().unwrap();
///
/// assert_eq!(Some(addr), addrs_iter.next());
/// assert!(addrs_iter.next().is_none());
/// ```
///
/// Creating a [`SocketAddr`] iterator from a hostname:
///
/// ```no_run
/// use std::net::{SocketAddrV4, TcpStream, UdpSocket, TcpListener, Ipv4Addr};
///
/// fn main() {
/// let ip = Ipv4Addr::new(127, 0, 0, 1);
/// let port = 12345;
///
/// // The following lines are equivalent modulo possible "localhost" name
/// // resolution differences
/// let tcp_s = TcpStream::connect(SocketAddrV4::new(ip, port));
/// let tcp_s = TcpStream::connect((ip, port));
/// let tcp_s = TcpStream::connect(("127.0.0.1", port));
/// let tcp_s = TcpStream::connect(("localhost", port));
/// let tcp_s = TcpStream::connect("127.0.0.1:12345");
/// let tcp_s = TcpStream::connect("localhost:12345");
///
/// // TcpListener::bind(), UdpSocket::bind() and UdpSocket::send_to()
/// // behave similarly
/// let tcp_l = TcpListener::bind("localhost:12345");
///
/// let mut udp_s = UdpSocket::bind(("127.0.0.1", port)).unwrap();
/// udp_s.send_to(&[7], (ip, 23451)).unwrap();
/// }
/// use std::net::{SocketAddr, ToSocketAddrs};
///
/// // assuming 'localhost' resolves to 127.0.0.1
/// let mut addrs_iter = "localhost:443".to_socket_addrs().unwrap();
/// assert_eq!(addrs_iter.next(), Some(SocketAddr::from(([127, 0, 0, 1], 443))));
/// assert!(addrs_iter.next().is_none());
///
/// // assuming 'foo' does not resolve
/// assert!("foo:443".to_socket_addrs().is_err());
/// ```
///
/// Creating a [`SocketAddr`] iterator that yields multiple items:
///
/// ```
/// use std::net::{SocketAddr, ToSocketAddrs};
///
/// let addr1 = SocketAddr::from(([0, 0, 0, 0], 80));
/// let addr2 = SocketAddr::from(([127, 0, 0, 1], 443));
/// let addrs = vec![addr1, addr2];
///
/// let mut addrs_iter = (&addrs[..]).to_socket_addrs().unwrap();
///
/// assert_eq!(Some(addr1), addrs_iter.next());
/// assert_eq!(Some(addr2), addrs_iter.next());
/// assert!(addrs_iter.next().is_none());
/// ```
///
/// Attempting to create a [`SocketAddr`] iterator from an improperly formatted
/// socket address `&str` (missing the port):
///
/// ```
/// use std::io;
/// use std::net::ToSocketAddrs;
///
/// let err = "127.0.0.1".to_socket_addrs().unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
/// ```
///
/// [`TcpStream::connect`] is an example of an function that utilizes
/// `ToSocketsAddr` as a trait bound on its parameter in order to accept
/// different types:
///
/// ```no_run
/// use std::net::{TcpStream, Ipv4Addr};
///
/// let stream = TcpStream::connect(("127.0.0.1", 443));
/// // or
/// let stream = TcpStream::connect("127.0.0.1.443");
/// // or
/// let stream = TcpStream::connect((Ipv4Addr::new(127, 0, 0, 1), 443));
/// ```
///
/// [`TcpStream::connect`]: ../../std/net/struct.TcpStream.html#method.connect
#[stable(feature = "rust1", since = "1.0.0")]
pub trait ToSocketAddrs {
/// Returned iterator over socket addresses which this type may correspond
Expand Down
3 changes: 3 additions & 0 deletions src/test/compile-fail/unused-result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ fn main() {
foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used: some message

// as an exceptional case, booleans are not considered unused
foo::<bool>();

let _ = foo::<isize>();
let _ = foo::<MustUse>();
let _ = foo::<MustUseMsg>();
Expand Down
78 changes: 39 additions & 39 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,117 +83,117 @@ impl fmt::Display for Mode {

#[derive(Clone)]
pub struct Config {
// The library paths required for running the compiler
/// The library paths required for running the compiler
pub compile_lib_path: PathBuf,

// The library paths required for running compiled programs
/// The library paths required for running compiled programs
pub run_lib_path: PathBuf,

// The rustc executable
/// The rustc executable
pub rustc_path: PathBuf,

// The rustdoc executable
/// The rustdoc executable
pub rustdoc_path: Option<PathBuf>,

// The python executable to use for LLDB
/// The python executable to use for LLDB
pub lldb_python: String,

// The python executable to use for htmldocck
/// The python executable to use for htmldocck
pub docck_python: String,

// The llvm FileCheck binary path
/// The llvm FileCheck binary path
pub llvm_filecheck: Option<PathBuf>,

// The valgrind path
/// The valgrind path
pub valgrind_path: Option<String>,

// Whether to fail if we can't run run-pass-valgrind tests under valgrind
// (or, alternatively, to silently run them like regular run-pass tests).
/// Whether to fail if we can't run run-pass-valgrind tests under valgrind
/// (or, alternatively, to silently run them like regular run-pass tests).
pub force_valgrind: bool,

// The directory containing the tests to run
/// The directory containing the tests to run
pub src_base: PathBuf,

// The directory where programs should be built
/// The directory where programs should be built
pub build_base: PathBuf,

// The name of the stage being built (stage1, etc)
/// The name of the stage being built (stage1, etc)
pub stage_id: String,

// The test mode, compile-fail, run-fail, run-pass
/// The test mode, compile-fail, run-fail, run-pass
pub mode: Mode,

// Run ignored tests
/// Run ignored tests
pub run_ignored: bool,

// Only run tests that match this filter
/// Only run tests that match this filter
pub filter: Option<String>,

// Exactly match the filter, rather than a substring
/// Exactly match the filter, rather than a substring
pub filter_exact: bool,

// Write out a parseable log of tests that were run
/// Write out a parseable log of tests that were run
pub logfile: Option<PathBuf>,

// A command line to prefix program execution with,
// for running under valgrind
/// A command line to prefix program execution with,
/// for running under valgrind
pub runtool: Option<String>,

// Flags to pass to the compiler when building for the host
/// Flags to pass to the compiler when building for the host
pub host_rustcflags: Option<String>,

// Flags to pass to the compiler when building for the target
/// Flags to pass to the compiler when building for the target
pub target_rustcflags: Option<String>,

// Target system to be tested
/// Target system to be tested
pub target: String,

// Host triple for the compiler being invoked
/// Host triple for the compiler being invoked
pub host: String,

// Path to / name of the GDB executable
/// Path to / name of the GDB executable
pub gdb: Option<String>,

// Version of GDB, encoded as ((major * 1000) + minor) * 1000 + patch
/// Version of GDB, encoded as ((major * 1000) + minor) * 1000 + patch
pub gdb_version: Option<u32>,

// Whether GDB has native rust support
/// Whether GDB has native rust support
pub gdb_native_rust: bool,

// Version of LLDB
/// Version of LLDB
pub lldb_version: Option<String>,

// Version of LLVM
/// Version of LLVM
pub llvm_version: Option<String>,

// Is LLVM a system LLVM
/// Is LLVM a system LLVM
pub system_llvm: bool,

// Path to the android tools
/// Path to the android tools
pub android_cross_path: PathBuf,

// Extra parameter to run adb on arm-linux-androideabi
/// Extra parameter to run adb on arm-linux-androideabi
pub adb_path: String,

// Extra parameter to run test suite on arm-linux-androideabi
/// Extra parameter to run test suite on arm-linux-androideabi
pub adb_test_dir: String,

// status whether android device available or not
/// status whether android device available or not
pub adb_device_status: bool,

// the path containing LLDB's Python module
/// the path containing LLDB's Python module
pub lldb_python_dir: Option<String>,

// Explain what's going on
/// Explain what's going on
pub verbose: bool,

// Print one character per test instead of one line
/// Print one character per test instead of one line
pub quiet: bool,

// Whether to use colors in test.
/// Whether to use colors in test.
pub color: ColorConfig,

// where to find the remote test client process, if we're using it
/// where to find the remote test client process, if we're using it
pub remote_test_client: Option<PathBuf>,

// Configuration for various run-make tests frobbing things like C compilers
Expand Down