Commit Graph

1202 Commits

Author SHA1 Message Date
Matthias Krüger
7be94a8a95 don't use .into() to convert types into identical types.
example:
    let s: String = format!("hello").into();
2020-02-27 23:32:46 +01:00
Yuki Okushi
284acafe61
Rollup merge of #68767 - kubo39:patch-macos, r=shepmaster
macOS: avoid calling pthread_self() twice
2020-02-18 20:09:04 +09:00
Hiroki Noda
67068f35dd macOS: avoid calling pthread_self() twice 2020-02-16 19:53:42 +09:00
Friedrich von Never
b0a9e949e7
Strip unnecessary subexpression
It became unnecessary since a06baa56b9 reformatted the file.
2020-02-02 15:08:46 +07:00
Hiroki Noda
c870ca6217 Update 2020-01-30 10:31:12 +09:00
Hiroki Noda
50ed6cbf98 Fix typo. 2020-01-30 10:07:36 +09:00
Till Arnold
c32090c130 Document behavior of set_nonblocking on UnixListener 2020-01-12 12:01:37 +01:00
Lzu Tao
cd9a73d2ea make use of pointer::is_null 2020-01-10 12:52:00 +00:00
oxalica
f5baa03af0
Try statx for all linux-gnu targets 2020-01-08 14:21:27 +08:00
bors
ef92009c1d Auto merge of #66899 - msizanoen1:riscv-std, r=alexcrichton
Standard library support for riscv64gc-unknown-linux-gnu

Add std support for RISC-V 64-bit GNU/Linux and update libc for RISC-V support.

r? @alexcrichton
2020-01-06 19:07:42 +00:00
Guillaume Gomez
a86a18907b
Rollup merge of #67848 - ollie27:float_link_name_attr, r=Dylan-DPC
Remove unused `#[link_name = "m"]` attributes

These were perhaps supposed to be `#[link(name = "m")]` but linking libm should be handled by the libc crate anyway.

They should have triggered a compile error: #47725
2020-01-04 13:17:32 +01:00
Oliver Middleton
83333fe85b Remove unused #[link_name = "m"] attributes
These were perhaps supposed to be `#[link(name = "m")]` but linking libm should be handled by the libc crate anyway.
2020-01-03 23:41:11 +00:00
Lzu Tao
dd8f072233 Use drop instead of the toilet closure |_| () 2020-01-02 08:56:12 +00:00
msizanoen1
b830b673e7 Add support for RISC-V 64-bit GNU/Linux 2020-01-01 09:52:18 +07:00
David Tolnay
4646a88b7a
Deprecate Error::description for real
`description` has been documented as soft-deprecated since 1.27.0 (17
months ago). There is no longer any reason to call it or implement it.

This commit:

- adds #[rustc_deprecated(since = "1.41.0")] to Error::description;

- moves description (and cause, which is also deprecated) below the
  source and backtrace methods in the Error trait;

- reduces documentation of description and cause to take up much less
  vertical real estate in rustdocs, while preserving the example that
  shows how to render errors without needing to call description;

- removes the description function of all *currently unstable* Error
  impls in the standard library;

- marks #[allow(deprecated)] the description function of all *stable*
  Error impls in the standard library;

- replaces miscellaneous uses of description in example code and the
  compiler.
2019-12-24 22:39:49 -08:00
Mark Rousskov
6891388e66 x.py fmt after previous deignore 2019-12-24 17:38:22 -05:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Ross MacArthur
f7256d28d1
Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
Mazdak Farrokhzad
3a336c48c3
Rollup merge of #67442 - reitermarkus:dummy-variable, r=kennytm
Remove `SOCK_CLOEXEC` dummy variable on platforms that don't use it.
2019-12-20 12:17:27 +01:00
Mazdak Farrokhzad
b779cbbe68
Rollup merge of #67219 - jsgf:command-argv0-debug, r=joshtriplett
Fix up Command Debug output when arg0 is specified.

PR https://github.com/rust-lang/rust/pull/66512 added the ability to set argv[0] on
Command. As a side effect, it changed the Debug output to print both the program and
argv[0], which in practice results in stuttery output (`"echo" "echo" "foo"`).

This PR reverts the behaviour to the the old one, so that the command is only printed
once - unless arg0 has been set. In that case it emits `"[command]" "arg0" "arg1" ...`.
2019-12-20 12:17:22 +01:00
Markus Reiter
b82671112c Remove SOCK_CLOEXEC dummy variable on platforms that don't use it. 2019-12-20 04:27:28 +01:00
Markus Reiter
58910255aa Remove SO_NOSIGPIPE dummy variable on platforms that don't use it. 2019-12-18 08:46:00 +01:00
Jeremy Fitzhardinge
232022ff17 Fix up Command Debug output when arg0 is specified.
PR https://github.com/rust-lang/rust/pull/66512 added the ability to set argv[0] on
Command. As a side effect, it changed the Debug output to print both the program and
argv[0], which in practice results in stuttery output ("echo echo foo").

This PR reverts the behaviour to the the old one, so that the command is only printed
once - unless arg0 has been set. In that case it emits "[command] arg0 arg1 ...".
2019-12-16 14:44:16 -08:00
chansuke
e4852da576 Remove irelevant comment on register_dtor 2019-12-12 01:00:37 +09:00
Mazdak Farrokhzad
a279ebbc91
Rollup merge of #66346 - linkmauve:try-in-docstring, r=Dylan-DPC
Replace .unwrap() with ? in std::os::unix::net

