Commit Graph

31953 Commits

Author SHA1 Message Date
Joseph Crail
687db5d887 Fix issue #15826.
The implemented fix rounds half-way cases away from zero as described in
the original comments.

This rounding algorithm is sometimes called arithmetic rounding. It is
described further here:
http://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero

I also added several new tests to prevent regressions.
2014-08-28 14:31:12 -04:00
Niko Matsakis
ae314512e3 Fix kindck to consider inherited bounds 2014-08-28 14:15:34 -04:00
Niko Matsakis
1c15e9efeb Fix regionck to account for the uniqueness requirements on ref mut reborrows 2014-08-28 14:15:34 -04:00
Niko Matsakis
f60a7c4798 Fix regionck to consider bounds on a proc when capturing variables 2014-08-28 14:15:32 -04:00
Aaron Turon
9a8233d377 stabilize core::result
Per API meeting

  https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md

Most of the module is marked as stable or unstable; most of the unstable
items are awaiting resolution of conventions issues.

* `collect`: this functionality is being moved to a new `FromIterator`
  impl.
* `fold_` is deprecated due to lack of use
* Several methods found in `core::option` are added here, including
  `iter`, `as_slice`, and variants.

Due to deprecations, this is a:

[breaking-change]
2014-08-28 09:12:54 -07:00
Aaron Turon
276b8b125d Fallout from stabilizing core::option 2014-08-28 09:12:54 -07:00
Aaron Turon
3a52ef4613 stabilize core::option
Per API meeting

  https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md

Most of the module is marked as stable or unstable; most of the unstable
items are awaiting resolution of conventions issues.

However, a few methods have been deprecated, either due to lack of use
or redundancy:

* `take_unwrap`, `get_ref` and `get_mut_ref` (redundant, and we prefer
  for this functionality to go through an explicit .unwrap)
* `filtered` and `while`
* `mutate` and `mutate_or_set`
* `collect`: this functionality is being moved to a new `FromIterator`
  impl.

Due to deprecations, this is a:

[breaking-change]
2014-08-28 09:12:54 -07:00
bors
b5165321e4 auto merge of #16453 : nikomatsakis/rust/type-bounds-3, r=pcwalton
Implements https://github.com/rust-lang/rfcs/pull/192.

In particular:

1. type parameters can have lifetime bounds and objects can close over borrowed values, presuming that they have suitable bounds.
2. objects must have a bound, though it may be derived from the trait itself or from a `Send` bound.
3. all types must be well-formed.
4. type parameters and lifetime parameters may themselves have lifetimes as bounds. Something like `T:'a` means "the type T outlives 'a`" and something like `'a:'b`" means "'a outlives 'b". Outlives here means "all borrowed data has a lifetime at least as long".

This is a [breaking-change]. The most common things you have to fix after this change are:

1. Introduce lifetime bounds onto type parameters if your type (directly or indirectly) contains a reference. Thus a struct like `struct Ref<'a, T> { x: &'a T }` would be changed to `struct Ref<'a, T:'a> { x: &'a T }`.
2. Introduce lifetime bounds onto lifetime parameters if your type contains a double reference. Thus a type like `struct RefWrapper<'a, 'b> { r: &'a Ref<'b, int> }` (where `Ref` is defined as before) would need to be changed to `struct RefWrapper<'a, 'b:'a> { ... }`.
2. Explicitly give object lifetimes in structure definitions. Most commonly, this means changing something like `Box<Reader>` to `Box<Reader+'static>`, so as to indicate that this is a reader without any borrowed data. (Note: you may wish to just change to `Box<Reader+Send>` while you're at it; it's a more restrictive type, technically, but means you can send the reader between threads.)

The intuition for points 1 and 2 is that a reference must never outlive its referent (the thing it points at). Therefore, if you have a type `&'a T`, we must know that `T` (whatever it is) outlives `'a`. And so on.

