Commit Graph

2158 Commits

Author SHA1 Message Date
Alex Crichton
a1ffb06ac8 Use the correct logging crate while monomorphing
This makes sure that the top-level crate name is correct when emitting log
statements for a monomorphized function in another crate. This happens by
tracing the monomorphized ID back to the external source and then using that
crate index to get the name of the crate.

Closes #3046
2013-10-03 09:16:31 -07:00
Alex Crichton
1b80558be3 rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Daniel Micay
ab0a884a73 fix dropping non-primitive immediates
Closes #9446
2013-10-01 00:38:37 -04:00
Daniel Micay
11b7109b7b rm only use of type_is_immediate outside of trans 2013-09-30 18:16:35 -04:00
bors
5011bbfbb6 auto merge of #9630 : blake2-ppc/rust/de-at-smaller, r=huonw
This is mostly an incremental change, picking off some uses of
@- or @mut-pointers that can be replaced by references.

Almost all of the builder functions in trans::build are updated,
mostly using `&Block` arguments instead of `@mut Block`.
2013-09-30 10:41:20 -07:00
blake2-ppc
f4d8d8c122 trans::build: Change @mut Block to &Block or &mut Block
Use &mut Block and &Block references where possible in the builder
functions in trans::build.

@mut Block remains in a few functions where I could not (not yet at
least) track down the runtime borrowck failures.
2013-09-30 19:37:22 +02:00
blake2-ppc
b88517ec93 trans: Change @ast::Pat and @mut CrateContext in a few places
Use borrowed references in a few locations that were encountered when
working on other changes.
2013-09-30 19:37:17 +02:00
blake2-ppc
948b5ab87a trans: Change @ast::Expr -> &ast::Expr where possible 2013-09-30 19:37:17 +02:00
bors
ca2d5965d1 auto merge of #9614 : blake2-ppc/rust/lang-item-iter, r=alexcrichton
Cleanup in middle::lang_items

Use static string keys in the lang item hashmap, and convert
the traversal function to be an iterator.
2013-09-30 01:56:23 -07:00
blake2-ppc
abcca1c7d1 rustc: Convert lang_item to use an iterator 2013-09-30 05:13:04 +02:00
blake2-ppc
8e69c05b7c rustc: Convert lang_items hashmap to use &'static str keys 2013-09-30 05:13:04 +02:00
Alex Crichton
7b18976f08 Remove all usage of @ast::Crate 2013-09-29 16:21:25 -07:00
Alex Crichton
22ef7e72f4 Require &Crate instead of @Crate
This help enable some later refactorings.
2013-09-29 16:21:25 -07:00
bors
c635fba748 auto merge of #9583 : blake2-ppc/rust/connect-vec, r=huonw
std::vec: Sane implementations for connect_vec and concat_vec

Avoid unnecessary copying of subvectors, and calculate the needed space
beforehand. These implementations are simple but better than the
previous.

Also only implement it once, for all `Vector<T>` using:

    impl<'self, T: Clone, V: Vector<T>> VectorVector<T> for &'self [V]

Closes #9581
2013-09-28 07:31:02 -07:00
blake2-ppc
3709aa78d8 std::vec: Remove functions concat, connect
std::vec::{concat, connect, concat_slices, connect_slices} are replaced
by the already existing trait methods .concat_vec() and .connect_vec().
2013-09-28 05:56:49 +02:00
bors
6828d2e018 auto merge of #9556 : alexcrichton/rust/less-at-mut, r=luqmana
Instead use &mut everywhere as much as possible and then reorganize lots of code
to get past the borrow checker.
2013-09-27 17:56:06 -07:00
bors
10e7f12daf auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger
The 0.8 release was cut, down with printf!
2013-09-27 08:21:23 -07:00
bors
01313a131b auto merge of #9548 : thestinger/rust/internal, r=alexcrichton
Closes #9494
2013-09-27 06:21:22 -07:00
bors
ae8a2ff379 auto merge of #9538 : thestinger/rust/type_use, r=pcwalton
This is broken, and results in poor performance due to the undefined
behaviour in the LLVM IR. LLVM's `mergefunc` is a *much* better way of
doing this since it merges based on the equality of the bytecode.

