Commit Graph

159 Commits

Author SHA1 Message Date
David Tolnay
4436c9d354 Format libstd with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd *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 -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd outstanding_files | xargs git checkout --

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

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:43:27 -08:00
leo60228
55fe6d8d58 Add documentation to std::env::args[_os] 2019-11-22 12:27:07 -05:00
Alexander Regueiro
b0006dff10 A few cosmetic improvements to code & comments in liballoc and libcore 2019-09-06 16:02:25 +01:00
Tom Milligan
af5625dc85 docs: add stdlib env::var(_os) panic 2019-08-11 12:49:02 +01:00
Brian Cain
4b339688b5 add support for hexagon-unknown-linux-musl 2019-07-22 09:44:58 -05:00
Brent Kerby
0123fab873 Fix typo "spit_paths", add link 2019-05-23 19:38:23 -06:00
Steven Fackler
8a22bc3b30 Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators."
This reverts commit 3e86cf36b5.
2019-05-22 14:09:34 -07:00
bors
c84a7abf8b Auto merge of #60775 - hellow554:no_bitrig, r=joshtriplett
Remove bitrig support from rust

Resolves #60743

using `find` and `rg` I delete every occurence of "bitrig" in the sources, expect for the llvm submodule (is this correct?).

There's also this file 5b8e99bb61/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?
2019-05-15 04:34:14 +00:00
Mazdak Farrokhzad
bab03cecfe Rollup merge of #60130 - khuey:efficient_last, r=sfackler
Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators

Provided a `DoubleEndedIterator` has finite length, `Iterator::last` is equivalent to `DoubleEndedIterator::next_back`. But searching forwards through the iterator when it's unnecessary is obviously not good for performance. I ran into this on one of the collection iterators.

I tried adding appropriate overloads for a bunch of the iterator adapters like filter, map, etc, but I ran into a lot of type inference failures after doing so.

The other interesting case is what to do with `Repeat`. Do we consider it part of the contract that `Iterator::last` will loop forever on it? The docs do say that the iterator will be evaluated until it returns None. This is also relevant for the adapters, it's trivially easy to observe whether a `Map` adapter invoked its closure a zillion times or just once for the last element.
2019-05-14 22:00:09 +02:00
Marcel Hellwig
cc314b066a Remove bitrig support from rust 2019-05-13 11:09:06 +02:00
Kyle Huey
3e86cf36b5 Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators.
r?Manishearth
2019-04-19 21:52:43 -07:00
Nathan Kleyn
8951eea9b7 Document Item type in std::env::SplitPaths iterator.
Previously there wasn't any documentation to show what the type of
`Item` was inside `std::env::SplitPaths`. Now, in the same format as
other examples of docs in `srd` for `Iterator#Item`, we mention the
type.

This fixes #59543.
2019-04-17 08:11:37 +01:00
Mazdak Farrokhzad
379c380a60 libstd: deny(elided_lifetimes_in_paths) 2019-03-31 12:56:51 +02:00
Jethro Beekman
f229422cc1 SGX target: fix std unit tests 2019-03-25 11:31:19 -07:00
Taiki Endo
93b6d9e086 libstd => 2018 2019-02-28 04:06:15 +09:00
Scott McMurray
3bea2ca49d Use more impl header lifetime elision
There are two big categories of changes in here

- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`)
- Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`)

I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-17 19:42:36 -08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
ljedrz
8c4129cd9a cleanup: remove static lifetimes from consts in libstd 2018-12-04 10:21:42 +01:00
Ralf Jung
e9a88eaaf9 make reference to dirs crate clickable in terminals 2018-07-12 12:48:10 +02:00
Simon Ochsenreither
0afc16a039 Deprecate std::env::home_dir and fix incorrect documentation 2018-07-07 01:28:37 +02:00
John-John Tedro
f73c4a4768 env: remove unwrap in examples in favor of try op 2018-05-14 12:56:18 +02:00
Oliver Middleton
521e41e77d Correct a few stability attributes 2018-04-05 15:39:29 +01:00
Corey Farwell
e9dcec070d Remove hidden foo functions from doc examples; use Termination trait.
Fixes https://github.com/rust-lang/rust/issues/49233.
2018-03-28 13:15:05 +02:00
panicbit
b439632a75 Unimplement Send/Sync for ::env::{Args,ArgsOs,Vars,VarsOs} 2018-02-05 00:00:09 +01:00
Ed Schouten
d9d97c9f09 Make tests build on CloudABI.
There are some tests that need to be disabled on CloudABI specifically,
due to the fact that the shims cannot be built in combination with
unix::ext or windows::ext. Also improve the scoping of some imports to
suppress compiler warnings.
2018-01-11 11:28:34 +01:00
Corey Farwell
17380f2ac6 Minor rewrite of env::current_exe docs; clarify symlinks.
- Update example in ‘security’ section to use hard links, like the
  linked securityvulns.com example.
