Commit Graph

34263 Commits

Author SHA1 Message Date
Jakub Bukaj
f6b4e398b9 rollup merge of #18944: liigo/improve-os-args-doc 2014-11-19 22:37:15 +01:00
Jakub Bukaj
0191b4983e rollup merge of #18940: nikomatsakis/issue-18899
Ensure that the type parameters passed to methods outlive the call expression.

Fixes #18899.

This is yet another case of forgotten to consistently enforce the constraints in every instance where they apply. Might be nice to try and refactor to make this whole thing more DRY, but for now here's a targeted fix.

r? @pcwalton
2014-11-19 22:37:11 +01:00
Jakub Bukaj
cbdaf2ebc7 rollup merge of #18903: steveklabnik/error_handling_guide
Now that we've done `fail` -> `panic`, I feel bringing back the error handling guide is a good idea. We had one long ago, but it was removed when conditions were removed.

This doesn't cover the new FromError stuff, but I feel like it's already useful in this state, so I'm sending this PR now.
2014-11-19 22:37:07 +01:00
Jakub Bukaj
655eb44df3 rollup merge of #18868: nikomatsakis/issue-17388-unbound-path-assoc-type
This fixes #17388.

Note that we don't check type parameters in trait-references and so on, so we accept some nonsense (I opened https://github.com/rust-lang/rust/issues/18865). (It may be easier to just add support for `T::Foo` and deprecate the qpath code until we can implement it more robustly using the trait lookup infrastructure, not sure.)
2014-11-19 22:37:02 +01:00
Jakub Bukaj
fee71bd476 rollup merge of #18728: thestinger/int
This fixes the gap in the language definition causing #18726 by defining
a clear bound on the maximum size for libraries to enforce.

Closes #18069
2014-11-19 22:36:59 +01:00
bors
3e9414463e auto merge of #18746 : nikomatsakis/rust/issue-17322-unsized_ty, r=ncr
Pass the unadjusted type into the unsize_info function, which seems to be what it expects. Fixes #17322.

r? @nick29581 

Full disclosure: still running make check locally ;)
2014-11-19 16:22:01 +00:00
Niko Matsakis
ee9a7b60fa Pass the unadjusted type into the unsize_info function, which seems to be what it expects. Fixes #17322. 2014-11-19 10:02:04 -05:00
Niko Matsakis
2477bc4451 Update libcollections tests to pass the new type rules. They used to return a pointer to the value they were modifying, but this should not have been legal, since that pointer would have to outlive the closure, and the closure continues to modify the value during the execution. This return value was just passed to black_box so as to convince llvm that the value was live, so rather than returning a pointer, modify to just call black_box directly inside the fn. 2014-11-19 06:20:20 -05:00
Niko Matsakis
0b6ec70197 Ensure that the type parameters passed to methods outlive the call expression. Fixes #18899. 2014-11-19 06:20:20 -05:00
Niko Matsakis
b64c7b83dd Refactor QPath to take an ast::TraitRef 2014-11-19 05:53:40 -05:00
Daniel Micay
210e059750 clearly define int and uint to fix unsoundness
This fixes the gap in the language definition causing #18726 by defining
a clear bound on the maximum size for libraries to enforce.

Closes #18069
2014-11-19 05:17:56 -05:00
bors
cf7df1e638 auto merge of #18483 : eddyb/rust/safe-ty, r=nikomatsakis
After more than a month of sitting on this patch, rebasing and tracking down some nasty bugs (there's might be still one out there, but it only manifested in `middle::trans::reflect` which is now gone), I'd like to merge it as it is.

This changeset makes middle::ty safe, linking the lifetime of a type to the type context it was created in.
It's a prerequisite for introducing function-local type contexts to localize types with inference variables, in order to (potentially) free hundreds of MBs from rustc's memory usage peak.
2014-11-19 07:21:42 +00:00
Eduard Burtescu
bf0766ada1 rustdoc: fix fallout of ty::t -> Ty<'tcx>. 2014-11-19 06:24:35 +02:00
Eduard Burtescu
8accc7c386 rustc: middle: simplify primitive type declaration in ty. 2014-11-19 06:24:35 +02:00
Eduard Burtescu
9f7aa7fa76 rustc: middle: remove obsolete ty::get. 2014-11-19 06:24:35 +02:00
Eduard Burtescu
01105ffde3 rustc: middle: avoid clones in ty_fn_{sig,args}. 2014-11-19 06:24:35 +02:00
Eduard Burtescu
4c3ad48c45 rustc: fix fallout of making Ty an alias for &TyS instead of a wrapper. 2014-11-19 06:24:35 +02:00
Eduard Burtescu
5bc98954d5 rustc: fix fallout of adding the 'tcx lifetime to Ty. 2014-11-19 06:24:34 +02:00
Eduard Burtescu
92ae0c6c25 rustc: middle: ty: replace unsafe pointers with references in Ty. 2014-11-19 06:24:34 +02:00
Eduard Burtescu
9706d8f602 rustc: middle: rename ty::t to Ty and use it unqualified everywhere. 2014-11-19 06:24:34 +02:00
Eduard Burtescu
21da750663 rustc: avoid use-ing syntax::ast::*. 2014-11-19 06:24:34 +02:00
Steve Klabnik
16b9f67bf3 Error handling guide 2014-11-18 19:30:05 -05:00
bors
e09d98603e auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichton
Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions.

Closes #19024
2014-11-18 23:51:43 +00:00
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
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
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
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