Commit Graph

3519 Commits

Author SHA1 Message Date
Patrick Walton
c5cbfe89f8 librustc: De-@str NameAndSpan 2014-02-02 01:44:48 +11:00
Patrick Walton
a4dd3fe2f2 librustc: Fix merge fallout. 2014-02-02 01:44:48 +11:00
Patrick Walton
f9af11d6cc libsyntax: Remove all @str from the AST 2014-02-02 01:44:48 +11:00
Patrick Walton
b496d7bec2 libsyntax: Make float literals not use @str 2014-02-02 01:44:48 +11:00
Patrick Walton
8d6ef2e1b1 libsyntax: De-@str pathnames 2014-02-02 01:44:48 +11:00
Patrick Walton
e68108b3e8 librustc: Stop using @str for source. 2014-02-02 01:44:48 +11:00
Patrick Walton
0327d8a073 librustc: Fix merge fallout. 2014-02-02 01:44:48 +11:00
Patrick Walton
8e52b85d5a libsyntax: De-@str literal strings in the AST 2014-02-02 01:44:48 +11:00
Patrick Walton
70c5a0fbf7 libsyntax: Introduce an InternedString type to reduce @str in the
compiler and use it for attributes
2014-02-02 01:44:47 +11:00
Alex Crichton
b59895847e Remove the need to count lang items
This solves horrible diffs where all you do is renumber literally everything.
2014-01-31 21:43:12 -08:00
Virgile Andreani
b9a026afba Fix minor doc typos 2014-01-31 21:43:07 -08:00
Niko Matsakis
81d8328517 Introduce marker types for indicating variance and for opting out
of builtin bounds.

Fixes #10834.
Fixes #11385.
cc #5922.
2014-01-31 21:18:48 -05:00
bors
5a618129b8 auto merge of #11832 : jfager/rust/r5900, r=alexcrichton
I tried a couple of different ways to squash this, and still don't think this is ideal, but I wanted to get it out for feedback.

Closes #5900
Closes #9942

There are a few scenarios where the compiler tries to evaluate CastExprs without the corresponding types being available yet in the type context:  https://github.com/mozilla/rust/issues/10618, https://github.com/mozilla/rust/issues/5900, https://github.com/mozilla/rust/issues/9942

This PR takes the approach of having eval_const_expr_partial's CastExpr arm fall back to a limited ast_ty_to_ty call that only checks for (a subset of) valid const types, when the direct type lookup fails.  It's kind of hacky, so I understand if you don't want to take this as is.  I'd need a little mentoring to get this into better shape, as figuring out the proper fix has been a little daunting. I'm also happy if someone else wants to pick this up and run with it.

This closes 5900 and 9942, but only moves the goalposts a little on 10618, which now falls over in a later phase of the compiler.
2014-01-31 13:06:39 -08:00
bors
f47879637f auto merge of #11955 : alexcrichton/rust/fix-unwinding-on-mac-64, r=cmr
I believe that this is leading to lots of failures on the bots.

cc #11954
2014-01-31 11:21:33 -08:00
Alex Crichton
e8e0cdd73f Disable fp elim on mac64
I believe that this is leading to lots of failures on the bots.

