Commit Graph

34503 Commits

Author SHA1 Message Date
bors
1628b98183 auto merge of #18870 : barosl/rust/os-ioresult, r=alexcrichton
Make old-fashioned functions in the `std::os` module utilize `IoResult`.

I'm still investigating the possibility to include more functions in this pull request. Currently, it covers `getcwd()`, `make_absolute()`, and `change_dir()`. The issues covered by this PR are #16946 and #16315.

A few concerns:

- Should we provide `OsError` in distinction from `IoError`? I'm saying this because in Python, those two are distinguished. One advantage that we keep using `IoError` is that we can make the error cascade down other functions whose return type also includes `IoError`. An example of such functions is `std::io::TempDir::new_in()`, which uses `os::make_absolute()` as well as returns `IoResult<TempDir>`.
- `os::getcwd()` uses an internal buffer whose size is 2048 bytes, which is passed to `getcwd(3)`. There is no upper limitation of file paths in the POSIX standard, but typically it is set to 4096 bytes such as in Linux. Should we increase the buffer size? One thing that makes me nervous is that the size of 2048 bytes already seems a bit excessive, thinking that in normal cases, there would be no filenames that even exceeds 512 bytes.

Fixes #16946.
Fixes #16315.

Any ideas are welcomed. Thanks!
2014-11-18 21:56:58 +00:00
Barosl Lee
b5286af703 Make os::setenv() and os::unsetenv() panic if an error occurs
These functions can fail if:

- EINVAL: The name is empty, or contains an '=' character
- ENOMEM: Insufficient memory
2014-11-19 05:31:45 +09:00
Barosl Lee
5de56b3ca1 Make os::change_dir() return IoResult<()>
os::change_dir() returns bool, without a meaningful error message.
Change it to return IoResult<()> to indicate what IoError caused the
failure.

Fixes #16315.

[breaking-change]
2014-11-19 05:31:45 +09:00
Barosl Lee
6f422c4c05 Make os::getcwd() return IoResult<Path>
os::getcwd() panics if the current directory is not available. According
to getcwd(3), there are three cases:

- EACCES: Permission denied.
- ENOENT: The current working directory has been removed.
- ERANGE: The buffer size is less than the actual absolute path.

This commit makes os::getcwd() return IoResult<Path>, not just Path,
preventing it from panicking.

As os::make_absolute() depends on os::getcwd(), it is also modified to
return IoResult<Path>.

Fixes #16946.

[breaking-change]
2014-11-19 05:31:45 +09:00
Alex Crichton
e3c658f649 Register new snapshots 2014-11-18 11:35:22 -08:00
bors
c8d6e3b2c2 auto merge of #18993 : nikomatsakis/rust/hrtb-5, r=pcwalton
Enough said.

Fixes #18639.

r? @pcwalton (or someone else?)