For example, consider `std::repr`. It generates different code per
type, but is not included in the type bounds of generics.

The `mergefunc` pass works for most of our code but currently hits an
assert on libstd. It is receiving attention upstream so it will be
ready soon, but I don't think removing this broken code should wait any
longer. I've opened #9536 about enabling it by default.

Closes #8651
Closes #3547
Closes #2537
Closes #6971
Closes #9222
2013-09-27 03:31:13 -07:00
bors
afbc242a20 auto merge of #9527 : bmaxa/rust/master, r=alexcrichton
that is, if super trait had more methods, tnen subtrait, compiling would fail. I simply forgot to update
variable name. Updated test case , too.
2013-09-27 01:36:15 -07:00
Erick Tryzelaar
4834661c66 std and rustc: Convert users of c_str to use .with_c_str 2013-09-26 22:20:39 -07:00
Alex Crichton
5fe09563ac Remove @mut Resolver
Instead use &mut everywhere as much as possible and then reorganize lots of code
to get past the borrow checker.
2013-09-26 20:12:55 -07:00
Alex Crichton
409182de6d Update the compiler to not use printf/printfln 2013-09-26 17:05:59 -07:00
Daniel Micay
2aadd3652d mark globals as internal when not building a library
Closes #9494
2013-09-26 19:21:22 -04:00
Daniel Micay
c3e4e06841 remove type_use
This is broken, and results in poor performance due to the undefined
behaviour in the LLVM IR. LLVM's `mergefunc` is a *much* better way of
doing this since it merges based on the equality of the bytecode.

For example, consider `std::repr`. It generates different code per
type, but is not included in the type bounds of generics.

The `mergefunc` pass works for most of our code but currently hits an
assert on libstd. It is receiving attention upstream so it will be
ready soon, but I don't think removing this broken code should wait any
longer. I've opened #9536 about enabling it by default.

Closes #8651
Closes #3547
Closes #2537
Closes #6971
Closes #9222
2013-09-26 17:27:23 -04:00
Alex Crichton
daee1b4d5c Ensure that skipped items aren't encoded
If an item is skipped due to it being unreachable or for some optimization, then
it shouldn't be encoded into the metadata (because it wasn't present in the
first place).
2013-09-26 13:54:50 -07:00
Branimir
a4b7474461 Fix ICE caused by my previous patch, that is, if super trait had more
methods tnan subtrait, compiling would fail. I simply forgot to update
variable name. Updated test case , too.
2013-09-26 16:59:54 +02:00
bors
a8a69ec15d auto merge of #9464 : bmaxa/rust/master, r=cmr
I have tried this fix and it seems to work either with single or multiple trait inheritance.

trait Base:Base2 + Base3{
fn foo(&self);
}

trait Base2 {
fn baz(&self);
}

trait Base3{
fn root(&self);
}

trait Super: Base{
fn bar(&self);
}

struct X;

impl Base for X {
fn foo(&self) {
println("base foo");
}

}
impl Base2 for X {
fn baz(&self) {
println("base2 baz");
}

}
impl Base3 for X {
fn root(&self) {
println("base3 root");
}

}
impl Super for X {
fn bar(&self) {
println("super bar");
}
}

fn main() {
let n = X;
let s = &n as &Super;
s.bar();
s.foo(); // super bar
s.baz();
s.root();
}

bmaxa@maxa:~/examples/rust$ rustc error.rs
bmaxa@maxa:~/examples/rust$ ./error 
super bar
base foo
base2 baz
base3 root
2013-09-26 02:56:03 -07:00
Branimir
56d415aa60 fix for issue #9394
This solves problem of incorrect indexing into vtable
    when method from super trait was called through pointer
    to derived trait.
    Problem was that offset of super trait vtables
    was not calculated at all.
    Now it works, correct offset is calculated by
    traversing all super traits up to super trait
    where method belongs. That is how it is
    intended to work.
