Commit Graph

49437 Commits

Author SHA1 Message Date
Greg Chapple
54396a31c1 Scaffold internals docs & add initial overview 2016-01-22 20:45:04 +00:00
bors
a70a60a02b Auto merge of #30763 - gchp:issue/30033, r=nagisa
This is achieved by adding the scan_back method. This method looks back
through the source_text of the StringReader until it finds the target
char, returning it's offset in the source. We use this method to find
the offset of the opening single quote, and use that offset as the start
of the error.

Given this code:

```rust
fn main() {
    let _ = 'abcd';
}
```

The compiler would give a message like:

```
error: character literal may only contain one codepoint: ';
let _ = 'abcd';
             ^~
```
With this change, the message now displays:

```
error: character literal may only contain one codepoint: 'abcd';
let _ = 'abcd';
        ^~~~~~~
```

Fixes #30033
2016-01-15 06:38:26 +00:00
bors
d8869d3487 Auto merge of #30711 - nrc:json-errs, r=huonw
The compiler can emit errors and warning in JSON format. This is a more easily machine readable form then the usual error output.

Closes #10492, closes #14863.
2016-01-15 01:52:01 +00:00
Nick Cameron
82f8e5ce84 Address reviewer comments
[breaking-change]

`OptLevel` variants are no longer `pub use`ed by rust::session::config. If you are using these variants, you must change your code to prefix the variant name with `OptLevel`.
2016-01-15 14:49:25 +13:00
bors
2fb0c5ebcf Auto merge of #30916 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30712, #30895, #30902, #30903, #30909, #30910, #30911, #30912, #30914
- Failed merges:
2016-01-14 22:23:59 +00:00
Nick Cameron
11dcb48c6a Add a test
And fix bustage in make check
2016-01-15 10:24:12 +13:00
Nick Cameron
b976d9e666 Implement JSON error emission
[breaking-change]

syntax::errors::Handler::new has been renamed to with_tty_emitter

Many functions which used to take a syntax::errors::ColorConfig, now take a rustc::session::config::ErrorOutputType. If you previously used ColorConfig::Auto as a default, you should now use ErrorOutputType::default().
2016-01-15 10:24:12 +13:00
Nick Cameron
fd46c78f8f Add an --output option for specifying an error emitter 2016-01-15 10:24:12 +13:00
Nick Cameron
acfccc515b Add a JSON error emitter 2016-01-15 10:20:30 +13:00
bors
c12c42de0a Auto merge of #30913 - brson:nogold, r=alexcrichton
This reverts commit 34dc0e0739.

cc #30783 #30784 #29974

r? @alexcrichton
2016-01-14 20:32:13 +00:00
Steve Klabnik
6ab39ff098 Rollup merge of #30914 - tshepang:easier-description, r=steveklabnik
This function returns the size on the stack, not that of the value
that may be allocated on the heap.
2016-01-14 14:58:35 -05:00
Steve Klabnik
9ffb84a784 Rollup merge of #30912 - tshepang:remove-distraction, r=steveklabnik 2016-01-14 14:58:35 -05:00
Steve Klabnik
9b10d0e1e5 Rollup merge of #30911 - tshepang:missing-word, r=Manishearth
Also, whitespace fixes
2016-01-14 14:58:35 -05:00
Steve Klabnik
958bff100a Rollup merge of #30910 - tshepang:improve-description, r=steveklabnik 2016-01-14 14:58:35 -05:00
Steve Klabnik
b3950b7ca5 Rollup merge of #30909 - tshepang:a-better-name, r=steveklabnik
For a moment, I got confused by thinking the summary was referring to the same `x`
2016-01-14 14:58:34 -05:00
Steve Klabnik
f1a0fd127a Rollup merge of #30903 - steveklabnik:no_std_stable, r=alexcrichton
This feature is partially stabilized, so describe each part in the appropriate place.

r? @alexcrichton @brson