This is a [breaking-change]. In particular, several feature gates related to unboxed closures were consolidated into one (`overloaded_calls`, `unboxed_closure_sugar` => `unboxed_closures`). Otherwise, I think everything that worked before should still work. File a bug and cc @nikomatsakis if you find otherwise. :)
2014-11-18 19:11:43 +00:00
Niko Matsakis
6866bf3234 Fix merge conflict about [] coercions in new tests 2014-11-18 13:20:59 -05:00
Steve Klabnik
0e6d97aab2 New guide: error handling 2014-11-18 12:56:55 -05:00
Niko Matsakis
56ba260749 Update test for equivalency to include region binders in object types, add new tests relating to HRTB, consolidate the unboxed_closures and overloaded_calls feature gates. 2014-11-18 12:32:38 -05:00
Niko Matsakis
7a846b86a8 Update tests for () notation to use traits not structs 2014-11-18 12:32:38 -05:00
Niko Matsakis
5a28d178af Allow impl's to have late-bound regions. Introduces another level of
region binding at the impl site, so for method types that come from impls,
it is necessary to liberate/instantiate late-bound regions at multiple
depths.
2014-11-18 12:32:38 -05:00
Niko Matsakis
6fb68f1c81 Introduce machinery for higher-ranked TraitRefs 2014-11-18 12:32:38 -05:00
Niko Matsakis
ecdb741df7 Test resolving of names with for binders. 2014-11-18 12:32:38 -05:00
Niko Matsakis
a298014245 Miscellaneous reformatttings and renamings. 2014-11-18 12:32:38 -05:00
Niko Matsakis
efef81e966 Stop checking the correctness of explicit self twice; instead, just
use simple pattern matching to take a guess at what the method's self
category is in astconv, and check it more thoroughly later.
2014-11-18 12:32:38 -05:00
Niko Matsakis
c8a94c5dfa Convert TyPolyTraitRef to accept arbitary bounds, so that things like
`Box<for<'a> Foo<&'a T> + 'a>` can be accepted. Also cleanup the visitor/fold
in general, exposing more callbacks.
2014-11-18 12:32:37 -05:00
Niko Matsakis
9c808ffee4 Make it an error to use parenthetical notation with
something other than a trait type.
2014-11-18 12:32:37 -05:00
Niko Matsakis
0b90cded14 Introduce some sanity checking assertions in trans, erase regions more aggressively. 2014-11-18 12:27:36 -05:00
Niko Matsakis
4ab0c588ff Switch the code to use De Bruijn indices rather than binder-ids. 2014-11-18 12:27:35 -05:00
Niko Matsakis
23652efffb Pull out the fn-sig sub/lub/glb code and generalize it into a higher_ranked module. Also moves the docs to a more suitable place. 2014-11-18 12:26:30 -05:00
Niko Matsakis
058abcc209 Place parenthetical notation under the unboxed_closure feature-gate.
Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.
2014-11-18 12:26:04 -05:00
jxv
33f8a82c02 librustrt: check for mips+linux config in stack_overflow 2014-11-18 09:24:11 -08:00
bors
09e2ad13d0 auto merge of #19060 : Gankro/rust/super-cloned, r=aturon
Edit: whoops, didn't mean to hit post.

Anyway, this is something I tried to do when I first implemented cloned, but couldn't figure out. Somewhere between then and the PR actually landing, we got Deref of references, so now this works! 🎉 

Also turns out the test for the functionality was never marked as a #[test]. Oops!

Also added a Cloned iterator adaptor. If this isn't desirable, it can be taken out of the PR (seperate commits).
2014-11-18 17:21:43 +00:00
bors
618bd5d1c5 auto merge of #19070 : nikomatsakis/rust/crates, r=nikomatsakis
Reduces memory usage significantly and opens opportunities for more parallel compilation.

This PR was previously #19002 but I closed it because bors didn't seem to recognize the `r+` annotations there.
2014-11-18 15:26:43 +00:00
Daniel Hofstetter
2aa241d76f Reference: Add missing third dot of range 2014-11-18 15:14:34 +01:00
bors
d7a29d87ba auto merge of #19031 : nodakai/rust/libcore-pow-and-sq, r=bjz
[breaking-change]

Deprecates `core::num::pow` in favor of `Int::pow`.
2014-11-18 13:41:38 +00:00
Alexis Beingessner
4a656062ee add Cloned iterator adaptor 2014-11-18 08:34:44 -05:00
Alexis Beingessner
9702fb9c7b make cloned generic over deref... and have its tests actually run 2014-11-18 08:34:42 -05:00
Niko Matsakis
dc6e414e6f Move trans, back, driver, and back into a new crate, rustc_trans. Reduces memory usage significantly and opens opportunities for more parallel compilation. 2014-11-18 07:32:43 -05:00
bors
516ece6ee4 auto merge of #18645 : nick29581/rust/coercions-1, r=alexcrichton
r?