cc #11954
2014-01-31 10:23:25 -08:00
bors
237885cc53 auto merge of #11917 : thestinger/rust/intrinsic, r=alexcrichton 2014-01-31 10:01:48 -08:00
Nathaniel Herman
89278f773d Make size_of, align_of, and element_offset functions return u64 instead of uint in trans::machine (per #5172) 2014-01-30 17:20:35 -05:00
Eduard Burtescu
7d967741c3 Implement default type parameters in generics. 2014-01-30 19:28:41 +02:00
bors
a6764c28e6 auto merge of #11909 : thestinger/rust/tydesc, r=pcwalton 2014-01-30 03:36:25 -08:00
bors
6b305f34fb auto merge of #11907 : sanxiyn/rust/simd-shift, r=thestinger
For the purpose of deciding whether to truncate or extend the right hand side of bit shifts, use the size of the element type for SIMD vector types.

Fix #11900.
2014-01-30 01:56:23 -08:00
bors
e3b1f3c443 auto merge of #11853 : alexcrichton/rust/up-llvm, r=brson
This upgrade brings commit by @eddyb to help optimizations of virtual calls in
a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a
commit by @c-a to *greatly* improve the runtime of the optimization passes
(https://github.com/rust-lang/llvm/pull/3).

Nice work to these guys!
2014-01-29 23:46:26 -08:00
Alex Crichton
8cd935f52a Upgrade LLVM
This upgrade brings commit by @eddyb to help optimizations of virtual calls in
a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a
commit by @c-a to *greatly* improve the runtime of the optimization passes
(https://github.com/rust-lang/llvm/pull/3).

Nice work to these guys!
2014-01-29 23:43:39 -08:00
bors
056363ff36 auto merge of #11839 : typelist/rust/issue3008, r=huonw
It was possible to trigger a stack overflow in rustc because the routine used to verify enum representability,
type_structurally_contains, would recurse on inner types until hitting the original type. The overflow condition was when a different structurally recursive type (enum or struct) was contained in the type being checked.

I suspect my solution isn't as efficient as it could be. I pondered adding a cache of previously-seen types to avoid duplicating work (if enums A and B both contain type C, my code goes through C twice), but I didn't want to do anything that may not be necessary.

I'm a new contributor, so please pay particular attention to any unidiomatic code, misuse of terminology, bad naming of tests, or similar horribleness :)

Updated to verify struct representability as well.

Fixes #3008.
Fixes #3779.
2014-01-29 22:21:29 -08:00
Johannes Muenzel
8d097b3bfb Consider types that contain fixed-length-zero vectors of themselves as non-representable until #11924 is resolved 2014-01-30 00:31:12 -05:00
bors
3cb72a3655 auto merge of #11672 : bjz/rust/remove-times, r=brson
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal (which I liked) was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-29 20:06:36 -08:00
Brendan Zabarauskas
729060dbb9 Remove Times trait
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-30 14:52:25 +11:00
Johannes Muenzel
7a931574e3 Check enum and struct representability properly (issues #3008 and #3779) 2014-01-29 20:33:51 -05:00
Daniel Micay
e532e8d55d remove a layer of indirection from most intrinsics 2014-01-29 18:48:34 -05:00
bors
f84b7291e7 auto merge of #11776 : FlaPer87/rust/issue-11681-static-lifetime, r=nikomatsakis
Closes #11681
Closes #11854
2014-01-29 15:01:43 -08:00
Flavio Percoco
cb5d7236f1 Fixes temporary lifetime computation for static items
closes: #11854
2014-01-29 22:39:33 +01:00
bors
1e23c5c051 auto merge of #11879 : thestinger/rust/frame-pointer, r=alexcrichton
This is still used for Rust code (`Options.NoFramePointerElim = true`).
2014-01-29 13:36:40 -08:00
Daniel Micay
cb263e875e enable fp-elim when debug info is disabled
This can almost be fully disabled, as it no longer breaks retrieving a
backtrace on OS X as verified by @alexcrichton. However, it still
breaks retrieving the values of parameters. This should be fixable in
the future via a proper location list...

Closes #7477
2014-01-29 16:35:05 -05:00
Daniel Micay
383e3fd13b use a more efficient vtable representation
[TyDesc, ... methods] -> [destructor, ... methods]
2014-01-29 16:31:46 -05:00
bors
c3ae182d5c auto merge of #11754 : alexcrichton/rust/unused-result, r=brson
The general consensus is that we want to move away from conditions for I/O, and I propose a two-step plan for doing so:

1. Warn about unused `Result` types. When all of I/O returns `Result`, it will require you inspect the return value for an error *only if* you have a result you want to look at. By default, for things like `write` returning `Result<(), Error>`, these will all go silently ignored. This lint will prevent blind ignorance of these return values, letting you know that there's something you should do about them.

2. Implement a `try!` macro:

```
macro_rules! try( ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) }) )
```

With these two tools combined, I feel that we get almost all the benefits of conditions. The first step (the lint) is a sanity check that you're not ignoring return values at callsites. The second step is to provide a convenience method of returning early out of a sequence of computations. After thinking about this for awhile, I don't think that we need the so-called "do-notation" in the compiler itself because I think it's just *too* specialized. Additionally, the `try!` macro is super lightweight, easy to understand, and works almost everywhere. As soon as you want to do something more fancy, my answer is "use match".

Basically, with these two tools in action, I would be comfortable removing conditions. What do others think about this strategy?

----

This PR specifically implements the `unused_result` lint. I actually added two lints, `unused_result` and `unused_must_use`, and the first commit has the rationale for why `unused_result` is turned off by default.
2014-01-29 09:46:34 -08:00
bors
e1580f6d09 auto merge of #11868 : bytbox/rust/remove-do, r=alexcrichton
Fixes #10815.
2014-01-29 08:21:38 -08:00
Daniel Micay
50bee30459 stop making visit glue for closures and traits 2014-01-29 10:41:39 -05:00
Seo Sanghyeon
5f68142d0e Fix SIMD bit shifts 2014-01-30 00:28:29 +09:00
bors
87004db113 auto merge of #11867 : dmanescu/rust/8784-arena-glob, r=huonw
In line with the dissolution of libextra - #8784 - this moves arena and glob into
their own respective modules. Updates .gitignore with the entries
doc/{arena,glob} in accordance.
2014-01-29 06:26:38 -08:00
Scott Lawrence
a6867e259b Removing support for the do syntax from libsyntax and librustc.
Fixes #10815.
2014-01-29 09:15:42 -05:00
Scott Lawrence
25e7e7f807 Removing do keyword from libstd and librustc 2014-01-29 09:15:41 -05:00
Flavio Percoco
279fe0fa76 Treat unary struct and enum variants as rvalues
Closes #11681
2014-01-29 14:15:24 +01:00
Alex Crichton
8a1b4dc9da Generate rlibs by default (instead of dylibs)
Closes #11253
2014-01-28 23:36:31 -08:00
Jason Fager
9b1865a7fa Add a limited prim type lookup for safer const expr evaluation 2014-01-29 00:05:11 -05:00
David Manescu
4d0d3da9e4 extra: move arena to libarena
In line with the dissolution of libextra - #8784 - moves arena to its own library libarena.
Changes based on PR #11787. Updates .gitignore to ignore doc/arena.
2014-01-29 13:54:38 +11:00
Alex Crichton
9896beb5b5 Implement an unused_result lint
I attempted to implement the lint in two steps. My first attempt was a
default-warn lint about *all* unused results. While this attempt did indeed find
many possible bugs, I felt that the false-positive rate was too high to be
turned on by default for all of Rust.

My second attempt was to make unused-result a default-allow lint, but allow
certain types to opt-in to the notion of "you must use this". For example, the
Result type is now flagged with #[must_use]. This lint about "must use" types is
warn by default (it's different from unused-result).

The unused_must_use lint had a 100% hit rate in the compiler, but there's not
that many places that return Result right now. I believe that this lint is a
crucial step towards moving away from conditions for I/O (because all I/O will
return Result by default). I'm worried that this lint is a little too specific
to Result itself, but I believe that the false positive rate for the
unused_result lint is too high to make it useful when turned on by default.
2014-01-28 15:54:47 -08:00
bors
b3d10f4383 auto merge of #11864 : comex/rust/11352, r=alexcrichton
Set "Dwarf Version" to 2 on OS X to avoid toolchain incompatibility, and
set "Debug Info Version" to prevent debug info from being stripped from
bitcode.

Fixes #11352.
2014-01-28 05:11:28 -08:00
bors
e90a8c4a35 auto merge of #11851 : pnkfelix/rust/fsk-fix-issue-10031, r=alexcrichton
Fix #10031.
2014-01-28 02:01:27 -08:00
bors
1ac9bf65b6 auto merge of #11738 : dmanescu/rust/11721, r=alexcrichton
Fixes #11721
2014-01-27 21:46:33 -08:00
comex
ea7b20d8f2 Add appropriate LLVM module flags for debug info.
Set "Dwarf Version" to 2 on OS X to avoid toolchain incompatibility, and
set "Debug Info Version" to prevent debug info from being stripped from
bitcode.

Fixes #11352.
2014-01-28 00:05:33 -05:00
bors
d21b18306c auto merge of #11826 : huonw/rust/7621-deriving-errors, r=alexcrichton
cc #7621.

See the commit message. I'm not sure if we should merge this now, or wait until we can write `Clone::clone(x)` which will directly solve the above issue with perfect error messages.
2014-01-27 20:26:35 -08:00