Commit Graph

72 Commits

Author SHA1 Message Date
Eduard Burtescu
f4473a4664 rustc_trans: promote constant rvalues in functions as an optimization. 2015-02-16 17:13:47 +02:00
GuillaumeGomez
b0097783b9 librustc_trans has been updated 2015-02-06 12:01:57 +01:00
Alex Crichton
7335c7dd63 rollup merge of #21830: japaric/for-cleanup
Conflicts:
	src/librustc/metadata/filesearch.rs
	src/librustc_back/target/mod.rs
	src/libstd/os.rs
	src/libstd/sys/windows/os.rs
	src/libsyntax/ext/tt/macro_parser.rs
	src/libsyntax/print/pprust.rs
	src/test/compile-fail/issue-2149.rs
2015-02-02 11:01:12 -08:00
Alex Crichton
04213ebd98 rollup merge of #21818: dotdash/llvm_up 2015-02-02 10:58:15 -08:00
Jorge Aparicio
d5d7e6565a for x in xs.iter() -> for x in &xs 2015-02-02 13:40:18 -05:00
Björn Steinbrink
602e508db0 Update LLVM to rust-llvm-2015-01-30 2015-02-01 20:00:35 +01:00
Niko Matsakis
bc41cc0ec9 Make unboxed_closure_kind return Option to allow for the possibility that its value is not yet known. 2015-02-01 06:13:05 -05:00
Niko Matsakis
2f29cdeb4b Remove the capture mode map and just store the capture mode for individual variables.
Also add test. Fixes #16749.
2015-01-30 05:56:39 -05:00
Jorge Aparicio
788181d405 s/Show/Debug/g 2015-01-29 07:49:02 -05:00
Eduard Burtescu
11ef6f1349 Remove "unboxed" attribute in code referring to new closures. 2015-01-26 04:15:09 +02:00
Alex Crichton
f4df69a40a rollup merge of #20642: michaelwoerister/sane-source-locations-pt1
Conflicts:
	src/librustc_trans/trans/debuginfo.rs
2015-01-21 11:50:34 -08:00
Alex Crichton
0c981875e4 rollup merge of #21340: pshc/libsyntax-no-more-ints
Collaboration with @rylev!

I didn't change `int` in the [quasi-quoter](99ae1a30f3/src/libsyntax/ext/quote.rs (L328)), because I'm not sure if there will be adverse effects.

Addresses #21095.
2015-01-21 09:13:51 -08:00
Michael Woerister
a55ef3a032 debuginfo: Make debuginfo source location assignment more stable (Pt. 1)
So far, the source location an LLVM instruction was linked to was controlled by
`debuginfo::set_source_location()` and `debuginfo::clear_source_location()`.
This interface mimicked how LLVM's `IRBuilder` handles debug location
assignment. While this interface has some theoretical performance benefits, it
also makes things terribly unstable: One sets some quasi-global state and then
hopes that it is still correct when a given instruction is emitted---an
assumption that has been proven to not hold a bit too often.

This patch requires the debug source location to be passed to the actual
instruction emitting function. This makes source location assignment explicit
and will prevent future changes to `trans` from accidentally breaking things in
the majority of cases.

This patch does not yet implement the new principle for all instruction kinds
but the stepping experience should have improved significantly nonetheless
already.
2015-01-21 10:48:10 +01:00
Alex Crichton
3121c04043 Fix typedef/module name conflicts in the compiler 2015-01-18 18:26:34 -08:00
Paul Collier
d5c83652b3 libsyntax: rename functions from uint to usize 2015-01-17 20:47:30 -08:00
Niko Matsakis
2868404fca Normalize associated types in the type_is_newtype_immediate pass. Fixes #21010. 2015-01-14 16:35:14 -05:00
Björn Steinbrink
6f1b06eb65 Pass small fixed-size arrays as immediates
Currently even small fixed-size arrays are passed as indirect
parameters, which seems to be just an oversight. Let's handle them the
same as structs of the same size, passing them as immediate values.
2015-01-11 01:44:03 +01:00
Björn Steinbrink
2100b10c4c Treat struct(T) the same as struct S { x: T } WRT being immediate args
Currently we pass a `struct S(u64)` as an immediate value on i686, but a
`struct S { x: u64 }` is passed indirectly. This seems pretty wrong,
as they both have the same underlying LLVM type `{ i64 }`, no sense in
treating them differently.
2015-01-09 17:40:13 +01:00
Björn Steinbrink
114d2bdad1 Restore indentation in common.rs
Most of the file lost one level of indentation in a recent rollup. Most
likely an accident during merge conflict resolution.
2015-01-08 13:14:07 +01:00
Alex Crichton
11e265c2e0 rollup merge of #20707: nikomatsakis/issue-20582 2015-01-07 17:44:24 -08:00
Alex Crichton
bcebec5084 rollup merge of #20706: nikomatsakis/assoc-types-projections-in-structs-issue-20470
Conflicts:
	src/librustc_trans/trans/expr.rs