(I realise this needs a rebase, but I will probably have to chop it up in order to land and I'd like to get r+ first so I can do that quicker)
2014-11-18 10:46:41 +00:00
bors
fcb1523241 auto merge of #18885 : thestinger/rust/writer, r=aturon
The trait has an obvious, sensible implementation directly on vectors so
the MemWriter wrapper is unnecessary. This will halt the trend towards
providing all of the vector methods on MemWriter along with eliminating
the noise caused by conversions between the two types. It also provides
the useful default Writer methods on Vec<u8>.

After the type is removed and code has been migrated, it would make
sense to add a new implementation of MemWriter with seeking support. The
simple use cases can be covered with vectors alone, and ones with the
need for seeks can use a new MemWriter implementation.
2014-11-18 08:36:39 +00:00
Nick Cameron
225de0d60f Windows and OS X fallout 2014-11-18 20:43:38 +13:00
Daniel Micay
85c2c2e38c implement Writer for Vec<u8>
The trait has an obvious, sensible implementation directly on vectors so
the MemWriter wrapper is unnecessary. This will halt the trend towards
providing all of the vector methods on MemWriter along with eliminating
the noise caused by conversions between the two types. It also provides
the useful default Writer methods on Vec<u8>.

After the type is removed and code has been migrated, it would make
sense to add a new implementation of MemWriter with seeking support. The
simple use cases can be covered with vectors alone, and ones with the
need for seeks can use a new MemWriter implementation.
2014-11-18 01:09:46 -05:00
bors
f637f1c5a2 auto merge of #19050 : japaric/rust/moar-dst, r=aturon
r? @aturon 
cc #16918
2014-11-18 03:26:36 +00:00
Murarth
2293a04b49 libsyntax: Add tests for parse_view_item 2014-11-17 20:26:21 -07:00
Murarth
7ef200774f libsyntax: Add parse_view_item method to Parser 2014-11-17 20:26:21 -07:00
NODA, Kai
3fcf2840a4 libcore: add num::Int::pow() and deprecate num::pow().
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-11-18 10:42:27 +08:00
bors
9c96a79a74 auto merge of #19049 : jakub-/rust/roll-up, r=alexcrichton
r? @alexcrichton
2014-11-18 01:02:19 +00:00
Jakub Bukaj
330a1afae8 Fix compilation and tests after the roll-up 2014-11-18 01:14:14 +01:00
Jorge Aparicio
d50e80f449 librustc: DSTify ClassList, LlvmRepr and Repr 2014-11-17 18:43:28 -05:00
Jakub Bukaj
9673365b37 rollup merge of #19045: jmesmon/jemalloc-flags-2
- CFG_CFLAGS is only used for jemalloc
- We grew an extra set of flags for jemalloc (CFG_JEMALLOC_CFLAGS) in addition to CFG_CFLAGS
- This kills of CFG_CFLAGS and keeps the more specific and less confusing CFG_JEMALLOC_CFLAGS
- Additionally, pass CFG_JEMALLOC_CFLAGS to jemalloc's configure slightly differently so things work when people use --sysroot in their CFLAGS.
2014-11-18 00:24:10 +01:00
Jakub Bukaj
2f8da7bbd0 rollup merge of #19041: japaric/clone
Closes #19037
cc #16918

r? @aturon
2014-11-18 00:24:08 +01:00
Jakub Bukaj
da5c61d469 rollup merge of #19038: jayelm/fixed-typos
Baby steps here...

Fixed some comments in liblog, libregex, librustc, libstd.
2014-11-18 00:24:08 +01:00
Jakub Bukaj
de05565ba3 rollup merge of #19029: vberger/stability_function_body
Items defined in the body of a function has no visibility outside it, and thus have no reason to inherit its stability.

Closes #17488
2014-11-18 00:24:07 +01:00
Jakub Bukaj
f3759dd2b6 rollup merge of #19026: alfie/doc-fixes
Updated all the adjacent character literals in the BCNF that cannot have an optional space between them
2014-11-18 00:24:06 +01:00
Jakub Bukaj
20241aa408 rollup merge of #19020: Gankro/better-warn
Came up on IRC that this was a bit unhelpful as to what should actually be *done*. I am new to changing compiler messages, please let me know if there's anything else that needs to be done to accomadate this change.

(My build system is still constantly crashing [Is bors contagious?], so this hasn't been formally `check`ed. I figure it's a simple enough change that any consequences [like compile-fail expected messages?] can be eyeballed by someone more experienced.)
2014-11-18 00:24:05 +01:00
Jakub Bukaj
f712a6fd01 rollup merge of #19018: tomjakubowski/fix-issue-19003
Make struct variant syntax more consistent with struct syntax and fix an
assert in middle::typeck.

Fix #19003
2014-11-18 00:24:04 +01:00
Jakub Bukaj
f1fd6b9407 rollup merge of #19016: gkoz/use_util_copy
This code is identical to io::util::copy()
2014-11-18 00:24:03 +01:00
Jakub Bukaj
789777babd rollup merge of #19015: alex/libcore-typos 2014-11-18 00:24:02 +01:00
Jakub Bukaj
7783e80d98 rollup merge of #19013: jakub-/issue-18986
Fixes #18986.
2014-11-18 00:24:01 +01:00