Commit Graph

73514 Commits

Author SHA1 Message Date
bors
5d6f6e65ff Auto merge of #47274 - Manishearth:rustdoc-span, r=QuietMisdreavus
Use correct line offsets for doctests

Not yet tested.

This doesn't handle char positions. It could if I collected a map of char offsets and lines, but this is a bit more work and requires hooking into the parser much more (unsure if it's possible).

r? @QuietMisdreavus

(fixes #45868)
2018-01-14 11:28:27 +00:00
bors
48ab4cde54 Auto merge of #47268 - EdSchouten:cloudabi-libstd, r=alexcrichton
Implement libstd for CloudABI.

Though CloudABI is strongly inspired by POSIX, its absence of features that don't work well with capability-based sandboxing makes it different enough that adding bits to `sys/unix` will make things a mess. This change therefore adds CloudABI specific platform code under `sys/cloudabi`.

One of the goals of this implementation is to build as much as possible directly on top of CloudABI's system call layer, as opposed to using the C library. This is preferred, as the system call layer is supposed to be stable, whereas the C library ABI technically is not. An advantage of this approach is that it allows us to implement certain interfaces, such as mutexes and condition variables more optimally. They can be lighter than the ones provided by pthreads.

This change disables some modules that cannot realistically be implemented right now. For example, libstd's pathname abstraction is not designed with POSIX `*at()` (e.g., `openat()`) in mind. The `*at()` functions are the only set of file system APIs available on CloudABI. There is no global file system namespace, nor a process working directory. Discussions on how to port these modules over are outside the scope of this change.
2018-01-14 08:49:10 +00:00
Eduard-Mihai Burtescu
4e40a0d436 rustc_trans: rename mircx: MirContext to fx: FunctionCx. 2018-01-14 08:56:44 +02:00
Eduard-Mihai Burtescu
209abc71e5 rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
Eduard-Mihai Burtescu
e69dacb431 rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
Eduard-Mihai Burtescu
fb7de6a041 rustc_trans: rename CrateContext to CodegenCx. 2018-01-14 08:55:57 +02:00
Eduard-Mihai Burtescu
2931af62f0 rustc_trans: access fields directly on CrateContext. 2018-01-14 08:55:43 +02:00
Eduard-Mihai Burtescu
7b3ac21427 rustc_trans: remove unused TargetDataRef accessor. 2018-01-14 08:52:16 +02:00
Eduard-Mihai Burtescu
d0d13204a6 rustc_trans: collapse {Local,Shared}CrateContext. 2018-01-14 08:52:16 +02:00
bors
fd0f29237c Auto merge of #47261 - estebank:immutable-arg, r=petrochenkov
Assignment to immutable argument: diagnostic tweak

Re #46659.
2018-01-14 06:09:14 +00:00
bors
b762c2d9dd Auto merge of #47223 - alexcrichton:new-target-feature, r=eddyb
rustc: Tweak `#[target_feature]` syntax

This is an implementation of the `#[target_feature]` syntax-related changes of
[RFC 2045][rfc]. Notably two changes have been implemented:

* The new syntax is `#[target_feature(enable = "..")]` instead of
  `#[target_feature = "+.."]`. The `enable` key is necessary instead of the `+`
  to indicate that a feature is being enabled, and a sub-list is used for
  possible expansion in the future. Additionally within this syntax the feature
  names being enabled are now whitelisted against a known set of target feature
  names that we know about.

* The `#[target_feature]` attribute can only be applied to unsafe functions. It
  was decided in the RFC that invoking an instruction possibly not defined for
  the current processor is undefined behavior, so to enable this feature for now
  it requires an `unsafe` intervention.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md
2018-01-14 03:27:35 +00:00
bors
80e2e67f4c Auto merge of #46832 - Diggsey:bufread-cheaper-seek, r=alexcrichton
BufRead: Only flush the internal buffer if seeking outside of it.

Fixes #31100

r? @dtolnay
2018-01-14 00:42:11 +00:00
Alex Crichton
0ecaa67e90 rustc: Refactor attribute checking to operate on HIR
This'll enable running queries that could be cached and overall be more amenable
to the query infastructure.
2018-01-13 16:07:13 -08:00
bors
cf4c3cbe55 Auto merge of #47416 - petrochenkov:remove-impl-for-dot-dot, r=petrochenkov
Remove `impl Foo for .. {}` in favor `auto trait Foo {}`

Rebase of https://github.com/rust-lang/rust/pull/46480 with restored parsing support.
2018-01-13 21:48:12 +00:00
Guillaume Gomez
026c749989 Only run rustdoc-js test suite when nodejs is available 2018-01-13 22:35:41 +01:00
projektir
a2df413187 Adding RBE as a submodule #46194 2018-01-13 13:04:53 -08:00
Vadim Petrochenkov
318cf22bd1 Move "no asm" check into AST validation 2018-01-13 23:35:11 +03:00
Diggory Blake
c96f30257a Add note to documentation 2018-01-13 18:44:25 +00:00
Diggory Blake
562ba04e45 Implement "seek_relative" 2018-01-13 18:39:37 +00:00
Alex Crichton
5f006cebfc rustc: Tweak #[target_feature] syntax
This is an implementation of the `#[target_feature]` syntax-related changes of
[RFC 2045][rfc]. Notably two changes have been implemented:

* The new syntax is `#[target_feature(enable = "..")]` instead of
  `#[target_feature = "+.."]`. The `enable` key is necessary instead of the `+`
  to indicate that a feature is being enabled, and a sub-list is used for
  possible expansion in the future. Additionally within this syntax the feature
  names being enabled are now whitelisted against a known set of target feature
  names that we know about.

* The `#[target_feature]` attribute can only be applied to unsafe functions. It
  was decided in the RFC that invoking an instruction possibly not defined for
  the current processor is undefined behavior, so to enable this feature for now
  it requires an `unsafe` intervention.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md
2018-01-13 10:07:18 -08:00
Clar Charr
52e074e40e Better Debug impl for io::Error. 2018-01-13 12:45:19 -05:00
Vadim Petrochenkov
22598776b0 Re-add support for impl Trait for .. to the parser 2018-01-13 19:26:49 +03:00
leonardo.yvens
8b4d852f32 Address review. 2018-01-13 18:49:28 +03:00
leonardo.yvens
4e3953bbdd Parse auto trait inside fns.
Also refactored parsing auto traits.
2018-01-13 18:49:28 +03:00
leonardo.yvens
9ccd3ac178 Fix rustdoc 2018-01-13 18:48:01 +03:00
leonardo.yvens
3bb2ff05eb Move coherence/overlap.rs into coherence/mod.rs
`fn check_impl` was feeling lonely with a file all for itself.
2018-01-13 18:48:00 +03:00
leonardo.yvens
edd52b1975 Remove wfcheck for auto traits, remove dead error codes
The WF checks are now done as an AST validation.
2018-01-13 18:48:00 +03:00
leonardo.yvens
02b5fee732 Adjust tests for removal of impl Foo for .. {} 2018-01-13 18:48:00 +03:00
leonardo.yvens
f93183adb4 Remove impl Foo for .. in favor of auto trait Foo
No longer parse it.
Remove AutoTrait variant from AST and HIR.
Remove backwards compatibility lint.
Remove coherence checks, they make no sense for the new syntax.
Remove from rustdoc.
2018-01-13 18:48:00 +03:00
bors
e6072a7b38 Auto merge of #47251 - rkruppe:rm-simd-attr, r=eddyb
Remove deprecated unstable attribute #[simd]

The `#[simd]` attribute has been deprecated since c8b6d5b23c back in 2015. Any nightly crates using it have had ample time to switch to `#[repr(simd)]`, and if they didn't they're likely broken by now anyway.

r? @eddyb
2018-01-13 15:29:31 +00:00
est31
38e2667584 Enforce dashes in the unstable book file names
Also rename the existing underscore using files to use dashes.

Fixes #47394.
2018-01-13 15:44:44 +01:00
bors
9b2f8ac29e Auto merge of #47242 - estebank:issue-15980, r=petrochenkov
`struct` pattern parsing and diagnostic tweaks

 - Recover from struct parse error on match and point out missing match
   body.
 - Point at struct when finding non-identifier while parsing its fields.
 - Add label to "expected identifier, found {}" error.

Fix #15980.
2018-01-13 12:42:33 +00:00
Gauri
3c8c5051b1 add ui test 2018-01-13 17:13:18 +05:30
Sebastian Dröge
5f4fc82142 Add unit tests for exact_chunks/exact_chunks_mut
These are basically modified copies of the chunks/chunks_mut tests.
2018-01-13 12:19:01 +02:00
Sebastian Dröge
ed774838b3 Test the whole chunks instead of just an element in the chunks/chunks_mut tests
Easy enough to do and ensures that the whole chunk is as expected
instead of just the element that was looked at before.
2018-01-13 12:19:00 +02:00
Sebastian Dröge
baa81dc77f Use assert_eq!() instead of assert!(a == b) in slice chunks_mut() unit test
This way more useful information is printed if the test ever fails.
2018-01-13 12:18:59 +02:00
Sebastian Dröge
8a82e8e89f Mention in the exact_chunks docs that this can often be optimized better by the compiler
And also link from the normal chunks iterator to the exact_chunks one.
2018-01-13 12:18:58 +02:00
Sebastian Dröge
6bf1dfdd76 Implement TrustedRandomAccess for slice::{ExactChunks, ExactChunksMut} 2018-01-13 12:18:57 +02:00
Sebastian Dröge
cea36f447e Remove useless assertion 2018-01-13 12:18:56 +02:00
Sebastian Dröge
aa0c08a22c Apply review comments from @bluss
- Simplify nth() by making use of the fact that the slice is evenly
  divisible by the chunk size, and calling next() instead of
  duplicating it
- Call next_back() in last(), they are equivalent
- Implement ExactSizeIterator::is_empty()
2018-01-13 12:18:55 +02:00
Sebastian Dröge
e51a89a0ad Fix doctests for slice::exact_chunks() for real 2018-01-13 12:18:55 +02:00
Sebastian Dröge
802ba9ea5b Fix assertions in examples of the exact_chunk() documentation 2018-01-13 12:18:54 +02:00
Sebastian Dröge
83396fc712 Add #![feature(exact_chunks)] to the documentation examples to fix the doc tests 2018-01-13 12:18:51 +02:00
Sebastian Dröge
51d546f4aa Add slice::ExactChunks and ::ExactChunksMut iterators
These guarantee that always the requested slice size will be returned
and any leftoever elements at the end will be ignored. It allows llvm to
get rid of bounds checks in the code using the iterator.

This is inspired by the same iterators provided by ndarray.

See https://github.com/rust-lang/rust/issues/47115
2018-01-13 12:18:46 +02:00
bors
ca092937aa Auto merge of #47181 - michaelwoerister:var-len-def-index, r=eddyb
Use DefIndex encoding that works better with on-disk variable length integer representations.

Use the least instead of the most significant bit for representing the address space.

r? @eddyb
2018-01-13 09:11:59 +00:00
Gauri
eb1ada2781 revert changes to ui test 2018-01-13 13:37:02 +05:30
Gauri
4cedbfc6ee fix mispositioned span 2018-01-13 11:59:35 +05:30
bors
6cf081c8c5 Auto merge of #46592 - o01eg:fix-45345, r=alexcrichton
Fix 45345

There is a fix for https://github.com/rust-lang/rust/issues/45345

It re-introduces `CFG_LIBDIR_RELATIVE` which was broken when migration from `configure` script to `x.py`.

Other commits fix errors which happen after rustbuild cleanups.
2018-01-13 05:02:04 +00:00
Bulat Musin
cee295e8af fix off-by-one error 2018-01-13 07:23:43 +03:00
bors
6eff103aa1 Auto merge of #46461 - zackmdavis:elemental_method_suggestion_jamboree, r=estebank
type error method suggestions use whitelisted identity-like conversions

![method_jamboree_summit](https://user-images.githubusercontent.com/1076988/33523646-e5c43184-d7c0-11e7-98e5-1bff426ade86.png)

Previously, on a type mismatch (and if this wasn't preëmpted by a
higher-priority suggestion), we would look for argumentless methods
returning the expected type, and list them in a `help` note. This had two
major shortcomings: firstly, a lot of the suggestions didn't really make
sense (if you used a &str where a String was expected,
`.to_ascii_uppercase()` is probably not the solution you were hoping
for). Secondly, we weren't generating suggestions from the most useful
traits! We address the first problem with an internal
`#[rustc_conversion_suggestion]` attribute meant to mark methods that keep
the "same value" in the relevant sense, just converting the type. We
address the second problem by making `FnCtxt.probe_for_return_type` pass
the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe
because grep reveals no other callers of `probe_for_return_type`.

Also, structured suggestions are pretty and good for RLS and friends.

Unfortunately, the trait probing is still not all one would hope for: at a
minimum, we don't know how to rule out `into()` in cases where it wouldn't
actually work, and we don't know how to rule in `.to_owned()` where it
would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME.

This is hoped to resolve #42929, #44672, and #45777.
2018-01-13 02:15:19 +00:00