2015-01-07 17:35:00 -08:00
Niko Matsakis
9e4e8823c7 Use ty::type_is_sized() so that we handle projection types properly. 2015-01-07 20:26:19 -05:00
Jorge Aparicio
517f1cc63c use slicing sugar 2015-01-07 17:35:56 -05:00
Niko Matsakis
cf136cd350 Use the erase_regions helper within trans in deference to
`ty_fold::erase_regions`; also erase regions whenever we normalize
associated types.
2015-01-07 14:07:58 -05:00
Niko Matsakis
bdc1bfd8f1 Rename common::normalize to common::erase_regions 2015-01-07 14:07:58 -05:00
Alex Crichton
0b3b957554 rollup merge of #20645: nikomatsakis/rustbook-ice
Conflicts:
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/ty.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/expr.rs
	src/librustc_trans/trans/foreign.rs
	src/librustc_typeck/check/mod.rs
2015-01-06 15:29:09 -08:00
Alex Crichton
5c3ddcb15d rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts:
	src/compiletest/runtest.rs
	src/libcore/fmt/mod.rs
	src/libfmt_macros/lib.rs
	src/libregex/parse.rs
	src/librustc/middle/cfg/construct.rs
	src/librustc/middle/dataflow.rs
	src/librustc/middle/infer/higher_ranked/mod.rs
	src/librustc/middle/ty.rs
	src/librustc_back/archive.rs
	src/librustc_borrowck/borrowck/fragments.rs
	src/librustc_borrowck/borrowck/gather_loans/mod.rs
	src/librustc_resolve/lib.rs
	src/librustc_trans/back/link.rs
	src/librustc_trans/save/mod.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/callee.rs
	src/librustc_trans/trans/common.rs
	src/librustc_trans/trans/consts.rs
	src/librustc_trans/trans/controlflow.rs
	src/librustc_trans/trans/debuginfo.rs
	src/librustc_trans/trans/expr.rs
	src/librustc_trans/trans/monomorphize.rs
	src/librustc_typeck/astconv.rs
	src/librustc_typeck/check/method/mod.rs
	src/librustc_typeck/check/mod.rs
	src/librustc_typeck/check/regionck.rs
	src/librustc_typeck/collect.rs
	src/libsyntax/ext/format.rs
	src/libsyntax/ext/source_util.rs
	src/libsyntax/ext/tt/transcribe.rs
	src/libsyntax/parse/mod.rs
	src/libsyntax/parse/token.rs
	src/test/run-pass/issue-8898.rs
2015-01-06 15:22:24 -08:00
Sean McArthur
44440e5c18 core: split into fmt::Show and fmt::String
fmt::Show is for debugging, and can and should be implemented for
all public types. This trait is used with `{:?}` syntax. There still
exists #[derive(Show)].

fmt::String is for types that faithfully be represented as a String.
Because of this, there is no way to derive fmt::String, all
implementations must be purposeful. It is used by the default format
syntax, `{}`.

This will break most instances of `{}`, since that now requires the type
to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the
correct fix. Types that were being printed specifically for users should
receive a fmt::String implementation to fix this.

Part of #20013

[breaking-change]
2015-01-06 14:49:42 -08:00
Nick Cameron
f7ff37e4c5 Replace full slice notation with index calls 2015-01-07 10:46:33 +13:00
Niko Matsakis
2486d93e5b Fix ICE that @steveklabnik encountered in rust-ice. The problems turned out to be that were being very loose with bound regions in trans (we were basically just ignoring and flattening binders). Since binders are significant to subtyping and hence to trait selection, this can cause a lot of problems. So this patch makes us treat them more strictly -- for example, we propagate binders, and avoid skipping past the Binder by writing foo.0.
Fixes #20644.
2015-01-06 13:42:42 -05:00
Alex Crichton
ec7a50d20d std: Redesign c_str and c_vec
This commit is an implementation of [RFC 494][rfc] which removes the entire
`std::c_vec` module and redesigns the `std::c_str` module as `std::ffi`.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0494-c_str-and-c_vec-stability.md