It would be nice to backport this to beta, since this is the first release where this is true. I try really hard to not do doc backports, but this isn't very large, and might be worth making an exception, I dunno.
2016-01-14 14:58:34 -05:00
Steve Klabnik
72ebb193a9 Rollup merge of #30902 - tomaka:patch-1, r=steveklabnik 2016-01-14 14:58:34 -05:00
Steve Klabnik
c88574a32b Rollup merge of #30895 - gchp:contrib, r=alexcrichton
'B' labels are for blockers, not issues which belong elsewhere.

Prompted by this comment on Reddit:
https://www.reddit.com/r/rust/comments/40nzkd/contributing_to_the_rust_compiler_a_short_guide/cyxcjtd
2016-01-14 14:58:34 -05:00
Steve Klabnik
e26279db48 Rollup merge of #30712 - LawrenceWoodman:patch-3, r=steveklabnik
This also repeats the case analysis used.
2016-01-14 14:58:34 -05:00
Tshepang Lekhonkhobe
dfdbbd005a doc: this is more easy to read, and less prone mis-interpretation
This function returns the size on the stack, not that of the value
that may be allocated on the heap.
2016-01-14 21:38:18 +02:00
Brian Anderson
4bcca8bcf7 Revert "Link with ld.gold by default"
This reverts commit 34dc0e0739.
2016-01-14 19:20:11 +00:00
Tshepang Lekhonkhobe
f7fb0af729 doc: that suffix serves as mere distraction 2016-01-14 21:08:15 +02:00
Tshepang Lekhonkhobe
049b9e4e80 doc: add missing word
Also, whitespace fixes
2016-01-14 20:56:38 +02:00
Tshepang Lekhonkhobe
80d2be947e doc: "x" is used as variable name on this API, so avoid using it here 2016-01-14 20:54:49 +02:00
Tshepang Lekhonkhobe
7d446ce555 doc: "moves" has a specific meaning in Rust, so avoid using it here 2016-01-14 20:52:51 +02:00
Greg Chapple
acc9428c6a Display better snippet for invalid char literal
Given this code:

    fn main() {
        let _ = 'abcd';
    }

The compiler would give a message like:

    error: character literal may only contain one codepoint: ';
    let _ = 'abcd';
                 ^~

With this change, the message now displays:

    error: character literal may only contain one codepoint: 'abcd'
    let _ = 'abcd'
            ^~~~~~

Fixes #30033
2016-01-14 17:34:42 +00:00
tomaka
729e566020 Fix outdated comment 2016-01-14 16:47:29 +01:00
Steve Klabnik
0394418752 Move some #[no_std] info to stable book.
This feature is partially stabilized, so describe each part in the appropriate place.
2016-01-14 10:45:40 -05:00
bors
e5bab5dd00 Auto merge of #30848 - nagisa:mir-no-store-zsts, r=nikomatsakis
Fixes #30831

r? @nikomatsakis
2016-01-14 15:37:07 +00:00
bors
02fbf31fb2 Auto merge of #30897 - Manishearth:rollup, r=Manishearth
- Successful merges: #30821, #30869, #30871, #30874, #30879, #30886, #30892
- Failed merges: #30864
2016-01-14 13:42:59 +00:00
Manish Goregaokar
a964c86d45 Rollup merge of #30892 - shepmaster:box-grammar, r=alexcrichton 2016-01-14 19:12:29 +05:30
Manish Goregaokar
92aa326920 Rollup merge of #30886 - ollie27:docs_links, r=steveklabnik
r? @steveklabnik
2016-01-14 19:12:29 +05:30
Manish Goregaokar
f28a43102b Rollup merge of #30879 - durka:collections-range-tracking-issue, r=nagisa
see #27711 and #30877

r? @alexcrichton
2016-01-14 19:12:29 +05:30
Manish Goregaokar
74458cf42a Rollup merge of #30874 - dhuseby:fixing_bitrig_tests, r=alexcrichton
fixes the failing bitrig unit tests.
2016-01-14 19:12:28 +05:30
Manish Goregaokar
9cb4350e63 Rollup merge of #30871 - oli-obk:fix/reference, r=steveklabnik
r? @steveklabnik
2016-01-14 19:12:28 +05:30
Manish Goregaokar
7893031d92 Rollup merge of #30869 - D101101:patch-3, r=huonw
r? @steveklabnik
2016-01-14 19:12:28 +05:30
Manish Goregaokar
07aaca3a07 Rollup merge of #30821 - steveklabnik:gh30819, r=nikomatsakis
Fixes #30819
2016-01-14 19:12:28 +05:30
Greg Chapple
a5836fa48f Fix note about B-prefixed issue labels
'B' labels are for blockers, not issues which belong elsewhere.

