Commit Graph

311 Commits

Author SHA1 Message Date
Tamir Duberstein 0270189057 Reference the correct issue
The problem here is that this test doesn't even compile for Android.

See #24958.
2015-04-29 14:34:44 -07:00
Tamir Duberstein 54de911f35 #10381: Warnings 2015-04-28 17:51:43 -07:00
Tamir Duberstein 71bc70ea1b Remove references to `old_{path,io}` 2015-04-21 08:16:03 -07:00
Alex Crichton e053571df2 Test fixes and rebase conflicts, round 2 2015-04-14 17:40:37 -07:00
Alex Crichton 33fb5bb004 bench: Fix fallout in benchmarks 2015-04-14 10:14:19 -07:00
Michael Woerister 03f9269496 Add a name for tuple fields in debuginfo so that they can be accessed in debuggers. 2015-04-12 20:44:25 +02:00
Luke Gallagher 2a9e1011b1 Remove `ignore-tidy-linelength` from tests that no longer need it 2015-04-09 08:21:59 +10:00
Dave Huseby 5387189d5b fixing some tests and temporarily disabling others to get Bitrig build working 100% 2015-04-04 12:33:44 -07:00
Alex Crichton f92e7abefd rollup merge of #23860: nikomatsakis/copy-requires-clone
Conflicts:
	src/test/compile-fail/coherence-impls-copy.rs
2015-04-01 18:37:54 -07:00
Manish Goregaokar 02b38a2497 Rollup merge of #23066 - michaelwoerister:unreachable-if, r=pnkfelix
This PR solves #21559 by making sure that unreachable if-expressions are not further translated.

Could someone who knows their way around `trans` take a look at the changes in `controlflow.rs`? I'm not sure if any other code relies on any side-effects of translating unreachable things.

cc @nikomatsakis @nrc @eddyb
2015-04-02 00:40:38 +05:30
Niko Matsakis 890ed5c468 Fallout in tests 2015-04-01 11:22:39 -04:00
Vadim Petrochenkov 1accaa9f86 Fix some typos 2015-03-28 18:09:51 +03:00
Alex Crichton d3a4f362cb rollup merge of #23786: alexcrichton/less-quotes
Conflicts:
	src/test/auxiliary/static-function-pointer-aux.rs
	src/test/auxiliary/trait_default_method_xc_aux.rs
	src/test/run-pass/issue-4545.rs
2015-03-27 16:10:25 -07:00
Alex Crichton e77db16afb Fix fallout of removing quotes in crate names 2015-03-27 11:43:40 -07:00
Alex Crichton 28a6b16130 rollup merge of #23741: alexcrichton/remove-int-uint
Conflicts:
	src/librustc/middle/ty.rs
	src/librustc_trans/trans/adt.rs
	src/librustc_typeck/check/mod.rs
	src/libserialize/json.rs
	src/test/run-pass/spawn-fn.rs
2015-03-27 10:10:05 -07:00
Alex Crichton 43bfaa4a33 Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
2015-03-26 12:10:22 -07:00
bors 27901849e0 Auto merge of #23695 - sae-bom:mac-android-debuginfo, r=alexcrichton
1. when mac-android cross compile and make-check , make it use gdb instead of lldb so as to it passes debuginfo tests.
2. ignore some tests on aarch64
2015-03-25 21:29:50 +00:00
Sae-bom Kim c66a2b7393 Ignore some tests on aarch64 2015-03-25 18:17:33 +09:00
Nick Cameron 95602a759d Add trivial cast lints.
This permits all coercions to be performed in casts, but adds lints to warn in those cases.

Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.

[breaking change]

* Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
* The unused casts lint has gone.
* Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
- You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
- Casts do not influence inference of integer types. E.g., the following used to type check:

```
let x = 42;
let y = &x as *const u32;
```

Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:

