Commit Graph

56273 Commits

Author SHA1 Message Date
Manish Goregaokar
5deee46e25 Rollup merge of #35947 - SimonSapin:decodeutf8-error-handling, r=alexcrichton
Yield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossy

r? @alexcrichton
2016-08-25 17:08:01 +05:30
Manish Goregaokar
7963bbb084 Rollup merge of #35916 - eddyb:mir-no-dead-allocas, r=Aatch
rustc_trans: do not generate allocas for unused locals.

This fixes a regression observed in a [`mio` test](https://travis-ci.org/carllerche/mio/jobs/152142886) which was referencing a 4MB `const` array.
Even though MIR rvalue promotion would promote the borrow of the array, a dead temp was left behind.
As the array doesn't have an immediate type, an `alloca` was generated for it, even though it had no uses.

The fix is pretty dumb: assume that locals need to be borrowed or assigned before being used.
And if it can't be used, it doesn't get an `alloca`, even if the type would otherwise demand it.
This could change in the future, but all the MIR we generate now doesn't break that rule.
2016-08-25 17:08:00 +05:30
Manish Goregaokar
5e69622e0e Rollup merge of #35867 - frewsxcv:rustdoc-cleanup, r=alexcrichton
Various refactorings in the rustdoc module.

None
2016-08-25 17:08:00 +05:30
Manish Goregaokar
e0e1954bdc Rollup merge of #35238 - vadimcn:macro-debug-locs, r=michaelwoerister
Fix debug line number info for macro expansions.

Macro expansions result in code tagged with completely different debug locations than the surrounding expressions.  This wrecks havoc on debugger's ability the step over source lines.
This change fixes the problem by tagging expanded code as "inlined" at the macro expansion site, which allows the debugger to sort it out.
Note that only the outermost expansion is currently handled, stepping into a macro will still result in stepping craziness.

r? @eddyb
2016-08-25 17:07:59 +05:30
Johannes Löthberg
6f93d3ce46 Make E0094 underline better
Fixes #35966.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2016-08-25 10:48:11 +02:00
Vadim Chugunov
cf6461168f Fix debug line info for macro expansions.
Macro expansions produce code tagged with debug locations that are completely different from the surrounding expressions.  This wrecks havoc on debugger's ability the step over source lines.

In order to have a good line stepping behavior in debugger, we overwrite debug locations of macro expansions with that of the outermost expansion site.
2016-08-25 00:40:42 -07:00
Corey Farwell
42e8ac87eb Implement From<ast::FloatTy> for PrimitiveType. 2016-08-24 23:27:25 -07:00
Corey Farwell
168cfea8af Implement From<ast::UintTy> for PrimitiveType. 2016-08-24 23:27:25 -07:00
Corey Farwell
8a6f7a5ced Implement From<ast::IntTy> for PrimitiveType. 2016-08-24 23:27:25 -07:00
Corey Farwell
5c849f4a50 Remove unnecessary 'Primitive' prefix on PrimitiveType enum variants. 2016-08-24 23:27:25 -07:00
Corey Farwell
9dde563990 Stop reexporting PrimitiveType enum in librustdoc. 2016-08-24 23:27:24 -07:00
Corey Farwell
0c9ff54139 Migrate ItemType::from_type_kind to convert::From. 2016-08-24 23:25:26 -07:00
Corey Farwell
30397aee0d Migrate ItemType::from_item to convert::From. 2016-08-24 23:25:26 -07:00
Corey Farwell
7dc411667a Migrate Context::maybe_ignore_item method to standalone function.
The method wasn't using any `self` data from Context, so it seemed
miseading to implement it as a method.
2016-08-24 23:25:26 -07:00
Corey Farwell
28ecfb691d Move ItemEnum → Generics logic into method on ItemEnum. 2016-08-24 23:25:26 -07:00
bors
f5499a001d Auto merge of #35814 - alexcrichton:armv7-no-neon, r=brson
rustc: Don't enable NEON by default on armv7 Linux

One of the primary platforms for the `armv7-unknown-linux-gnueabihf` target,
Linux distributions, do not enable NEON extensions by default. This PR disables
that feature by defualt but enables the `d16` feature which enables VFP3D16 that
distributions do enable.

Closes #35590
2016-08-24 23:05:47 -07:00
bors
0ccd5c802b Auto merge of #35971 - jonathandturner:rollup, r=jonathandturner
Rollup of 4 pull requests

- Successful merges: #35876, #35920, #35948, #35961
- Failed merges: #35395
2016-08-24 18:42:24 -07:00
Jeffrey Seyfried
a9a2979dba Remove needless imports in libcollections. 2016-08-24 22:13:13 +00:00
Jeffrey Seyfried
9a2c8783d9 Use #[prelude_import] in libstd. 2016-08-24 22:12:48 +00:00
Jeffrey Seyfried
e2ad3be178 Use #[prelude_import] in libcore. 2016-08-24 22:12:23 +00:00
bors
e9bc1bac8c Auto merge of #35764 - eddyb:byegone, r=nikomatsakis
Remove the old AST-based backend from rustc_trans.

Starting with Rust 1.13, `--disable-orbit` , `-Z orbit=off` and `#[rustc_no_mir]` have been removed.
Only the new MIR backend is left in the compiler, and only early const_eval uses ASTs from other crates.

Filling drop (previously "zeroing drop"), `#[unsafe_no_drop_flag]` and associated unstable APIs are gone.
Implementing `Drop` doesn't add a flag anymore to the type, all of the dynamic drop is function local.
This is a [breaking-change], please use `Option::None` and/or `mem::forget` if you are unsure about your ability to prevent/control the drop of a value. In the future, `union` will be usable in some such cases.

**NOTE**: DO NOT MERGE before we get the new beta as the stage0, there's some cruft to remove.

All of this will massively simplify any efforts to implement (and as such it blocks) features such as `union`s, safe use of `#[packed]` or new type layout optimizations, not to mention many other experiments.
2016-08-24 14:57:34 -07:00
Ulrik Sverdrup
8295c5056d memrchr: Use a conditional instead of subtracting a complicated min
This makes the critical calculation easier to understand.
2016-08-24 21:41:23 +02:00
Keith Yeung
3d9cf30ddf More robust testing 2016-08-24 11:48:53 -07:00
Keith Yeung
07e6e81e08 Extract error reporting into its own fn 2016-08-24 11:48:48 -07:00
Jonathan Turner
2932db19b5 Rollup merge of #35961 - 0xmohit:pr/error-codes-E0445-E0454, r=GuillaumeGomez
Update E0445 and E0454 to new error format

Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez
2016-08-24 10:35:29 -07:00
Jonathan Turner
411a85e271 Rollup merge of #35948 - tshepang:missing-comma, r=steveklabnik
reference: add trailing commas
2016-08-24 10:35:29 -07:00
Jonathan Turner
336841ccf9 Rollup merge of #35920 - GuillaumeGomez:err_codes, r=jonathandturner
Err codes

r? @jonathandturner
2016-08-24 10:35:29 -07:00
Jonathan Turner
95c661aae6 Rollup merge of #35876 - matthew-piziak:sub-examples, r=GuillaumeGomez
more evocative examples for `Sub` and `SubAssign`

These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in.

Part of #29365.

r? @steveklabnik
2016-08-24 10:35:29 -07:00
bors
03e23c7f9a Auto merge of #35883 - durka:gh35849, r=eddyb
typeck: use NoExpectation to check return type of diverging fn

Fixes #35849.

Thanks @eddyb.
2016-08-24 10:29:12 -07:00
Ulrik Sverdrup
d1ecee96bf memrchr: Correct aligned offset computation
The memrchr fallback did not compute the offset correctly. It was
intentioned to land on usize-aligned addresses but did not.
This was suspected to resulted in a crash on ARMv7 platform!

This bug affected non-linux platforms.

I think like this, if we have a slice with pointer `ptr` and length
`len`, we want to find the last usize-aligned offset in the slice.
The correct computation should be:

For example if ptr = 1 and len = 6, and size_of::<usize>() is 4:

[ x x x x x x ]
  1 2 3 4 5 6
        ^-- last aligned address at offset 3 from the start.

The last aligned address is ptr + len - (ptr + len) % usize_size.

Compute offset from the start as:

offset = len - (ptr + len) % usize_size = 6 - (1 + 6) % 4 = 6 - 3 = 3.

I believe the function's return value was always correct previously, if
the platform supported unaligned addresses.
2016-08-24 19:05:21 +02:00
Mohit Agarwal
11e9b8de7d Update E0445 and E0454 to new error format
Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez
2016-08-24 17:43:51 +05:30
Eduard Burtescu
25cf8001b1 Remove AST from metadata except for consts and const fns. 2016-08-24 13:23:38 +03:00
Eduard Burtescu
119508cdb4 Remove drop flags from structs and enums implementing Drop. 2016-08-24 13:23:37 +03:00
Eduard Burtescu
d0654ae5e5 rustc_trans: remove the bulk of old trans and most of its support code. 2016-08-24 13:23:37 +03:00
Eduard Burtescu
cb9b0ed91b Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit. 2016-08-24 13:23:37 +03:00
Guillaume Gomez
5c5f483b40 Add new error code tests 2016-08-24 11:28:09 +02:00
Guillaume Gomez
f200061bd6 Add error code test checkup 2016-08-24 11:28:09 +02:00
Guillaume Gomez
3ddb468522 Add E0478 error explanation 2016-08-24 11:28:05 +02:00
bors
308824acec Auto merge of #35748 - michaelwoerister:fix-rust-gdb-py-version-check, r=brson
Make version check in gdb_rust_pretty_printing.py more compatible.

Some versions of Python don't support the `major` field on the object returned by `sys.version_info`.

Fixes #35724

r? @brson
2016-08-23 22:52:29 -07:00
Corey Farwell
19aae8e069 Reuse iterator to avoid unnecessary creation. 2016-08-23 21:34:53 -04:00
Corey Farwell
2655c89549 Use idiomatic names for string-related methods names. 2016-08-23 21:28:26 -04:00
bors
a66fa96d18 Auto merge of #35951 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests

- Successful merges: #35910, #35912, #35913, #35936, #35939, #35949
- Failed merges: #35395
2016-08-23 16:28:20 -07:00
Guillaume Gomez
16d459f292 Rollup merge of #35949 - tshepang:excess, r=GuillaumeGomez
doc: one line too many
2016-08-23 22:48:03 +02:00
Guillaume Gomez
142dc491e5 Rollup merge of #35939 - creativcoder:e0195, r=jonathandturner
Update E0195 to new error format

Fixes #35511
Part of #35233

r? @jonathandturner
2016-08-23 22:48:03 +02:00
Guillaume Gomez
ed4c0fd01d Rollup merge of #35936 - matthew-piziak:div-rational-example, r=GuillaumeGomez
replace `Div` example with something more evocative of division

Analogous to PR #35860.

r? @GuillaumeGomez
2016-08-23 22:48:03 +02:00
Guillaume Gomez
e3e439019f Rollup merge of #35913 - frewsxcv:panic, r=steveklabnik
Mark panicking tests as `should_panic` instead of `no_run`.

None
2016-08-23 22:48:02 +02:00
Guillaume Gomez
21d4ec9120 Rollup merge of #35912 - brson:rust-installer, r=alexcrichton
Update rust-installer. Fixes #35840

cc @Diggsey
2016-08-23 22:48:02 +02:00
Guillaume Gomez
bc940193c8 Rollup merge of #35910 - tbu-:pr_weird_linebreak, r=alexcrichton
Change a weird line break in `core::str`
2016-08-23 22:48:02 +02:00
Tshepang Lekhonkhobe
59723c3c20 doc: one line too many 2016-08-23 22:31:44 +02:00
Tshepang Lekhonkhobe
ab4c492d68 reference: add trailing commas 2016-08-23 22:25:40 +02:00