Prompted by this comment on Reddit:
https://www.reddit.com/r/rust/comments/40nzkd/contributing_to_the_rust_compiler_a_short_guide/cyxcjtd
2016-01-14 10:47:04 +00:00
bors
5b3a75fe56 Auto merge of #30883 - Manishearth:rollup, r=Manishearth
- Successful merges: #30626, #30662, #30770, #30801, #30818, #30823, #30828, #30835, #30837, #30839, #30845, #30848, #30850, #30851, #30863
- Failed merges:
2016-01-14 06:45:26 +00:00
Manish Goregaokar
1246f43bf9 Rollup merge of #30863 - jseyfried:no_rc, r=eddyb
Use arena allocation instead of reference counting for `Module`s to fix memory leaks from `Rc` cycles.

A module references its module children and its import resolutions, and an import resolution references the module defining the imported name, so there is a cycle whenever a module imports something from an ancestor module.

For example,
```rust
mod foo { // `foo` references `bar`.
    fn baz() {}
    mod bar { // `bar` references the import.
        use foo::baz; // The import references `foo`.
    }
}
```
2016-01-14 11:04:43 +05:30
Manish Goregaokar
e51de045ef Rollup merge of #30851 - jonas-schievink:unneeded-dropflags, r=pnkfelix
Apparently we allocate and maintain non-working dropflag hints since June... In anticipation of a working implementation of on-stack drop flag hints, let's not spend even more time on types that don't even need to be dropped.

```rust
fn main() {
    let (i,j,k,l) = (0,0,0,0);
}
```
used to translate to (unoptimized only, of course):
```llvm
define internal void @_ZN4main20ha8deb085c47920d8eaaE() unnamed_addr #0 {
entry-block:
  %dropflag_hint_10 = alloca i8
  %dropflag_hint_11 = alloca i8
  %dropflag_hint_12 = alloca i8
  %dropflag_hint_13 = alloca i8
  %const = alloca { i32, i32, i32, i32 }
  %i = alloca i32
  %j = alloca i32
  %k = alloca i32
  %l = alloca i32
  store i8 61, i8* %dropflag_hint_10
  store i8 61, i8* %dropflag_hint_11
  store i8 61, i8* %dropflag_hint_12
  store i8 61, i8* %dropflag_hint_13
  %0 = bitcast { i32, i32, i32, i32 }* %const to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ({ i32, i32, i32, i32 }* @const2752 to i8*), i64 16, i32 4, i1 false)
  %1 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 0
  %2 = load i32, i32* %1, align 4
  store i32 %2, i32* %i, align 4
  %3 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 1
  %4 = load i32, i32* %3, align 4
  store i32 %4, i32* %j, align 4
  %5 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 2
  %6 = load i32, i32* %5, align 4
  store i32 %6, i32* %k, align 4
  %7 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 3
  %8 = load i32, i32* %7, align 4
  store i32 %8, i32* %l, align 4
  ret void
}
```

Now it gives:
```llvm
define internal void @_ZN4main20ha8deb085c47920d8eaaE() unnamed_addr #0 {
entry-block:
  %const = alloca { i32, i32, i32, i32 }
  %i = alloca i32
  %j = alloca i32
  %k = alloca i32
  %l = alloca i32
  %0 = bitcast { i32, i32, i32, i32 }* %const to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ({ i32, i32, i32, i32 }* @const2748 to i8*), i64 16, i32 4, i1 false)
  %1 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 0
  %2 = load i32, i32* %1, align 4
  store i32 %2, i32* %i, align 4
  %3 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 1
  %4 = load i32, i32* %3, align 4
  store i32 %4, i32* %j, align 4
  %5 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 2
  %6 = load i32, i32* %5, align 4
  store i32 %6, i32* %k, align 4
  %7 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 3
  %8 = load i32, i32* %7, align 4
  store i32 %8, i32* %l, align 4
  ret void
}
```