```
let x: u32 = 42;
let y = &x as *const u32;
```
2015-03-25 10:03:57 +13:00
Alex Crichton c5c3de0cf4 Test fixes and rebase conflicts, round 3 2015-03-23 22:52:21 -07:00
Brian Anderson df290f127e Require feature attributes, and add them where necessary 2015-03-23 14:40:26 -07:00
Manish Goregaokar dcec88cca3 Re-bork whitespace for text file (fixup #23385) 2015-03-17 16:00:39 +05:30
Tamir Duberstein d51047ded0 Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
Manish Goregaokar 6354387e42 Rollup merge of #23310 - michaelwoerister:gdb-std-pp, r=alexcrichton
```rust
Rust:  let slice: &[i32] = &[0, 1, 2, 3];
GDB:   $1 = &[i32](len: 4) = {0, 1, 2, 3}

Rust:  let vec = vec![4, 5, 6, 7];
GDB:   $2 = Vec<u64>(len: 4, cap: 4) = {4, 5, 6, 7}

Rust:  let str_slice = \"IAMA string slice!\";
GDB:   $3 = \"IAMA string slice!\"

Rust:  let string = \"IAMA string!\".to_string();
GDB:   $4 = \"IAMA string!\"
```
Neat!
2015-03-13 18:11:13 +05:30
Michael Woerister 90fc28d0f2 debuginfo: Add GDB pretty printers for slices, Vec<>, and String. 2015-03-12 17:05:44 +01:00
Michael Woerister 07240d6026 debuginfo: Make LLDB pretty printer correctly handle zero-sized fields. 2015-03-12 12:18:15 +01:00
Manish Goregaokar d77fc9fefc Rollup merge of #23074 - michaelwoerister:constants-debug-locs, r=alexcrichton
With this PR in-place constants are handled correctly with respect to debug location assignment.
The PR also adds an (unrelated) test case for debug locations in `extern \"C\"` functions.

Fixes #22432
2015-03-06 09:01:23 +05:30
Michael Woerister 215d287982 debuginfo: Add test case for `extern "C"` functions. 2015-03-05 16:41:10 +01:00
Michael Woerister e316c662f8 debuginfo: Add `debuginfo::with_source_location_override()` function...
... and use it to fix a debug-location issue with constants.
2015-03-05 15:00:25 +01:00
Michael Woerister e05c2f80da trans: Add early-out when translating unreachable controlflow expressions. 2015-03-05 13:57:51 +01:00
Eduard Burtescu e64670888a Remove integer suffixes where the types in compiled code are identical. 2015-03-05 12:38:33 +05:30
Michael Woerister 2f8865556b Encode codemap and span information in crate metadata.
This allows to create proper debuginfo line information for items inlined from other crates (e.g. instantiations of generics).
Only the codemap's 'metadata' is stored in a crate's metadata. That is, just filename, line-beginnings, etc. but not the actual source code itself. We are thus missing the opportunity of making Rust the first "open-source-only" programming language out there. Pity.
2015-03-04 09:50:09 +01:00
Felix S. Klock II 0d5bcb14ad Switched to Box::new in many places.
Many of the modifications putting in `Box::new` calls also include a
pointer to Issue 22405, which tracks going back to `box <expr>` if
possible in the future.

(Still tried to use `Box<_>` where it sufficed; thus some tests still
have `box_syntax` enabled, as they use a mix of `box` and `Box::new`.)

Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-03-03 21:05:55 +01:00
Felix S. Klock II 270f0eef73 Add `: Box<_>` or `::Box<_>` type annotations to various places.
This is the kind of change that one is expected to need to make to
accommodate overloaded-`box`.

----

Note that this is not *all* of the changes necessary to accommodate
Issue 22181.  It is merely the subset of those cases where there was
already a let-binding in place that made it easy to add the necesasry
type ascription.

(For unnamed intermediate `Box` values, one must go down a different
route; `Box::new` is the option that maximizes portability, but has
potential inefficiency depending on whether the call is inlined.)

----

There is one place worth note, `run-pass/coerce-match.rs`, where I
used an ugly form of `Box<_>` type ascription where I would have
preferred to use `Box::new` to accommodate overloaded-`box`.  I
deliberately did not use `Box::new` here, because that is already done
in coerce-match-calls.rs.

----

Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-03-03 20:29:01 +01:00
Alex Crichton 1506b34e0c rollup merge of #22286: nikomatsakis/variance-4b
Conflicts:
	src/librustc/middle/infer/combine.rs
	src/librustc_typeck/check/wf.rs
2015-02-18 15:52:01 -08:00
Niko Matsakis 872ce47955 Fallout: tests. As tests frequently elide things, lots of changes
here.  Some of this may have been poorly rebased, though I tried to be
careful and preserve the spirit of the test.
2015-02-18 10:25:28 -05:00
Niko Matsakis 362d713026 Fix remaining bench/debuginfo tests (and a few stragglers) 2015-02-18 09:11:02 -05:00
bors 6c065fc8cb Auto merge of #21774 - ejjeong:enable-test-for-android, r=alexcrichton
- Now "make check-stage2-T-aarch64-linux-android-H-x86_64-unknown-linux-gnu" works (#21773)
- Fix & enable debuginfo tests for android (#10381)
- Fix & enable more tests for android (both for arm/aarch64)
- Enable many already-pass tests on android (both for arm/aarch64)
2015-02-17 19:35:12 +00:00
Manish Goregaokar cdf0cb0a16 Rollup merge of #22360 - wg:master, r=alexcrichton 2015-02-17 06:23:36 +05:30
Eduard Burtescu b49f5281c2 tests: debuginfo: use `static mut` to avoid constant folding globals. 2015-02-16 17:13:48 +02:00
Will 42f5ac568a Fix tests that fail on FreeBSD 2015-02-15 17:18:55 +09:00
Felix S. Klock II edabfe2912 opt into box_patterns in debuginfo tests. 2015-02-11 11:47:14 +01:00
Eunji Jeong b1af8648a7 Enable test/debuginfo on android 2015-02-10 15:48:07 +09:00
Michael Woerister 93edb7c17b debuginfo: Fix problem with debug locations of constants in match patterns. 2015-02-06 21:24:06 +01:00
Jorge Aparicio 17bc7d8d5b cleanup: replace `as[_mut]_slice()` calls with deref coercions 2015-02-05 13:45:01 -05:00
Jorge Aparicio 571cc7f8e9 remove all kind annotations from closures 2015-02-04 20:06:08 -05:00
Aaron Turon 3e39f0bc0e Rename std::path to std::old_path
As part of [RFC 474](https://github.com/rust-lang/rfcs/pull/474), this
commit renames `std::path` to `std::old_path`, leaving the existing path
API in place to ease migration to the new one. Updating should be as
simple as adjusting imports, and the prelude still maps to the old path
APIs for now.

[breaking-change]
2015-02-03 14:34:42 -08:00
Jorge Aparicio fd702702ee `for x in xs.into_iter()` -> `for x in xs`
Also `for x in option.into_iter()` -> `if let Some(x) = option`
2015-02-02 13:40:18 -05:00
Jorge Aparicio d5d7e6565a `for x in xs.iter()` -> `for x in &xs` 2015-02-02 13:40:18 -05:00
Alex Crichton e8fd9d3d0b Merge remote-tracking branch 'origin/master' into rollup 2015-01-30 19:55:37 -08:00
Tobias Bucher 7f64fe4e27 Remove all `i` suffixes 2015-01-30 04:38:54 +01:00
Jorge Aparicio 7d661af9c8 `for x in range(a, b)` -> `for x in a..b`
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29 07:47:37 -05:00
Jorge Aparicio c300d681bd `range(a, b).foo()` -> `(a..b).foo()`
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
2015-01-29 07:46:44 -05:00
Manish Goregaokar c709ed2faf Merge remote-tracking branch 'origin/master' into rollup
Conflicts:
	src/libcollections/slice.rs
	src/libcore/nonzero.rs
	src/libcore/ops.rs
2015-01-28 23:31:03 +05:30
Brian Anderson 7122305053 Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	src/libcore/cell.rs
	src/librustc_driver/test.rs
	src/libstd/old_io/net/tcp.rs
	src/libstd/old_io/process.rs
2015-01-27 15:05:04 -08:00
Manish Goregaokar 51ff9e82ec Rollup merge of #21602 - japaric:derive-copy, r=alexcrichton 2015-01-27 22:24:02 +05:30
Alex Crichton 5d836cdf86 std: Rename Writer::write to Writer::write_all
In preparation for upcoming changes to the `Writer` trait (soon to be called
`Write`) this commit renames the current `write` method to `write_all` to match
the semantics of the upcoming `write_all` method. The `write` method will be
repurposed to return a `usize` indicating how much data was written which
differs from the current `write` semantics. In order to head off as much
unintended breakage as possible, the method is being deprecated now in favor of
a new name.

[breaking-change]
2015-01-26 16:01:58 -08:00
Alex Crichton 3a07f859b8 Fallout of io => old_io 2015-01-26 16:01:16 -08:00
Brian Anderson d179ba3b8e Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	src/libcore/cmp.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/result.rs
	src/libcore/str/mod.rs
	src/librustc/lint/builtin.rs
	src/librustc/lint/context.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/poison.rs
2015-01-25 22:14:06 -08:00
Jorge Aparicio bff462302b cleanup: s/impl Copy/#[derive(Copy)]/g 2015-01-25 11:20:38 -05:00
Brian Anderson 63fcbcf3ce Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	mk/tests.mk
	src/liballoc/arc.rs
	src/liballoc/boxed.rs
	src/liballoc/rc.rs
	src/libcollections/bit.rs
	src/libcollections/btree/map.rs
	src/libcollections/btree/set.rs
	src/libcollections/dlist.rs
	src/libcollections/ring_buf.rs
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/libcollections/vec_map.rs
	src/libcore/any.rs
	src/libcore/array.rs
	src/libcore/borrow.rs
	src/libcore/error.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/ops.rs
	src/libcore/result.rs
	src/libcore/slice.rs
	src/libcore/str/mod.rs
	src/libregex/lib.rs
	src/libregex/re.rs
	src/librustc/lint/builtin.rs
	src/libstd/collections/hash/map.rs
	src/libstd/collections/hash/set.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/mutex.rs
	src/libstd/sync/poison.rs
	src/libstd/sync/rwlock.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/test.rs
2015-01-25 01:20:55 -08:00
Michael Woerister 612ded78e3 debuginfo: Extend option-like-enum test case to contain nested discriminants. 2015-01-24 15:02:38 +01:00
Steve Klabnik 07fb31a099 Rollup merge of #21471 - michaelwoerister:associated-types, r=alexcrichton
This should fix issue #20797 (but I don't want to close it automatically).
As the actual fix is very small this would be a perfect candidate for a rollup.
2015-01-22 18:09:59 -05:00
Alex Crichton 90af72378d Make diagnostic ordering deterministic 2015-01-21 20:25:19 -08:00
Brian Anderson 7b73ec4698 Tie stability attributes to feature gates 2015-01-21 16:16:21 -08:00
Michael Woerister 3a44107f9e debuginfo: Fix issue with associated types and struct fields 2015-01-21 18:25:53 +01:00
Alex Crichton 953f294ea3 rustc: Remove deprecated flags
This commit removes a number of deprecated flags from the compiler:

* opt-level => -C opt-level
* debuginfo => -C debuginfo
* print-crate-name => --print crate-name
* print-file-name => --print file-names
* no-trans => -Z no-trans
* no-analysis => -Z no-analysis
* parse-only => -Z parse-only
* dep-info => --emit dep-info

This commit also moves the --pretty flag behind `-Z unstable-options` as the
pretty printer will likely not be stable for 1.0

cc #19051
2015-01-20 11:16:26 -08:00
Alex Crichton 6dc94f744e rollup merge of #21197: michaelwoerister/linestablesonly-forloop
Fixes #21067.
2015-01-15 14:12:06 -08:00
Michael Woerister 45c6423cbc debuginfo: Fix ICE when compiling for-loops with lines-tables-only. 2015-01-15 15:22:56 +01:00
Niko Matsakis 2479dfcbf7 Revert "rustc_trans: Fix type projection debuginfo" -- it potentially papers over a lack
of normalization that should have taken place.

This reverts commit f7745a9be3.
2015-01-14 16:35:14 -05:00
Erick Tryzelaar f7745a9be3 rustc_trans: Fix type projection debuginfo
Closes #20797
2015-01-11 21:39:03 -08:00
Brian Anderson 1f70acbf4c Improvements to feature staging
This gets rid of the 'experimental' level, removes the non-staged_api
case (i.e. stability levels for out-of-tree crates), and lets the
staged_api attributes use 'unstable' and 'deprecated' lints.

This makes the transition period to the full feature staging design
a bit nicer.
2015-01-08 03:07:23 -08:00
Alex Crichton 0dc48b47a8 Test fixes and rebase conflicts 2015-01-07 19:27:27 -08:00
Jorge Aparicio ed4bebda96 remove some `slicing_syntax` feature gates 2015-01-07 18:37:04 -05:00
Alex Crichton a64000820f More test fixes 2015-01-06 21:26:48 -08:00
Alex Crichton f358dbf1e7 rollup merge of #20557: cactorium/prettyprinters
As per https://github.com/rust-lang/rust/issues/20405. To be more precise, the changes just the processing of enums when the name is "RUST$ENCODED$ENUM$..." so it correctly parses when there is more than one number encoding the location of the field it's looking for to determine state of the enum
2015-01-06 15:24:52 -08:00
Alex Crichton 5f27b50080 rollup merge of #20609: cmr/mem 2015-01-06 15:07:48 -08:00
Nick Cameron 77ed497456 Tests 2015-01-07 10:49:00 +13:00
Corey Richardson 5a4ca31918 test fallout from isize/usize 2015-01-06 16:48:33 -05:00
Nick Cameron f7ff37e4c5 Replace full slice notation with index calls 2015-01-07 10:46:33 +13:00
Alex Crichton 7975fd9cee rollup merge of #20482: kmcallister/macro-reform
Conflicts:
	src/libflate/lib.rs
	src/libstd/lib.rs
	src/libstd/macros.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/show_span.rs
	src/test/auxiliary/macro_crate_test.rs
	src/test/compile-fail/lint-stability.rs
	src/test/run-pass/intrinsics-math.rs
	src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05 19:01:17 -08:00
Keegan McAllister c2e26972e3 Un-gate macro_rules 2015-01-05 18:21:14 -08:00
Jorge Aparicio ef726591f8 fix debuginfo tests 2015-01-05 17:22:17 -05:00
Kelvin Ly d33857208f Fixed tests 2015-01-05 15:28:19 -05:00
Kelvin Ly 87eebd17cd Fixed tests 2015-01-05 14:58:02 -05:00
Kelvin Ly 7e42338dc5 Added two tests for pretty printing optimized enums 2015-01-05 13:49:33 -05:00
Alex Crichton 4459b1dced rollup merge of #20341: nikomatsakis/impl-trait-for-trait-2
Conflicts:
	src/librustc/middle/traits/mod.rs
	src/libstd/io/mod.rs
	src/test/run-pass/builtin-superkinds-self-type.rs
2015-01-02 11:13:05 -08:00
Alex Crichton 1f2ead1629 Merge remote-tracking branch 'origin/master' into rollup
Conflicts:
	src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
2015-01-02 10:50:07 -08:00
Niko Matsakis 5b425c1b2f Fix fallout in tests. 2015-01-02 12:08:36 -05:00
Nick Cameron 30e149231c Use `derive` rather than `deriving` in tests 2015-01-02 23:05:22 +13:00
Michael Woerister 7a11b9aac4 debuginfo: Fix an ICE related to local variables in unreachable code. 2015-01-01 18:43:48 +01:00
Michael Woerister 91a0e18866 debuginfo: Add a rust-gdb shell script that will start GDB with Rust pretty printers enabled. 2014-12-30 17:26:13 +01:00
Michael Woerister 875a30c492 debuginfo: Add test case for destructured for-loop variable. 2014-12-23 11:07:32 +01:00
Michael Woerister 6f88258f1d debuginfo: Create debuginfo for for-loop variables again. 2014-12-23 10:45:16 +01:00
Alex Crichton c5aaa8cc05 Revert "debuginfo: Create debuginfo for for-loop variables again."
This reverts commit b048114718.
2014-12-22 08:25:44 -08:00
Alex Crichton f450695183 Revert "debuginfo: Add test case for destructured for-loop variable."
This reverts commit 87c5927b79.
2014-12-22 08:25:11 -08:00
Alex Crichton bc1d818b83 rollup merge of #20057: nick29581/array-syntax
This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.

Part of #19999

r? @nikomatsakis
2014-12-21 09:27:35 -08:00
Nick Cameron 2e86929a4a Allow use of `[_ ; n]` syntax for fixed length and repeating arrays.
This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.
2014-12-20 15:23:29 +13:00
Michael Woerister 87c5927b79 debuginfo: Add test case for destructured for-loop variable. 2014-12-19 14:46:42 +01:00
Michael Woerister b048114718 debuginfo: Create debuginfo for for-loop variables again. 2014-12-19 09:48:28 +01:00
Patrick Walton ddb2466f6a librustc: Always parse `macro!()`/`macro![]` as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
2014-12-18 12:09:07 -05:00
Niko Matsakis 5c3d398919 Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`) 2014-12-14 04:21:56 -05:00
Alex Crichton 2593070d57 rollup merge of #19581: luqmana/duc
Fixes #19575.
2014-12-09 09:24:41 -08:00
Niko Matsakis 096a28607f librustc: Make `Copy` opt-in.
This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.

A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.

For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.

This breaks code like:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

Change this code to:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    impl Copy for Point2D {}

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

This is the backwards-incompatible part of #13231.

Part of RFC #3.

[breaking-change]
2014-12-08 13:47:44 -05:00
Luqman Aden 8ebc1c9fd8 librustc: Fix debuginfo for captured variables in non-FnOnce unboxed closures. 2014-12-05 18:56:40 -05:00
Luqman Aden 89d0995373 gdb: Fix pretty printer for nullable-opt enums with fat pointers. 2014-12-02 18:28:43 -05:00
Luqman Aden 886ff4f3c3 lldb: Fix pretty printer for nullable-opt enums with fat pointers. 2014-12-02 17:33:52 -05:00
Michael Woerister 61a0a7f0a3 debuginfo: Fix multi-byte character related bug in cleanup scope handling.
Also see issue #18791.
2014-12-01 16:22:00 -08:00
Michael Woerister 251386c605 debuginfo: Make variables captured in unboxed closures available in debuginfo. 2014-11-27 16:38:17 +01:00
Simon Wollwage f950e3c495 removed struct_variant feature from tests 2014-11-20 00:56:50 +01:00
Steven Fackler 3dcd215740 Switch to purely namespaced enums
This breaks code that referred to variant names in the same namespace as
their enum. Reexport the variants in the old location or alter code to
refer to the new locations:

```
pub enum Foo {
    A,
    B
}

fn main() {
    let a = A;
}
```
=>
```
pub use self::Foo::{A, B};

pub enum Foo {
    A,
    B
}

fn main() {
    let a = A;
}
```
or
```
pub enum Foo {
    A,
    B
}

fn main() {
    let a = Foo::A;
}
```

[breaking-change]
2014-11-17 07:35:51 -08:00
Michael Woerister e06c338273 debuginfo: Enable some GDB tests on Windows. 2014-10-31 18:49:59 +01:00
Michael Woerister 54a5a2b365 debuginfo: Make GDB tests use line breakpoints like done in LLDB tests.
On some Windows versions of GDB this is more stable than setting breakpoints via function names.
2014-10-31 18:49:59 +01:00
Alex Crichton 00975e041d rollup merge of #18398 : aturon/lint-conventions-2
Conflicts:
	src/libcollections/slice.rs
	src/libcore/failure.rs
	src/libsyntax/parse/token.rs
	src/test/debuginfo/basic-types-mut-globals.rs
	src/test/debuginfo/simple-struct.rs
	src/test/debuginfo/trait-pointers.rs
2014-10-30 17:37:22 -07:00
Steve Klabnik 7828c3dd28 Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]
2014-10-29 11:43:07 -04:00
Aaron Turon e0ad0fcb95 Update code with new lint names 2014-10-28 08:54:21 -07:00
Michael Woerister 47e8cf7697 debuginfo: Gate all LLDB debuginfo tests on a minimum LLDB version being available 2014-10-22 10:47:45 +02:00
Jakub Wieczorek 17da4c761d Remove `virtual` struct tests 2014-10-11 19:42:26 +02:00
Keegan McAllister db3bd23467 Rename the no_split_stack attribute to no_stack_check
The old name is misleading as we haven't had segmented stacks in quite some
time. But we still recognize it, with a deprecation warning.
2014-10-09 14:24:36 -07:00
Michael Woerister 98a0f9166c debuginfo: Don't mark struct fields as artificial.
LLDB doesn't allow for reading 'artifical' fields (fields that are generated by the compiler). So do not mark, slice fields, enum discriminants, and GcBox value fields as artificial.
2014-10-08 11:52:06 +02:00
Nick Cameron 2d3823441f Put slicing syntax behind a feature gate.
[breaking-change]

If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-07 15:49:53 +13:00
Nick Cameron 59976942ea Use slice syntax instead of slice_to, etc. 2014-10-07 15:49:53 +13:00
Alex Crichton f96ee10e88 Test fixes from the rollup 2014-10-02 15:43:37 -07:00
Alex Crichton 7ae802f57b rollup merge of #17666 : eddyb/take-garbage-out
Conflicts:
	src/libcollections/lib.rs
	src/libcore/lib.rs
	src/librustdoc/lib.rs
	src/librustrt/lib.rs
	src/libserialize/lib.rs
	src/libstd/lib.rs
	src/test/run-pass/issue-8898.rs
2014-10-02 14:53:18 -07:00
Aaron Turon d2ea0315e0 Revert "Use slice syntax instead of slice_to, etc."
This reverts commit 40b9f5ded5.
2014-10-02 11:48:07 -07:00
Aaron Turon 7bf56df4c8 Revert "Put slicing syntax behind a feature gate."
This reverts commit 95cfc35607.
2014-10-02 11:47:51 -07:00
Eduard Burtescu 58bea31ca0 tests: remove uses of Gc. 2014-10-02 17:02:15 +03:00
Nick Cameron 95cfc35607 Put slicing syntax behind a feature gate.
[breaking-change]

If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02 13:23:36 +13:00
Nick Cameron 40b9f5ded5 Use slice syntax instead of slice_to, etc. 2014-10-02 13:19:45 +13:00
Brian Anderson 40ce87f6ed Ignore yet another windows debuginfo test 2014-09-30 09:18:16 -07:00
Michael Woerister 302486e49b debuginfo: Make sure that all calls to drop glue are associated with debug locations.
This commit makes rustc emit debug locations for all call
and invoke statements in LLVM IR, if they are contained
within a function that debuginfo is enabled for. This is
important because LLVM does not handle the case where a
function body containing debuginfo is inlined into another
function with debuginfo, but the inlined call statement
does not have a debug location. In this case, LLVM will
not know where (in terms of source code coordinates) the
function was inlined to and we end up with some statements
still linked to the source locations in there original,
non-inlined function without any indication that they are
indeed an inline-copy. Later, when generating DWARF from
the IR, LLVM will interpret this as corrupt IR and abort.

Unfortunately, the undesirable case described above can
still occur when using LTO. If there is a crate compiled
without debuginfo calling into a crate compiled with
debuginfo, we again end up with the conditions triggering
the error. This is why some LTO tests still fail with the
dreaded assertion, if the standard library was built with
debuginfo enabled.
That is, `RUSTFLAGS_STAGE2=-g make rustc-stage2` will
succeed but `RUSTFLAGS_STAGE2=-g make check` will still
fail after this commit has been merged. This is a problem
that has to be dealt with separately.

Fixes #17201
Fixes #15816
Fixes #15156
2014-09-25 14:17:14 +02:00
Colin Davidson a7a1bf81d7 Move -Z lto to -C lto.
Closes #12443
2014-09-21 02:17:31 -04:00
Brian Anderson 0a83d02efc Ignore two gdb tests on windows that are failing on the bots 2014-09-18 18:35:41 -07:00
Alex Crichton 0515e71531 test: Un-ignore some GDB pretty printing tests
I've confirmed that these are working on the snapshot builders

Closes #16919
2014-09-17 07:50:30 -07:00
Aaron Turon fc525eeb4e Fallout from renaming 2014-09-16 14:37:48 -07:00
Alex Crichton b090905b17 test: Ignore failing gdb pretty tests
These tests are blocking a linux nightly and a new snapshot, so ignore them for
now. Their tracking issue is #16919.
2014-09-02 08:34:00 -07: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
Corey Richardson 6e8ff99958 librustc: handle repr on structs, require it for ffi, unify with packed
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct
layout is now down with #[repr(C)]. For consistency, specifying a packed
layout is now also down with #[repr(packed)]. Both can be specified.

To fix errors caused by this, just add #[repr(C)] to the structs, and change
 #[packed] to #[repr(packed)]

Closes #14309

[breaking-change]
2014-08-20 21:02:23 -04:00
Michael Woerister 910dd2635c debuginfo: Add a "no_debug" attribute that allows to exclude functions from debuginfo generation. 2014-08-15 15:35:43 +02:00
Vadim Chugunov 1b2dc760af Replace "ignore-win32" in tests with "ignore-windows" 2014-08-12 00:14:00 -07:00
Brian Anderson aa48654740 Remove managed_box gate from tests
No longer does anything.
2014-07-26 21:05:29 -07:00
Patrick Walton caa564bea3 librustc: Stop desugaring `for` expressions and translate them directly.
This makes edge cases in which the `Iterator` trait was not in scope
and/or `Option` or its variants were not in scope work properly.

This breaks code that looks like:

    struct MyStruct { ... }

    impl MyStruct {
        fn next(&mut self) -> Option<int> { ... }
    }

    for x in MyStruct { ... } { ... }

Change ad-hoc `next` methods like the above to implementations of the
`Iterator` trait. For example:

    impl Iterator<int> for MyStruct {
        fn next(&mut self) -> Option<int> { ... }
    }

Closes #15392.

[breaking-change]
2014-07-24 18:58:12 -07:00
Patrick Walton de70d76373 librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,
except where trait objects are involved.

Part of issue #15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]
2014-07-17 14:05:36 -07:00
Patrick Walton 00c70d1a80 librustc: Allow the new UFCS explicit self in trait definitions, and
remove `~self` from the test suite.
2014-07-16 23:16:12 -07:00
Michael Woerister c7f45a9458 debuginfo: Add LLDB autotests to debuginfo test suite.
This commit adds LLDB autotests to the test suite but does not activate them by default yet.
2014-07-16 09:46:31 +02:00
Richo Healey 12c334a77b std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.
[breaking-change]
2014-07-08 13:01:43 -07:00
Michael Woerister 40e0541309 debuginfo: Make names of types in debuginfo reliable and omit source locations from debug info type descriptions.
So far, type names generated for debuginfo where a bit sketchy. It was not clearly defined when a name should be fully qualified and when not, if region parameters should be shown or not, and other things like that.
This commit makes the debuginfo module responsible for creating type names instead of using ppaux::ty_to_str() and brings type names, as they show up in the DWARF information, in line with GCC and Clang:

* The name of the type being described is unqualified. It's path is defined by its position in the namespace hierarchy.
* Type arguments are always fully qualified, no matter if they would actually be in scope at the type definition location.

Care is also taken to reliably make type names consistent across crate boundaries. That is, the code now tries make the type name the same, regardless if the type is in the local crate or reconstructed from metadata. Otherwise LLVM will complain about violating the one-definition-rule when using link-time-optimization.

This commit also removes all source location information from type descriptions because these cannot be reconstructed for types instantiated from metadata. Again, with LTO enabled, this can lead to two versions of the debuginfo type description, one with and one without source location information, which then triggers the LLVM ODR assertion.
Fortunately, source location information about types is rarely used, so this has little impact. Once source location information is preserved in metadata (#1972) it can also be reenabled for type descriptions.
2014-07-02 13:32:57 +02:00
Patrick Walton a5bb0a3a45 librustc: Remove the fallback to `int` for integers and `f64` for
floating point numbers for real.

This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]
2014-06-29 11:47:58 -07:00
Alex Crichton cdccecb24f Test fixes from the rollup
Closes #14482 (std: Bring back half of Add on String)
Closes #15026 (librustc: Remove the fallback to `int` from typechecking.)
Closes #15119 (Add more description to c_str::unwrap().)
Closes #15120 (Add tests for #12470 and #14285)
Closes #15122 (Remove the cheat sheet.)
Closes #15126 (rustc: Always include the morestack library)
Closes #15127 (Improve ambiguous pronoun.)
Closes #15130 (Fix #15129)
Closes #15131 (Add the Guide, add warning to tutorial.)
Closes #15134 (Xfailed tests for hygiene, etc.)
Closes #15135 (core: Add stability attributes to Clone)
Closes #15136 (Some minor improvements to core::bool)
Closes #15137 (std: Add stability attributes to primitive numeric modules)
Closes #15141 (Fix grammar in tutorial)
Closes #15143 (Remove few FIXMEs)
Closes #15145 (Avoid unnecessary temporary on assignments)
Closes #15147 (Small improvements for metaprogramming)
Closes #15153 (librustc: Check function argument patterns for legality of by-move)
Closes #15154 (test: Add a test for regions, traits, and variance.)
Closes #15159 (rustc: Don't register syntax crates twice)
Closes #13816 (Stabilize version output for rustc and rustdoc)
2014-06-24 18:57:01 -07:00
Patrick Walton 654d6444fe libsyntax: Disallow struct literals after `if`, `while`, `match`, and
`for...in`.

Closes #14803.

If you used a structure literal after one of these keywords, surround it
in parentheses.

[breaking-change]
2014-06-23 15:39:29 -07:00
Michael Woerister 7cfdfa6ef6 debuginfo: Add test case for issue 14411. 2014-06-18 17:02:02 -07:00
Alex Crichton ade807c6dc rustc: Obsolete the `@` syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
2014-06-14 10:45:37 -07:00
Michael Woerister 0a98a4e422 debuginfo: Generate cross-crate unique type identifiers for debuginfo types.
With this change, rustc creates a unique type identifier for types in debuginfo. These type identifiers are used by LLVM to correctly handle link-time-optimization scenarios but also help rustc with dealing with inlining from other crates. For more information, see the documentation block at the top of librustc/middle/trans/debuginfo.rs.

Fixes #13681.
2014-06-12 18:39:01 +02:00
Michael Woerister eea329b0f7 debuginfo: Make DWARF representation of enums uniform.
So far the DWARF information for enums was different
for regular enums, univariant enums, Option-like enums,
etc. Regular enums were encoded as unions of structs,
while the other variants were encoded as bare structs.

With the changes in this PR all enums are encoded as
unions so that debuggers can reconstruct if something
originally was a struct, a univariant enum, or an
Option-like enum. For the latter case, information
about the Null variant is encoded into the union field
name. This information can then be used by the
debugger to print a None value actually as None
instead of Some(0x0).
2014-05-29 14:21:03 +02:00
Richo Healey 553074506e core: rename strbuf::StrBuf to string::String
[breaking-change]
2014-05-24 21:48:10 -07:00
Brian Anderson 1a1e6c8e73 std: Move simd to core::simd and reexport. #1457
[breaking-change]
2014-05-23 15:27:48 -07:00
Luqman Aden be79edba71 Update debuginfo tests. 2014-05-18 03:04:50 -04:00
Patrick Walton 95e310abdc test: Remove all uses of `~str` from the test suite. 2014-05-14 14:58:00 -07:00
Alex Crichton f94d671bfa core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.

* transmute - This function was moved to `mem`, but it is now marked as
              #[unstable]. This is due to planned changes to the `transmute`
              function and how it can be invoked (see the #[unstable] comment).
              For more information, see RFC 5 and #12898

* transmute_copy - This function was moved to `mem`, with clarification that is
                   is not an error to invoke it with T/U that are different
                   sizes, but rather that it is strongly discouraged. This
                   function is now #[stable]

* forget - This function was moved to `mem` and marked #[stable]

* bump_box_refcount - This function was removed due to the deprecation of
                      managed boxes as well as its questionable utility.

* transmute_mut - This function was previously deprecated, and removed as part
                  of this commit.

* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
                         can be achieved with an `as` in safe code, so it was
                         removed.

* transmute_lifetime - This function was removed because it is likely a strong
                       indication that code is incorrect in the first place.

* transmute_mut_lifetime - This function was removed for the same reasons as
                           `transmute_lifetime`

* copy_lifetime - This function was moved to `mem`, but it is marked
                  `#[unstable]` now due to the likelihood of being removed in
                  the future if it is found to not be very useful.

* copy_mut_lifetime - This function was also moved to `mem`, but had the same
                      treatment as `copy_lifetime`.

* copy_lifetime_vec - This function was removed because it is not used today,
                      and its existence is not necessary with DST
                      (copy_lifetime will suffice).

In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.

    transmute - #[unstable]
    transmute_copy - #[stable]
    forget - #[stable]
    copy_lifetime - #[unstable]
    copy_mut_lifetime - #[unstable]

[breaking-change]
2014-05-11 01:13:02 -07:00
Michael Woerister 55a8bd56e5 debuginfo: Split debuginfo autotests into debuginfo-gdb and debuginfo-lldb 2014-05-07 19:58:07 +02:00