As people like to copy examples, this gives them good habits.
2019-12-02 04:08:55 +01:00
bors
d8bdb3fdcb Auto merge of #66887 - dtolnay:rollup-uxowp8d, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #66818 (Format libstd/os with rustfmt)
 - #66819 (Format libstd/sys with rustfmt)
 - #66820 (Format libstd with rustfmt)
 - #66847 (Allow any identifier as format arg name)

Failed merges:

r? @ghost
2019-11-30 12:42:44 +00:00
David Tolnay
c34fbfaad3
Format libstd/sys with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/sys *that are not involved in any currently open PR*
to minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd/sys -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/sys outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:37:58 -08:00
Ralf Jung
f621c252ec really_init cmdline args on Miri 2019-11-29 20:07:55 +01:00
bors
3907d59bcf Auto merge of #66547 - leo60228:procfs-fallback, r=dtolnay
Fallback to .init_array when no arguments are available on glibc Linux

Linux is one of the only platforms where `std::env::args` doesn't work in a cdylib.
2019-11-29 05:04:51 +00:00
Brian Wignall
16fabd8efd Fix spelling typos 2019-11-26 22:19:54 -05:00
Pietro Albini
2b4af10367
Rollup merge of #66512 - jsgf:process-argv0, r=Dylan-DPC
Add unix::process::CommandExt::arg0

This allows argv[0] to be overridden on the executable's command-line. This also makes the program
executed independent of argv[0].

Does Fuchsia have the same semantics? I'm assuming so.

Addresses: #66510
2019-11-25 15:05:19 +01:00
Emmanuel Gil Peyrot
be18a22765 Add missing main() and return value 2019-11-24 15:31:44 +01:00
Emmanuel Gil Peyrot
cdfb5cb4bf Add missing semicolons and question marks 2019-11-24 15:31:43 +01:00
Emmanuel Gil Peyrot
aff79422d8 Also fix the signature of main in std::sys::unix::ext 2019-11-24 13:56:41 +01:00
Emmanuel Gil Peyrot
3a2da7194c Return Ok(()) in docstrings in std::os::unix::net 2019-11-24 13:55:03 +01:00
Emmanuel Gil Peyrot
8f158bc62b Replace .unwrap() with ? in std::os::unix::net 2019-11-24 13:55:03 +01:00
leo60228
d448ab0cf1 Make std::sys::unix::args::init a no-op on glibc Linux 2019-11-22 12:27:07 -05:00
leo60228
e282b2227f Document ARGV_INIT_ARRAY 2019-11-22 12:27:07 -05:00
leo60228
1ff055d875 Set .init_array priority
I'm not entirely sure *why*, but this fixed a problem I was having.
2019-11-22 12:27:07 -05:00
leo60228
d8b6be9b1f Use .init_array section on glibc 2019-11-22 12:27:07 -05:00
Mazdak Farrokhzad
ebd0ef9a39
Rollup merge of #66553 - hermitcore:hermit, r=rkruppe
remove HermitCore leftovers from sys/unix

HermitCore support is already moved to the directory "sys/hermit". => remove leftovers
2019-11-20 12:58:37 +01:00
Stefan Lankes
ab6cb01971 HermitCore support is moved to sys/hermit, remove obsolete statement in sys/unix 2019-11-19 20:43:06 +01:00
Jeremy Fitzhardinge
6dee1a5a9f Add unix::process::CommandExt::arg0
This allows argv[0] to be overridden on the executable's command-line. This also makes the program
executed independent of argv[0].

Does Fuchsia have the same semantics?

Addresses: #66510
2019-11-19 11:01:52 -08:00
Guillaume Gomez
0282c27781 rename cfg(rustdoc) into cfg(doc) 2019-11-06 18:32:51 +01:00
Mazdak Farrokhzad
828a3eef66
Rollup merge of #66092 - niacat:master, r=nagisa
Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.

This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file like `/dev/urandom` to be opened.

The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0

And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273

The semantics are the same as FreeBSD so reading 256 bytes per call is fine.

Similar change for getrandom crate: rust-random/getrandom#115
2019-11-06 07:03:09 +01:00
nia
b4f92eaea2 Use any() in code shared between FreeBSD and NetBSD 2019-11-04 17:34:29 +00:00
nia
23d221153f Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.
This system call is present on all supported NetBSD versions and
provides an endless stream of non-blocking random data from the
kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor
to be opened.

The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0

And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273

The semantics are the same as FreeBSD so reading 256 bytes per call
is fine.

Similar change for getrandom crate: rust-random/getrandom#115
2019-11-04 17:16:11 +00:00
Josh Stone
624e7d7cd0 [doc] fix the reference to using OpenOptions::open 2019-10-28 13:03:18 -07:00
Josh Stone
096c99b6eb [doc] add a possessive apostrophe in OpenOptionsExt::mode 2019-10-28 13:01:02 -07:00
bors
fae75cd216 Auto merge of #65167 - hermitcore:rusty-hermit, r=alexcrichton
Redesign the interface to the unikernel HermitCore

We are developing the unikernel HermitCore, where the kernel is written in Rust and is already part of the Rust Standard Library. The interface between the standard library and the kernel based on a small C library. With this pull request, we remove completely the dependency to C and use lld as linker. Currently, the kernel will be linked to the application as static library, which is published at https://github.com/hermitcore/libhermit-rs.

We don’t longer support the C interface to the kernel. Consequently, we remove this part from the Rust Standard Library.
2019-10-26 19:35:59 +00:00