Let's hope I didn't break anything!
2016-01-14 11:04:43 +05:30
Manish Goregaokar
6ceaa2f77a Rollup merge of #30850 - ranma42:cleanup-io, r=alexcrichton
In 8d90d3f368 `BufStream`, the only
consumer of `InternalBufWriter`, was removed. As implied by the name,
this type is private, hence it is currently dead code.
2016-01-14 11:04:43 +05:30
Manish Goregaokar
24848846cc Rollup merge of #30839 - tomaka:debug-phantomdata, r=nikomatsakis
All the trait implementations of `PhantomData` use `impl<T: ?Sized>` except for `Debug`
https://doc.rust-lang.org/nightly/std/marker/struct.PhantomData.html#implementations

This PR fixes this.
2016-01-14 11:04:42 +05:30
Manish Goregaokar
837a8decb6 Rollup merge of #30837 - semarie:openbsd-libc, r=alexcrichton
The following PR updates libc version to latest commits for correctly support openbsd.
It corrects several points in rustc to be compatible with libc changes.

r? @alexcrichton
2016-01-14 11:04:42 +05:30
Manish Goregaokar
4ff1d20ad7 Rollup merge of #30835 - kraai:show-span, r=sanxiyn
I think this will fix #30656.
2016-01-14 11:04:41 +05:30
Manish Goregaokar
98c7519826 Rollup merge of #30828 - wheals:fix-dead-links, r=steveklabnik
See [the intrinsics page](https://doc.rust-lang.org/nightly/core/intrinsics/index.html) for example.
2016-01-14 11:04:41 +05:30
Manish Goregaokar
9036c82781 Rollup merge of #30823 - pnkfelix:put-back-alloca-zeroing-for-issue-30530, r=dotdash
Put back alloca zeroing for issues #29092, #30018, #30530; inject zeroing for #30822.

----

Background context: `fn alloca_zeroed` was removed in PR #22969, so we haven't been "zero'ing" (\*) the alloca's since at least that point, but the logic behind that PR seems sound, so its not entirely obvious how *long* the underlying bug has actually been present.  In other words, I have not yet done a survey to see when the new `alloc_ty` and `lvalue_scratch_datum` calls were introduced that should have had "zero'ing" the alloca's.

----

I first fixed #30018, then decided to do a survey of `alloc_ty` calls to see if they needed similar treatment, which quickly led to a rediscovery of #30530.

While making the regression test for the latter, I discovered #30822, which is a slightly different bug (in terms of where the "zero'ing" needs to go), but still relevant.

I haven't finished the aforementioned survey of `fn alloc_ty` calls, but I decided I wanted to get this up for review in its current state (namely to see if my attempt to force developers to include a justification for passing `Uninit` can possibly fly, or if I should abandon that path of action).

----

(*): I am putting quotation marks around "zero'ing" because we no longer use zero as our "dropped" marker value.

Fix #29092
Fix #30018
Fix #30530
Fix #30822
2016-01-14 11:04:41 +05:30
Manish Goregaokar
3e248aa09f Rollup merge of #30818 - sfackler:duration-hash, r=alexcrichton
tikue pointed out in IRC that this was missing.
2016-01-14 11:04:40 +05:30
Manish Goregaokar
6f4ede44de Rollup merge of #30801 - Amanieu:oom_print, r=alexcrichton
This adds the ability to override the default OOM behavior by setting a handler function. This is used by libstd to print a message when running out of memory instead of crashing with an obscure "illegal hardware instruction" error (at least on Linux).

Fixes #14674
2016-01-14 11:04:40 +05:30
Manish Goregaokar
6581563f7a Rollup merge of #30770 - steveklabnik:gh30345, r=brson
Fixes #30345

I'm not sure if there's anything else that belongs here. Thoughts?
2016-01-14 11:04:40 +05:30