Commit Graph

16945 Commits

Author SHA1 Message Date
bors
5d01f649b4 auto merge of #5816 : dbaupp/rust/rustc-packed-v2, r=nikomatsakis
#5758 take 2.

This adds a `#[packed]` attribute for structs, like GCC's `__attribute__((packed))`, e.g.

```rust
#[packed]
struct Size5 {
   a: u8,
   b: u32
}
```

It works on normal and tuple structs, but is (silently) ignored on enums.

Closes #1704.
2013-04-10 07:37:24 -07:00
Huon Wilson
7d7e149748 testsuite: tests for #[packed] structs. 2013-04-10 23:47:53 +10:00
Huon Wilson
cad226025b librustc: implement a #[packed] attribute for structs.
A struct (inc. tuple struct) can be annotated with #[packed], so that there
is no padding between its elements, like GCC's `__attribute__((packed))`.

Closes #1704
2013-04-10 23:39:20 +10:00
bors
a425b75c64 auto merge of #5773 : dunsmoreb/rust/incoming, r=bstrie
Updates the tutorial to include a simple definition for tuples in section 4.2. Fixes #5132.
2013-04-10 06:04:00 -07:00
Bryan Dunsmore
08bc392d94 Update destructuring to reference tuples section. 2013-04-10 07:06:18 -05:00
bors
7222801234 auto merge of #5812 : kud1ing/rust/patch-1, r=sanxiyn
"driver/rustc.rs" does not exist anymore
2013-04-10 00:51:57 -07:00
bors
7ebe5779b6 auto merge of #5813 : sanxiyn/rust/llvm-version, r=thestinger
See my [post](https://mail.mozilla.org/pipermail/rust-dev/2013-April/003518.html) on the mailing list for details.

Also:

* 3.2 is newer than 3.2svn, so I changed the ordering. (3.2svn is the version used between 3.2 and 3.3.)
* 3.3svn is added. This is the version you currently get from compiling LLVM trunk.
* 3.3 is added. 3.3 is not released yet, but this is the version used by http://llvm.org/apt/.
2013-04-09 23:06:58 -07:00
James Miller
1edfed7914 Change tests to use new error message 2013-04-10 18:02:15 +12:00
kud1ing
0fea2bd8a1 README: "driver/rust.rs" => "rust.rc" 2013-04-10 09:01:15 +03:00
Seo Sanghyeon
156a307f4b LLVM versions 2013-04-10 14:57:49 +09:00
Seo Sanghyeon
df5555aa67 Rename tydecode::parse_int to parse_uint
It does not handle signs.
2013-04-10 14:45:12 +09:00
bors
6100bb5cba auto merge of #5804 : alexcrichton/rust/issue-3266, r=graydon
This leaves the default lint modes at `warn`, but now the unused variable and dead assignment warnings are configurable on a per-item basis. As described in #3266, this just involved carrying around a couple ids to pass over to `span_lint`. I personally would prefer to keep the `_` prefix as well.

This closes #3266.
2013-04-09 20:36:56 -07:00
bors
80b6bbd7b5 auto merge of #5789 : brson/rust/drop, r=graydon 2013-04-09 19:33:57 -07:00
bors
ec3cfaed8b auto merge of #5807 : klutzy/rust/vim-inner-doc, r=brson
Follow-up of #5760:
Add syntax highlight for `/*! doc */` or `//! doc`.
2013-04-09 18:15:58 -07:00
bors
92e265cdea auto merge of #5802 : nikomatsakis/rust/issue-4183-trait-substs, r=nikomatsakis
Cleanup substitutions and treatment of generics around traits in a number of ways

- In a TraitRef, use the self type consistently to refer to the Self type:
  - trait ref in `impl Trait<A,B,C> for S` has a self type of `S`.
  - trait ref in `A:Trait` has the self type `A`
  - trait ref associated with a trait decl has self type `Self`
  - trait ref associated with a supertype has self type `Self`
  - trait ref in an object type `@Trait` has no self type

- Rewrite `each_bound_traits_and_supertraits` to perform
  substitutions as it goes, and thus yield a series of trait refs
  that are always in the same 'namespace' as the type parameter
  bound given as input.  Before, we left this to the caller, but
  this doesn't work because the caller lacks adequare information
  to perform the type substitutions correctly.

- For provided methods, substitute the generics involved in the provided
  method correctly.

- Introduce TypeParameterDef, which tracks the bounds declared on a type
  parameter and brings them together with the def_id and (in the future)
  other information (maybe even the parameter's name!).

- Introduce Subst trait, which helps to cleanup a lot of the
  repetitive code involved with doing type substitution.

- Introduce Repr trait, which makes debug printouts far more convenient.

Fixes #4183.  Needed for #5656.

r? @catamorphism
2013-04-09 17:12:58 -07:00
bors
5e570ce4b0 auto merge of #5766 : thestinger/rust/cmp, r=brson
It was simpler to just give the variants a value instead of listing out all the cases for (*self, *other) in a match statement or writing spaghetti code. This makes the `cmp` method easier to use with FFI too, since you're a cast away from an idiomatic C comparator function. It would be fine implemented another way though.
2013-04-09 16:09:59 -07:00
James Miller
cd41ee2044 Add #[start] attribute to define a new entry point function 2013-04-10 10:43:46 +12:00
Niko Matsakis
e8cd29ba5e Apply comments from tjc 2013-04-09 12:33:18 -07:00
klutzy
7a1394d58f vim: syntax highlight for inner doc comment 2013-04-10 04:25:48 +09:00
bors
81ba65da47 auto merge of #5805 : brson/rust/0.7-pre, r=brson 2013-04-09 11:04:01 -07:00
Brian Anderson
23251b2438 Bump version to 0.7-pre 2013-04-09 10:59:32 -07:00
Alex Crichton
3e67085d7a Allow lint modes to be used on unused variables and dead assignments 2013-04-09 13:48:44 -04:00
Niko Matsakis
9963bd2413 Cleanup substitutions and treatment of generics around traits in a number of ways.
- In a TraitRef, use the self type consistently to refer to the Self type:
  - trait ref in `impl Trait<A,B,C> for S` has a self type of `S`.
  - trait ref in `A:Trait` has the self type `A`
  - trait ref associated with a trait decl has self type `Self`
  - trait ref associated with a supertype has self type `Self`
  - trait ref in an object type `@Trait` has no self type

- Rewrite `each_bound_traits_and_supertraits` to perform
  substitutions as it goes, and thus yield a series of trait refs
  that are always in the same 'namespace' as the type parameter
  bound given as input.  Before, we left this to the caller, but
  this doesn't work because the caller lacks adequare information
  to perform the type substitutions correctly.

- For provided methods, substitute the generics involved in the provided
  method correctly.

- Introduce TypeParameterDef, which tracks the bounds declared on a type
  parameter and brings them together with the def_id and (in the future)
  other information (maybe even the parameter's name!).

- Introduce Subst trait, which helps to cleanup a lot of the
  repetitive code involved with doing type substitution.

- Introduce Repr trait, which makes debug printouts far more convenient.

Fixes #4183.  Needed for #5656.
2013-04-09 08:06:10 -07:00
bors
412a07055c auto merge of #5769 : gifnksm/rust/range_step, r=bstrie
`uint::range_step` or `int::range_step` causes overflow or underflow as following.
code:
```rust
fn main() {
    for uint::range_step(3, 0, -2) |n| {
        println(fmt!("%u", n));
    }
}
```
output:
```
3
1
18446744073709551615
18446744073709551613
...
```
This commit fixes this behavior as follows.
```
3
1
```
2013-04-09 07:52:04 -07:00
bors
e56a17879a auto merge of #5788 : danluu/rust/rusti_clear, r=bstrie
The old help text reads "clear the screen", but :clear seems intended to do something completely different. I'm not sure what the intent is. If it's really supposed to clear the screen, not only does it not clear the screen, it does something completely different.

```
rusti> fn foo() { println("called foo!") }
()
rusti> foo();
called foo!
()
rusti> :clear
rusti> foo();
<anon>:34:0: 34:3 error: unresolved name: `foo`.
<anon>:34 foo();
```

Per the contributor guidelines, here's the reason there's no testcase: it's a comment string.
2013-04-09 06:10:01 -07:00
bors
c6a4ba9791 auto merge of #5800 : vivekgalatage/rust/master, r=bstrie
Currently submodules are using the git protocol. Git protocol is blocked
by certain corporate networks which makes it difficult to sync the submodules.

Replacing the git protocol with https in order to sync the submodules.
2013-04-09 05:18:59 -07:00
Vivek Galatage
f9f8a3e72c Support https protocol for git submodules for rust
Currently submodules are using the git protocol. Git protocol is blocked
by certain corporate networks which makes it difficult to sync the submodules.

Replacing the git protocol with https in order to sync the submodules.
2013-04-09 15:45:22 +05:30
Dan Luu
eaa8bbbb2e Fix comment to match style of surrounding text 2013-04-08 23:58:29 -04:00
bors
30dbbe17c9 auto merge of #5787 : alexcrichton/rust/less-mut-fields, r=catamorphism
This removes some of the easier instances of mutable fields where the explicit self can just become `&mut self` along with removing some unsafe blocks which aren't necessary any more now that purity is gone.

Most of #4568 is done, except for [one case](https://github.com/alexcrichton/rust/blob/less-mut-fields/src/libcore/vec.rs#L1754) where it looks like it has to do with it being a `const` vector. Removing the unsafe block yields:

```
/Users/alex/code/rust2/src/libcore/vec.rs:1755:12: 1755:16 error: illegal borrow unless pure: creating immutable alias to const vec content
/Users/alex/code/rust2/src/libcore/vec.rs:1755         for self.each |e| {
                                                           ^~~~
/Users/alex/code/rust2/src/libcore/vec.rs:1757:8: 1757:9 note: impure due to access to impure function
/Users/alex/code/rust2/src/libcore/vec.rs:1757         }
                                                       ^
error: aborting due to previous error
```

I also didn't delve too much into removing mutable fields with `Cell` or `transmute` and friends.
2013-04-08 18:36:57 -07:00
bors
22f65e9852 auto merge of #5786 : JensNockert/rust/u16-debuginfo-typo, r=catamorphism
A small typo in debuginfo.rs related to the u16 type.
2013-04-08 17:34:01 -07:00
bors
786ae0114b auto merge of #5782 : zofrex/rust/doc-1-tuples, r=thestinger
As per [the 0.6 release notes](https://github.com/mozilla/rust/wiki/Doc-detailed-release-notes#06-april-2013) single-element tuples are legal. I spotted a couple of places in the documentation that said otherwise, and propose these changes to them.
2013-04-08 16:22:03 -07:00
Brian Anderson
2e907a3ac2 core: Remove all but one drop block in favor of finally 2013-04-08 16:16:32 -07:00
Dan Luu
37f17d7204 Update help text to match behavior 2013-04-08 18:25:15 -04:00
Jens Nockert
e06b9827ef Fix typo in u16 debug info 2013-04-08 23:59:00 +02:00
Alex Crichton
255193cc1a Removing no longer needed unsafe blocks 2013-04-08 17:50:25 -04:00
Alex Crichton
3136fba5ae Removing some mutable fields in libstd 2013-04-08 17:50:14 -04:00
bors
1968130885 auto merge of #5763 : thestinger/rust/clone, r=nikomatsakis
Performing a deep copy isn't ever desired for a persistent data
structure, and it requires a more complex implementation to do
correctly. A deep copy needs to check for cycles to avoid an infinite
loop.
2013-04-08 14:12:55 -07:00
Daniel Micay
68d17bca4b clone: managed boxes need to clone by shallow copy
Performing a deep copy isn't ever desired for a persistent data
structure, and it requires a more complex implementation to do
correctly. A deep copy needs to check for cycles to avoid an infinite
loop.
2013-04-08 16:19:12 -04:00
bors
5a0f628501 auto merge of #5777 : lucab/rust/lucab/doc/misc, r=thestinger
A non-code PR to put the AUTHORS.txt file in the released tarball and to update the copyright terms in the rustc manpage as per post-dual-licensing.
2013-04-08 13:09:55 -07:00
bors
913ca088fc auto merge of #5776 : dbaupp/rust/syntax-parse-large-number, r=thestinger
Addresses #5544 and #5770, as well as a comment left in the documentation of `from_str_bytes_common`, so that there is now an option to ignore underscores.
2013-04-08 12:06:58 -07:00
bors
c92936395c auto merge of #5775 : pavpanchekha/rust/patch-1, r=thestinger
Change wrong field name in "Trait Inheritance" section.
2013-04-08 11:10:00 -07:00
bors
2255587f23 auto merge of #5760 : klutzy/rust/vim, r=thestinger
1. disable nested comment which is not supported now
2. add syntax highlight for rustCommentDoc e.g. `/** doc */` or `/// doc`.
2013-04-08 09:34:01 -07:00
Luca Bruno
a5c931cc61 Update license terms in manpage 2013-04-08 10:19:16 +02:00
Luca Bruno
2190efb3ca Put AUTHORS.txt file in the release tarball 2013-04-08 10:15:12 +02:00
Jed Davis
e9a52f5af5 Make intrinsic::Opaque more opaque 2013-04-08 01:03:42 -07:00
Jed Davis
04b2c26f39 Make the enum visit callback generator more readable 2013-04-08 01:03:42 -07:00
Jed Davis
2589eba957 When repr'ing an enum value, assert that it matched some variant. 2013-04-08 01:03:42 -07:00
Jed Davis
640e8ae4e5 Export adt::trans_get_discr abstractly to the type visitor. 2013-04-08 01:03:42 -07:00
Jed Davis
0ca1885da1 Feed enum field offsets to type vistors. 2013-04-08 01:03:42 -07:00
Huon Wilson
0c2ceb1a2e libsyntax: fail lexing with an error message on an int literal larger than 2^64.
Stops an ICE.

Closes #5544.
2013-04-08 16:40:40 +10:00