Closes #5723.
2014-08-28 15:01:39 +00:00
Nick Cameron
539237372a Forbid ~str and ~[]
This corrects a rebasing error. Also adds a test so it won't happen again.
2014-08-28 16:05:31 +12:00
Niko Matsakis
1b487a8906 Implement generalized object and type parameter bounds (Fixes #16462) 2014-08-27 21:46:52 -04:00
Nick Cameron
d13fe1c528 Fix an ICE with error types in a vec
Closes #16783
2014-08-28 10:30:30 +12:00
Nick Cameron
cc9b2b0550 Allow a regex filter for RUST_LOG
When specifying RUST_LOG, the programmer may append `/regex` to the end of the spec. All results will then be filtered using that regex.
2014-08-28 10:14:57 +12:00
bors
0d3bd7720c auto merge of #16757 : steveklabnik/rust/lets_not_lie_in_the_concurrency_guide, r=alexcrichton
This cleans up blatant lies in the concurrency guide, and modernizes it
a bit. There's a lot more to do, but until I get to it, let's make it a
little bit better.
2014-08-27 21:31:13 +00:00
Steve Klabnik
263d65cb01 Fix lies in the concurrency guide.
This cleans up blatant lies in the concurrency guide, and modernizes it
a bit. There's a lot more to do, but until I get to it, let's make it a
little bit better.
2014-08-27 16:42:24 -04:00
bors
f2b87e9ff0 auto merge of #16797 : nikomatsakis/rust/remove-invalid-spsc_queue-test, r=alexcrichton
This test seems to read freed memory -- the peeked variable points into the queue, but then the pop operation removes the node from the queue and moves the enclosing `T` elsewhere, invalidating the `peeked` pointer.

r? @alexcrichton
2014-08-27 19:46:14 +00:00
Niko Matsakis
5c82f484db Remove invalid test -- this test reads freed memory, from what I can tell 2014-08-27 15:06:44 -04:00
bors
3ee047ae1f auto merge of #16766 : kevinmehall/rust/issue-15976, r=alexcrichton
As of 8876ce44, `is_sugared_doc` is encoded in metadata, so there is no
need to assume that all `doc` attributes came from sugared comments.

Fixes #15976
2014-08-27 17:11:11 +00:00
bors
18d6eefadb auto merge of #16761 : mrmonday/rust/patch-1, r=alexcrichton
This question comes up relatively frequently on IRC - "what do tx and rx mean?". This change adds a short explanation.
2014-08-27 14:01:18 +00:00
Manish Goregaokar
2b312eca89 Allow *-pointers in PtrTy (fixes #16781) 2014-08-27 18:49:17 +05:30
Michael Woerister
e72e4dfc74 debuginfo: Improve GDB version handling in compiletest tool 2014-08-27 15:19:14 +02:00
Michael Woerister
849ae5d881 debuginfo: Emit different autotest debugger scripts depending on GDB version. 2014-08-27 15:19:14 +02:00
Michael Woerister
6974b4f1b5 debuginfo: Add GDB pretty printers for structs and enums. 2014-08-27 15:19:14 +02:00
Michael Woerister
ee25b6bdeb debuginfo: Allow to activate GDB pretty printers in autotests. 2014-08-27 15:19:14 +02:00
bors
9669c6dc1a auto merge of #16752 : MatejLach/rust/more_cargorun, r=steveklabnik
Use cargo run as much as possible...
2014-08-27 11:16:12 +00:00
bors
c73ab0c10b auto merge of #16751 : luqmana/rust/tr, r=alexcrichton
Fixes #15562.
2014-08-27 09:31:14 +00:00
bors
d860a667e7 auto merge of #16724 : tshepang/rust/misleading, r=brson
We have to specify the module and the function name in the example where
the module shares a crate with the executable as well, so remove the
redundant (and potentially confusing) mention.
2014-08-27 07:46:17 +00:00
bors
5550edef46 auto merge of #16689 : wickerwaka/rust/crate-as, r=pcwalton
For review. Not sure about the link_attrs stuff. Will work on converting all the tests.

extern crate "foobar" as foo;
extern crate foobar as foo;

Implements remaining part of RFC #47.
Addresses issue #16461.

Removed link_attrs from rust.md, they don't appear to be supported by
the parser.
2014-08-27 06:01:18 +00:00
mdinger
48a2876c2c Fix sorting order. Change sync to share 2014-08-27 00:26:50 -04:00
bors
566b470e13 auto merge of #16685 : alexcrichton/rust/remove-glob, r=brson
This library has been moved out to a cargo package in rust-lang.
2014-08-27 02:31:20 +00:00
SiegeLord
0db6f4cb57 Add a simple test for rustdoc search index contents 2014-08-26 22:03:39 -04:00
Alex Crichton
118f481dbf glob: Deprecate the library in favor of cargo
This library has been moved out to a cargo package in rust-lang.
2014-08-26 17:54:58 -07:00
Robert Gawdzik ☢
c09c038e11 Added a note for usage of abs with ::MIN. 2014-08-26 20:45:02 -04:00
bors
e61ec99af2 auto merge of #16704 : flugsio/rust/fix-rustc-ice-lint-underscores-only, r=brson
Fix for type identifiers with only underscores (two or more), I assume they doesn't count as camel case.

```rust
type __ = int;

fn main() {
}
```

```
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/lib.rs:1

stack backtrace:
   1: 0xb603f5d0 - rt::backtrace:👿:write::ha55f265f6626471dmxr
   2: 0xb6042620 - failure::on_fail::h4d2c6d42b67e94803Sr
   3: 0xb640a180 - unwind::begin_unwind_inner::h484879fa7cc3611fZhe
   4: 0xb6409e50 - unwind::begin_unwind_fmt::hd14e5c64bc9006capfe
   5: 0xb6409df0 - rust_begin_unwind
   6: 0xb6454580 - failure::begin_unwind::h9ab1fc5753bd08f3YDk
   7: 0xb6458cb0 - failure::fail_bounds_check::h88167bad36865909aCk
   8: 0xb6f685d0 - lint::builtin::NonCamelCaseTypes.LintPass::check_item::check_case::he854eeffd105cb0f40E
   9: 0xb6f68050 - lint::builtin::NonCamelCaseTypes.LintPass::check_item::hc35b45d248e41cd43XE
  10: 0xb6f7b760 - lint::context::Context<'a>.Visitor<(*>::visit_item::closure.139262
  11: 0xb6f79510 - lint::context::Context<'a>::with_lint_attrs::hb9efe321fa321ce6spG
  12: 0xb6f81d30 - lint::context::Context<'a>.Visitor<(*>::visit_mod::he4593c831936b308ZMG
  13: 0xb6f8f2f0 - lint::context::check_crate::closure.139319
  14: 0xb6f79510 - lint::context::Context<'a>::with_lint_attrs::hb9efe321fa321ce6spG
  15: 0xb6efda70 - lint::context::check_crate::ha9e64328726b9579q1G
  16: 0xb6efda20 - driver::driver::phase_3_run_analysis_passes::closure.136263
  17: 0xb659d640 - util::common::time::h2837683151147173214
  18: 0xb6e7d130 - driver::driver::phase_3_run_analysis_passes::h7079eff53afc4de3Jfz
  19: 0xb6e783f0 - driver::driver::compile_input::h0ec84a550e24779cP1y
  20: 0xb6f26250 - driver::run_compiler::h7e7c01ecbfd0ad87JzC
  21: 0xb6f26150 - driver::main_args::closure.137215
  22: 0xb6f380d0 - task::TaskBuilder<S>::try_future::closure.138376
  23: 0xb6f37ec0 - task::TaskBuilder<S>::spawn_internal::closure.138353
  24: 0xb774bdd0 - task::spawn_opts::closure.8325
  25: 0xb6409c10 - unwind::try::try_fn::h91f00772748cf73eD8d
  26: 0xb6468ae0 - rust_try_inner
  27: 0xb6468aa0 - rust_try
  28: 0xb6407880 - unwind::try::h78a4fc0e85c326aef6d
  29: 0xb6407640 - task::Task::run::hb6f2d9484116e3d8xcd
  30: 0xb774bba0 - task::spawn_opts::closure.8271
  31: 0xb6409350 - thread::thread_start::h8c02fef9f651da5cjBd
  32: 0xb5ed3fc0 - start_thread
  33: 0xb62e8a32 - __clone
  34:        0x0 - <unknown>
```
2014-08-27 00:31:25 +00:00
Christoph Burgdorf
7fb3aa5eea add missing ! char to feature gate hint 2014-08-26 22:44:53 +02:00
nham
7b31058873 libcollections: In tests, remove some uses of deprecated methods and
unused imports.
2014-08-26 16:11:40 -04:00
SiegeLord
bcb07175ce Always insert methods into the search index, even if we're currently in a private module.
Previously, this caused methods of re-exported types to not be inserted into
the search index. This fix may introduce some false positives, but in my
testing they appear as orphaned methods and end up not being inserted into the
final search index at a later stage.

Fixes issue #11943
2014-08-26 14:41:25 -04:00
Matej Lach
7bfcace03b Use cargo run in more places 2014-08-26 19:40:11 +01:00
Kevin Mehall
ef13555ad1 rustdoc: Don't assume that a doc attribute was sugared: Fixes #15976
As of 8876ce44, `is_sugared_doc` is encoded in metadata, so there is no
need to assume that doc attributes came from sugared comments.
2014-08-26 09:39:26 -07:00
bors
80b45ddbd3 auto merge of #16742 : vhbit/rust/ios-ffi-fix, r=alexcrichton 2014-08-26 15:56:08 +00:00
Robert Clipsham
c56aa8bfcc Clarify what tx and rx mean
Add a short explanation of what tx and rx mean in terms of channels.
2014-08-26 15:39:22 +01:00
bors
3ae1059632 auto merge of #16720 : tshepang/rust/trailing-prompt, r=alexcrichton
because eyesore
2014-08-26 14:11:08 +00:00
bors
7932b719ec auto merge of #14397 : nick29581/rust/coerce, r=pnkfelix
DST coercions and DST fields in structs

The commits are not quite stand alone, I should probably squash them together before landing. In particular if you review the individual commits, then you'll see some scrappy stuff that gets fixed in later commits. But reading the commits in order might be easier to get an overall idea of what is going on.

The first commit includes putting back time zone into our time library - @pcwalton removed that as part of his de-~str'ing, but I had already converted it to use StrBuf, so we may as well leave it in. Update: no longer, this is removed in a later commit.
2014-08-26 10:31:06 +00:00
bors
1cad4089ba auto merge of #16753 : luqmana/rust/typer-ty, r=nikomatsakis
We shouldn't be making calls directly to `ty::node_id_to_type` since the typer may be bcx which also has to monomorphize the type.

Fixes #16643.
2014-08-26 04:41:10 +00:00
Nick Cameron
08364a4cac Optimise a particularly clown shoes example of DST codegen 2014-08-26 16:07:33 +12:00
Nick Cameron
52ef46251e Rebasing changes 2014-08-26 16:07:32 +12:00
Nick Cameron
3e626375d8 DST coercions and DST structs
[breaking-change]

1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code.

2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible.

3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-26 12:38:51 +12:00
Nick Cameron
37a94b80f2 Use temp vars for implicit coercion to ^[T] 2014-08-26 12:37:45 +12:00
Nick Cameron
34d607f9c9 Use the slice repr for ~[T] 2014-08-26 12:37:45 +12:00
Luqman Aden
2ab4486cbb Add test. 2014-08-25 13:37:40 -07:00
Luqman Aden
1660c3be93 librustc: Use Typer's node_ty method instead of free function in ExprUseVisitor. 2014-08-25 13:30:49 -07:00