2013-09-26 11:14:18 +02:00
Alex Crichton
5c6f8a976f rustdoc: Linkify all reexports.
This way each component of a reexport path is click-able to the destination that
it's referencing.
2013-09-25 14:27:42 -07:00
Alex Crichton
3585c64d09 rustdoc: Change all code-blocks with a script
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g'
    find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g'
    find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25 14:27:42 -07:00
bors
5375cf8718 auto merge of #9491 : thestinger/rust/noreturn, r=huonw
Closes #9317
2013-09-25 07:25:56 -07:00
bors
797a373cd1 auto merge of #9492 : pnkfelix/rust/fsk-syntax-visit-refactor-remainder, r=huonw
r? anyone

Part of #7081.

Removed many unnecessary context arguments, turning them into visitors.  Removed some @allocation.

If this lands, then I think the only thing left that is unaddressed are:
 * the various lint visitors, and
 * middle/privacy.rs, which has `impl<'self> Visitor<&'self method_map> for PrivacyVisitor`
2013-09-25 06:10:57 -07:00
Felix S. Klock II
37481641b1 Fold env into CheckItemRecursionVisitor. 2013-09-25 11:01:43 +02:00
Felix S. Klock II
1ce1aae282 Fold ErrorCheckVisitor into Liveness. Removed some @allocation. 2013-09-25 11:01:09 +02:00
Felix S. Klock II
ffc9209471 Fold KindAnalysisVisitor into the Context. Removed unused current_item state. 2013-09-25 11:00:36 +02:00
Felix S. Klock II
339027ec15 Move unchanging portions of Context over to the Visitor. 2013-09-25 10:59:56 +02:00
Felix S. Klock II
bc13365007 Move unchanging portions of context over to the Visitor. 2013-09-25 10:59:31 +02:00
Felix S. Klock II
9d0727736b Fold context into CalleeTranslationVisitor. 2013-09-25 10:59:06 +02:00
Felix S. Klock II
2ceebf1070 Fold context into TransItemVisitor. 2013-09-25 10:58:40 +02:00
Felix S. Klock II
411dce85ea Fold type_use.rs Context into its Visitor. 2013-09-25 10:55:50 +02:00
Daniel Micay
e76bfae7eb add noreturn attribute to functions returning !
Closes #9317
2013-09-25 04:45:29 -04:00
bors
4531184614 auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwalton
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-25 00:55:53 -07:00
bors
d7bb40c50c auto merge of #9470 : luqmana/rust/bba, r=brson
#8431

~~@brson: do we need to bump up the cratemap version for this change?~~ Tis a no.
2013-09-24 20:25:58 -07:00
Luqman Aden
90e009f9b6 Remove the annihilate function from the crate map. Fixes #8431 2013-09-24 20:34:11 -04:00
Daniel Micay
5867bbd794 mark functions internal if not building a library
the entry point is wrapped with what should be the only public function
2013-09-24 18:50:28 -04:00
Alex Crichton
10a583ce1a Correctly encode item visibility in metadata
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-24 09:57:25 -07:00
bors
7535479633 auto merge of #9463 : pnkfelix/rust/fsk-syntax-visit-refactor-rest-of-typeck, r=huonw
r? anyone

Also got rid of a bit of `@mut` allocation.  (Though not the monster that is `@mut FnCtxt`; that case is documented already on #7081; if we attack it, it will probably be its own ticket, not part of #7081.)
2013-09-24 08:26:04 -07:00
Felix S. Klock II
0e95c3434b Part of #7081: Fold remainder of typeck's visit env into their visitor structs. 2013-09-24 14:34:51 +02:00
bors
c7e672602e auto merge of #9453 : pnkfelix/rust/fsk-further-syntax-visit-refactors, r=alexcrichton
r? anyone.

Part of #7081.

More refactorings of the syntax::visit::Visitor implementations, folding so-called "environments" into the visitor impl when the latter was previously a trivial unit struct.

As usual, this refactoring only applies when the environments are not actually carrying state that is meant to be pushed and popped as we traverse the expression.  (For an example where the environment *isn't* just passed through, see the `visit_fn` in `liveness.rs`.)

Got rid of a bit of @-allocation in borrowck.

Both cases should be pure-refactorings.
2013-09-24 02:26:06 -07:00