The interface of the new `CString` is outlined in the linked RFC, the primary
changes being:

* The `ToCStr` trait is gone, meaning the `with_c_str` and `to_c_str` methods
  are now gone. These two methods are replaced with a `CString::from_slice`
  method.
* The `CString` type is now just a wrapper around `Vec<u8>` with a static
  guarantee that there is a trailing nul byte with no internal nul bytes. This
  means that `CString` now implements `Deref<Target = [c_char]>`, which is where
  it gains most of its methods from. A few helper methods are added to acquire a
  slice of `u8` instead of `c_char`, as well as including a slice with the
  trailing nul byte if necessary.
* All usage of non-owned `CString` values is now done via two functions inside
  of `std::ffi`, called `c_str_to_bytes` and `c_str_to_bytes_with_nul`. These
  functions are now the one method used to convert a `*const c_char` to a Rust
  slice of `u8`.

Many more details, including newly deprecated methods, can be found linked in
the RFC. This is a:

[breaking-change]
Closes #20444
2015-01-05 08:00:13 -08:00
Eduard Burtescu
9a90d436f6 rustc: allow paths in constants to refer to polymorphic items. 2015-01-04 18:47:58 +02:00
Jorge Aparicio
351409a622 sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
Jorge Aparicio
56dcbd17fd sed -i -s 's/\bmod,/self,/g' **/*.rs 2015-01-03 22:42:21 -05:00
Niko Matsakis
7474be0660 Make ty::ParameterEnvironment, not ty::ctxt, implement Typer and
`UnboxedClosureTyper`. This requires adding a `tcx` field to
`ParameterEnvironment` but generally simplifies everything since we
only need to pass along an `UnboxedClosureTyper` or `Typer`.
2015-01-03 07:01:21 -05:00
Niko Matsakis
83ef3042de Modify type_known_to_meet_builtin_bound so that it doesn't suppress overflow,
which should always result in an error.

NB. Some of the hunks in this commit rely on a later commit which adds
`tcx` into `param_env` and modifies `ParameterEnvironment` to
implement `Typer`.
2015-01-03 07:01:21 -05:00
Niko Matsakis
1e3214ba33 Normalize the associated types in closure and closure upvar types. 2015-01-01 18:48:26 -05:00
Niko Matsakis
78f848cde5 Refactor the Typer interface to separate out UnboxedClosureTyper methods, which are
the only things that trait selection needs.
2015-01-01 18:48:26 -05:00
Niko Matsakis
0a2d531b94 Teach trans to drain fulfillment context. japaric encountered problems
due to this but we were not able to isolate a smaller test case.
2014-12-31 14:42:06 -05:00
Niko Matsakis
6cb425d964 Rework normalization so that it works recursively, since the types extracted from an impl are potentially in need of normalization. This also lays groundwork for further cleanup in other areas by disconnecting normalization from the fulfillment context. 2014-12-31 12:50:30 -05:00
Niko Matsakis
b7c6e317b0 Make projected types select out of the trait bounds. 2014-12-30 09:36:22 -05:00
Niko Matsakis
4404592f36 Implement associated type projection and normalization. 2014-12-30 09:36:21 -05:00
Niko Matsakis
4946e1a463 Move the TypeContents-based "Sized" queries into trans, where the full
types are always known and hence the ParameterEnvironment is not
necessary. For other `Sized` queries, use the trait infrastructure
just like `Copy`.
2014-12-30 09:32:42 -05:00
Niko Matsakis
c08d004545 Refactor various queries out of ty and into trans/common 2014-12-30 09:32:42 -05:00
Alex Crichton
806cb35f4d rollup merge of #20289: nick29581/shadowing
r? eddyb
2014-12-29 16:36:49 -08:00
Huon Wilson
4f2b0f032a Store Substs in an arena in the tcx.
This current inflates memory use more than 3 times.
2014-12-29 23:55:24 +11:00
Nick Cameron
9c1567e622 Fallout from glob shadowing 2014-12-29 18:20:38 +13:00
Luqman Aden
e954fc4385 librustc: Traverse arbitrarily deep for nullable enum opt. 2014-12-28 19:40:46 -05:00
Niko Matsakis
4856456dd7 Move mem-categorization more things to use TYPER for the method origin 2014-12-25 07:04:07 -05:00
Niko Matsakis
a583ba2fa0 Remove McResult from the mem-categorization interface. 2014-12-25 07:04:07 -05:00