- Weaken language on symbolic links – indicate behavior is
  platform-specific

Fixes https://github.com/rust-lang/rust/issues/43617.
2017-12-24 11:29:13 -08:00
Kornel
53de42e333 Warn about non-portability of glob patterns 2017-11-07 17:01:56 +00:00
Stepan Koltsov
45af6ee4fc Move global vars changing tests into run-pass
Should fix race #42795
2017-06-24 18:23:39 +03:00
bors
6f01c84fc8 Auto merge of #42798 - stepancheg:args-debug, r=sfackler
Better Debug for Args and ArgsOs

Display actual args instead of two dots.
2017-06-22 10:34:21 +00:00
Stepan Koltsov
275f9a04af Better Debug for Args and ArgsOs
Display actual args instead of two dots.
2017-06-21 15:40:45 +03:00
Corey Farwell
58bbe1d68c Add a couple doc additional examples for env::join_paths. 2017-06-20 13:49:42 -04:00
Corey Farwell
3a550a4893 Rollup merge of #42579 - maccoda:maccoda/env_docs, r=steveklabnik
env docs completion.

Should be closing #29351 with the alignment of the iterators to the template.
2017-06-12 12:39:46 -04:00
Dylan Maccora
f52ac18840 env docs completion. 2017-06-10 16:19:28 +10:00
Mark Simulacrum
9ce4616960 Rollup merge of #42091 - maccoda:maccoda/env_docs, r=frewsxcv
Improving std::env docs

Addresses #29351.
Hopefully this addresses the following points:
> -  iterators should use the standard iterator boilerplate like https://doc.rust-lang.org/std/iter/struct.Map.html, this applies to all structs except for JoinPathsError
> -  JoinPathsError should properly link the function it comes from and use language similar to https://doc.rust-lang.org/std/io/struct.Error.html
> -  same wording issues with VarError
> - functions need to ensure linkage to things they refer to in their descriptions
> - Explain the difference between `os` and non-`os` structs and methods
2017-05-20 17:48:13 -06:00
bors
272e77f035 Auto merge of #42111 - ollie27:stab, r=Mark-Simulacrum
Correct some stability versions

These were found by running tidy on stable versions of rust and finding
features stabilised with the wrong version numbers.
2017-05-20 15:42:43 +00:00
Oliver Middleton
2f703e4304 Correct some stability versions
These were found by running tidy on stable versions of rust and finding
features stabilised with the wrong version numbers.
2017-05-20 08:38:39 +01:00
Dylan Maccora
55d75c42ef Merge branch 'master' into maccoda/env_docs 2017-05-20 09:42:37 +10:00
Dylan Maccora
b69b6413af Fixed link issue. 2017-05-20 08:32:10 +10:00
Dylan Maccora
fb19560054 std::env docs 2017-05-18 18:26:47 +10:00
Tshepang Lekhonkhobe
b9552963d1 misc doc improvements for std::env 2017-05-18 06:47:58 +02:00
Jack O'Connor
03b83a01ad clarify docs for Args and ArgsOs
The args() and args_os() docs include a line about how the first element
is usually the program name. Include that line in the struct docs too.
2017-03-05 16:39:26 -05:00
Guillaume Gomez
84aca88cda Add missing urls for env functions 2017-02-18 14:44:56 +01:00
Guillaume Gomez
3022614ec3 Add missing urls on join_paths 2017-02-08 21:53:49 +01:00
Guillaume Gomez
d0378089de Add missing urls for current_dir 2017-02-07 19:43:22 +01:00
Oliver Middleton
9128f6100c Fix a few impl stability attributes
The versions show up in rustdoc.
2017-01-29 13:31:47 +00:00
Oliver Middleton
09b3903aec Fix a few links in the docs 2017-01-27 18:08:51 +00:00
Utkarsh Kukreti
9d912b683a libstd: replace all try! with ? in documentation examples
See #38644.
2017-01-22 21:07:38 +05:30
Corey Farwell
58a470e344 Minor improvements to docs in std::env structures/functions.
* Call functions "functions" instead of "methods".
* Link structures to their constructor functions
* Add other misc. documentation links
2017-01-12 23:10:38 -05:00
Jonathan A. Kollasch
eda889c5bf libstd: define std::env::consts::ARCH for sparc64 2016-12-29 21:30:01 -05:00
Corey Farwell
86fc63e62d Implement fmt::Debug for all structures in libstd.
Part of https://github.com/rust-lang/rust/issues/31869.

Also turn on the `missing_debug_implementations` lint at the crate
level.
2016-12-18 14:55:14 -08:00