73692 Commits

Author SHA1 Message Date
Esteban Küber
afe8d13a66 Use single source of truth for expr precedence
Introduce a new unified type that holds the expression precedence for
both AST and HIR nodes.
2018-01-15 02:02:37 -08:00
Guillaume Gomez
c8a110ed63 Add error code for unstable feature errors 2018-01-15 10:28:00 +01:00
Ryan Cumming
ecd47a91c7 Don't include bang in macro replacement suggestion
When we suggest the replacement for a macro we include the "!" in the
suggested replacement but the span only contains the name of the macro
itself. Using that replacement would cause a duplicate "!" in the
resulting code.

I originally tried to extend the span to be replaced by 1 byte in
rust-lang/rust#47424. However, @zackmdavis pointed out that there can be
whitespace between the macro name and the bang.

Instead, just remove the bang from the suggested replacement.

Fixes #47418
2018-01-15 18:09:52 +11:00
bors
8ff449d505 Auto merge of #47329 - davidtwco:issue-46983, r=nikomatsakis
NLL: bad error message when converting anonymous lifetime to `'static`

Fixes #46983.

r? @nikomatsakis
2018-01-15 06:52:12 +00:00
Esteban Küber
09efaaf076 Use s::u::p::expr_precedence and fix message
- Use `syntax::util::parser::expr_precedence` to determine wether
   parenthesis are needed around the casting target.
 - Update message to not incorrectly mention rounding on `.into()`
   suggestions, as those types that do have that implemented will never
   round.
2018-01-14 22:46:24 -08:00
Esteban Küber
509ea8efc6 Only suggest casting numeric types using into() 2018-01-14 22:46:24 -08:00
Esteban Küber
af91d9955b Use into for casting when possible 2018-01-14 22:46:24 -08:00
Esteban Küber
aec16237e4 Suggest casting on numeric type error 2018-01-14 22:46:23 -08:00
Fenrir
1482afbbed Remove leftover Rand stuff 2018-01-14 23:09:53 -07:00
bors
bb345a0be3 Auto merge of #46196 - projektir:rbe-submodule, r=steveklabnik
Adding RBE as a submodule #46194

Adding RBE as a submodule to start issue #46194.
2018-01-15 02:02:22 +00:00
varkor
394b95fdd6 Fix test 2018-01-15 00:09:39 +00:00
Guillaume Gomez
e2bd0e15dc Update html-diff crate => fix unicode parsing and invalid paths 2018-01-15 00:40:49 +01:00
Ryan Cumming
46c59aef62 Make ui-fulldeps/update-references executable
When a ui-fulldeps comparison fails it suggests running
update-references.sh:

```
src/test/ui-fulldeps/update-references.sh 'rust/build/x86_64-apple-darwin/test/ui-fulldeps' 'resolve-error.rs'
```

This does not work as update-references.sh isn't executable. The other
update-references.sh in the ui directory is already executable so this looks
like an oversight.
2018-01-15 08:09:55 +11:00
varkor
2ccc82e27e Make dump_mir_dir non-optional 2018-01-14 20:02:07 +00:00
varkor
a22e71685a Add a default directory for -Zmir-dump-dir
The current behaviour of dumping in the current directory is rarely
desirable: a sensible default directory for dumping is much more
convenient.
2018-01-14 17:15:39 +00:00
bors
3f92e8d898 Auto merge of #46455 - petrochenkov:pimpl, r=nikomatsakis
syntax: Rewrite parsing of impls

Properly parse impls for the never type `!`
Recover from missing `for` in `impl Trait for Type`
Prohibit inherent default impls and default impls of auto traits (https://github.com/rust-lang/rust/issues/37653#issuecomment-348687794, https://github.com/rust-lang/rust/issues/37653#issuecomment-348688785)
Change wording in more diagnostics to use "auto traits"
Fix some spans in diagnostics
Some other minor code cleanups in the parser
Disambiguate generics and qualified paths in impls (parse `impl <Type as Trait>::AssocTy { ... }`)
Replace the future-compatibility hack from https://github.com/rust-lang/rust/pull/38268 with actually parsing generic parameters
Add a test for https://github.com/rust-lang/rust/issues/46438
2018-01-14 16:56:15 +00:00
Vadim Petrochenkov
60c48dd16a syntax: Disambiguate generics and qualified paths 2018-01-14 18:10:19 +03:00
Vadim Petrochenkov
d19e4c4a85 syntax: Rewrite parsing of impls
Properly parse impls for the never type `!`
Recover from missing `for` in `impl Trait for Type`
Prohibit inherent default impls and default impls of auto traits
Change wording in more diagnostics to use "auto traits"
Some minor code cleanups in the parser
2018-01-14 18:10:05 +03:00
bors
adc9d86363 Auto merge of #47322 - nikomatsakis:nll-ice, r=pnkfelix
resolve type and region variables in "NLL dropck"

Fixes #47022.

r? @pnkfelix
2018-01-14 14:11:59 +00:00
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
Ariel Ben-Yehuda
98fbccee0c fix comments 2018-01-13 23:41:11 +02: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
Ariel Ben-Yehuda
c1281b41ec check_match: fix handling of privately uninhabited types
the match-checking code used to use TyErr for signaling "unknown,
inhabited" types for a long time. It had been switched to using the
exact type in #38069, to handle uninhabited types.

However, in #39980, we discovered that we still needed the "unknown
inhabited" logic, but I used `()` instead of `TyErr` to handle that.
Revert to using `TyErr` to fix that problem.
2018-01-13 21:17:19 +02: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