]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoTruncate errors to make tidy happy
Taylor Cramer [Tue, 19 Jun 2018 22:58:10 +0000 (15:58 -0700)]
Truncate errors to make tidy happy

6 years agoFix parse-fail tests that now mention async
Taylor Cramer [Tue, 19 Jun 2018 22:07:52 +0000 (15:07 -0700)]
Fix parse-fail tests that now mention async

6 years agoMove async edition check to the current span
Taylor Cramer [Tue, 19 Jun 2018 20:58:32 +0000 (13:58 -0700)]
Move async edition check to the current span

6 years agoAllow unsafe code inside of await macro
Taylor Cramer [Tue, 19 Jun 2018 17:36:16 +0000 (10:36 -0700)]
Allow unsafe code inside of await macro

6 years agoExplicitly ban async in trait impls
Taylor Cramer [Tue, 19 Jun 2018 17:35:05 +0000 (10:35 -0700)]
Explicitly ban async in trait impls

This wouldn't compile before because the return type wouldn't match,
but now it's properly an error.

6 years agoAsync methods
Taylor Cramer [Tue, 19 Jun 2018 04:18:10 +0000 (21:18 -0700)]
Async methods

6 years agoFix typo in multiple lifetimes error
Taylor Cramer [Mon, 18 Jun 2018 23:57:14 +0000 (16:57 -0700)]
Fix typo in multiple lifetimes error

6 years agoParse `unsafe async fn` instead of `async unsafe fn`
Taylor Cramer [Mon, 18 Jun 2018 23:49:34 +0000 (16:49 -0700)]
Parse `unsafe async fn` instead of `async unsafe fn`

6 years agoasync await desugaring and tests
Taylor Cramer [Wed, 6 Jun 2018 22:50:59 +0000 (15:50 -0700)]
async await desugaring and tests

6 years agoDisplay async fn in rustdoc.
Without Boats [Thu, 17 May 2018 21:47:52 +0000 (14:47 -0700)]
Display async fn in rustdoc.

6 years agoParse async fn header.
Without Boats [Thu, 17 May 2018 05:55:18 +0000 (22:55 -0700)]
Parse async fn header.

This is gated on edition 2018 & the `async_await` feature gate.

The parser will accept `async fn` and `async unsafe fn` as fn
items. Along the same lines as `const fn`, only `async unsafe fn`
is permitted, not `unsafe async fn`.The parser will not accept
`async` functions as trait methods.

To do a little code clean up, four fields of the function type
struct have been merged into the new `FnHeader` struct: constness,
asyncness, unsafety, and ABI.

Also, a small bug in HIR printing is fixed: it previously printed
`const unsafe fn` as `unsafe const fn`, which is grammatically
incorrect.

6 years agoAuto merge of #51463 - estebank:error-codes, r=nikomatsakis
bors [Fri, 22 Jun 2018 03:24:36 +0000 (03:24 +0000)]
Auto merge of #51463 - estebank:error-codes, r=nikomatsakis

Various changes to existing diagnostics

* [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02):
```
error[E0697]: invalid ABI: found `路濫狼á́́`
  --> $DIR/unicode.rs:11:8
   |
LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
   |        ^^^^^^^^^ invalid ABI
   |
   = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
```
* [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08)
* [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464):
```
error[E0277]: `W` does not have a constant size known at compile-time
  --> $DIR/unsized-enum2.rs:33:8
   |
LL |     VA(W),
   |        ^ `W` does not have a constant size known at compile-time
   |
   = help: the trait `std::marker::Sized` is not implemented for `W`
   = help: consider adding a `where W: std::marker::Sized` bound
   = note: no field of an enum variant may have a dynamically sized type
```
```
error[E0277]: `Foo` cannot be sent between threads safely
  --> $DIR/E0277-2.rs:26:5
   |
LL |     is_send::<Foo>();
   |     ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely
   |
   = help: the trait `std::marker::Send` is not implemented for `Foo`
```
```
error[E0277]: can't compare `{integer}` with `std::string::String`
  --> $DIR/binops.rs:16:7
   |
LL |     5 < String::new();
   |       ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String`
   |
   = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}`
```
```
error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>`
  --> $DIR/binops.rs:17:7
   |
LL |     6 == Ok(1);
   |       ^^ no implementation for `{integer} == std::result::Result<{integer}, _>`
   |
   = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}`
```
```
error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32`
  --> $DIR/type-check-defaults.rs:16:19
   |
LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
   |                   ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
   |
   = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
note: required by `Foo`
  --> $DIR/type-check-defaults.rs:15:1
   |
LL | struct Foo<T, U: FromIterator<T>>(T, U);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
* [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8):
```
error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time
  --> $DIR/const-unsized.rs:13:29
   |
LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
   |                             ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time
   |
   = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static`
   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
   = note: constant expressions must have a statically known size
```
* [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)

6 years agoAuto merge of #51433 - scalexm:finish-rules, r=nikomatsakis
bors [Fri, 22 Jun 2018 01:17:52 +0000 (01:17 +0000)]
Auto merge of #51433 - scalexm:finish-rules, r=nikomatsakis

[chalkify] Small refactoring and WF/FromEnv rules for types

r? @nikomatsakis

6 years agoAuto merge of #51690 - nikomatsakis:issue-51683-existential-fail, r=oli-obk
bors [Thu, 21 Jun 2018 23:08:32 +0000 (23:08 +0000)]
Auto merge of #51690 - nikomatsakis:issue-51683-existential-fail, r=oli-obk

do not ICE when existing type info is incomplete

Apparently master is kinda ICE-y right now, but only for some people (sadly that set includes me).

I'm not crazy about this PR, because it seems to regress diagnostics a lot, but it *does* fix the problems. I think probably fixing the diagnostics should be done by doing a better job of suppressing errors?

Mitigates  #51683

r? @oli-obk

6 years agoAuto merge of #48149 - varkor:generics-generalisation, r=petrochenkov
bors [Thu, 21 Jun 2018 20:58:51 +0000 (20:58 +0000)]
Auto merge of #48149 - varkor:generics-generalisation, r=petrochenkov

The Great Generics Generalisation: HIR Edition

This is essentially a followup to https://github.com/rust-lang/rust/pull/45930, consolidating the use of separate lifetime and type vectors into single kinds vectors wherever possible. This is intended to provide more of the groundwork for const generics (https://github.com/rust-lang/rust/issues/44580).

r? @eddyb
cc @yodaldevoid

6 years agotolerate existential types whose concrete expansion is not known
Niko Matsakis [Thu, 21 Jun 2018 20:21:44 +0000 (16:21 -0400)]
tolerate existential types whose concrete expansion is not known

6 years agodo not introduce *false* results from lifetime resolution
Niko Matsakis [Thu, 21 Jun 2018 19:26:44 +0000 (15:26 -0400)]
do not introduce *false* results from lifetime resolution

6 years agoAuto merge of #51680 - Mark-Simulacrum:acc-revert, r=Mark-Simulacrum
bors [Thu, 21 Jun 2018 13:36:37 +0000 (13:36 +0000)]
Auto merge of #51680 - Mark-Simulacrum:acc-revert, r=Mark-Simulacrum

Revert #51662

This reverts that PR because it was never intended to merge into the master branch.

6 years agoRevert "Auto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum"
Mark Simulacrum [Thu, 21 Jun 2018 12:53:26 +0000 (06:53 -0600)]
Revert "Auto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum"

This reverts commit fff1abadd7a4ec861ca4b9c77035379578ef033d, reversing
changes made to 01172a7d137dcba06f190241caadcaabe7c94767.

6 years agoAuto merge of #50336 - japaric:llvm-tools, r=Mark-Simulacrum
bors [Thu, 21 Jun 2018 11:28:14 +0000 (11:28 +0000)]
Auto merge of #50336 - japaric:llvm-tools, r=Mark-Simulacrum

ship LLVM tools with the toolchain

this PR adds llvm-{nm,objcopy,objdump,size} to the rustc sysroot (right next to LLD)

this slightly increases the size of the rustc component. I measured these numbers on x86_64 Linux:

- rustc-1.27.0-dev-x86_64-unknown-linux-gnu.tar.gz 180M -> 193M (+7%)
- rustc-1.27.0-dev-x86_64-unknown-linux-gnu.tar.xz 129M -> 137M (+6%)

r? @alexcrichton
cc #49584

6 years agoAuto merge of #51601 - Emerentius:step_by_range_diet, r=sfackler
bors [Thu, 21 Jun 2018 08:55:13 +0000 (08:55 +0000)]
Auto merge of #51601 - Emerentius:step_by_range_diet, r=sfackler

Specialize StepBy<Range(Inclusive)>

Part of #51557, related to #43064, #31155

As discussed in the above issues, `step_by` optimizes very badly on ranges which is related to
1. the special casing of the first `StepBy::next()` call
2. the need to do 2 additions of `n - 1` and `1` inside the range's `next()`

This PR eliminates both by overriding `next()` to always produce the current element and also step ahead by `n` elements in one go. The generated code is much better, even identical in the case of a `Range` with constant `start` and `end` where `start+step` can't overflow. Without constant bounds it's a bit longer than the manual loop. `RangeInclusive` doesn't optimize as nicely but is still much better than the original asm.
Unsigned integers optimize better than signed ones for some reason.

See the following two links for a comparison.

[godbolt: specialization for ..](https://godbolt.org/g/haHLJr)
[godbolt: specialization for ..=](https://godbolt.org/g/ewyMu6)

`RangeFrom`, the only other range with an `Iterator` implementation can't be specialized like this without changing behaviour due to overflow. There is no way to save "finished-ness".

The approach can not be used in general, because it would produce side effects of the underlying iterator too early.

May obsolete #51435, haven't checked.

6 years agoAuto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
bors [Thu, 21 Jun 2018 04:02:57 +0000 (04:02 +0000)]
Auto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum

[beta] Prepare 1.28.0 beta release

This feels likely to fail due to https://github.com/rust-lang/rust/issues/51650 but I want to see what CI says.

6 years agoFix error-chain warnings
Mark Simulacrum [Wed, 20 Jun 2018 23:04:54 +0000 (17:04 -0600)]
Fix error-chain warnings

6 years agono -Bsymbolic for mac; no static-libstdc++ for windows
Jorge Aparicio [Wed, 20 Jun 2018 22:48:04 +0000 (17:48 -0500)]
no -Bsymbolic for mac; no static-libstdc++ for windows

6 years agoAuto merge of #50698 - Eijebong:tempfile, r=oli-obk
bors [Wed, 20 Jun 2018 22:40:18 +0000 (22:40 +0000)]
Auto merge of #50698 - Eijebong:tempfile, r=oli-obk

Replace tempdir by tempfile

6 years agoFix tidy
Bastien Orivel [Sun, 13 May 2018 13:26:55 +0000 (15:26 +0200)]
Fix tidy

6 years agoReplace tempdir by tempfile in librustc
Bastien Orivel [Sat, 12 May 2018 21:19:35 +0000 (23:19 +0200)]
Replace tempdir by tempfile in librustc

This removes the last dependency on tempdir.

6 years agoReplace tempdir by tempfile in librustc_trans
Bastien Orivel [Tue, 8 May 2018 20:11:58 +0000 (22:11 +0200)]
Replace tempdir by tempfile in librustc_trans

6 years agoReplace tempdir by tempfile in librustdoc
Bastien Orivel [Tue, 8 May 2018 20:06:04 +0000 (22:06 +0200)]
Replace tempdir by tempfile in librustdoc

6 years ago[beta] Prepare 1.28.0 beta release
Mark Simulacrum [Wed, 20 Jun 2018 13:48:06 +0000 (07:48 -0600)]
[beta] Prepare 1.28.0 beta release

6 years agoAuto merge of #51651 - spastorino:fix_var_name_in_e0502, r=nikomatsakis
bors [Wed, 20 Jun 2018 12:46:15 +0000 (12:46 +0000)]
Auto merge of #51651 - spastorino:fix_var_name_in_e0502, r=nikomatsakis

Fix variable name in E0502 double borrow error

Closes #51268

r? @nikomatsakis

6 years agoFix variable name in E0502 double borrow error
Santiago Pastorino [Wed, 20 Jun 2018 04:31:33 +0000 (01:31 -0300)]
Fix variable name in E0502 double borrow error

6 years agoFix rebase issues with existential types
varkor [Wed, 20 Jun 2018 11:34:39 +0000 (12:34 +0100)]
Fix rebase issues with existential types

6 years agoRename ParenthesizedArgData to ParenthesisedArgs
varkor [Sun, 17 Jun 2018 15:04:10 +0000 (16:04 +0100)]
Rename ParenthesizedArgData to ParenthesisedArgs

6 years agoSimplify some counting
varkor [Sat, 16 Jun 2018 10:30:31 +0000 (11:30 +0100)]
Simplify some counting

6 years agoRename ty_param_bound to generic_bound
varkor [Sat, 16 Jun 2018 10:14:07 +0000 (11:14 +0100)]
Rename ty_param_bound to generic_bound

6 years agoUse ty::Generics instead of hir::Generics for various checks
varkor [Fri, 15 Jun 2018 10:45:12 +0000 (11:45 +0100)]
Use ty::Generics instead of hir::Generics for various checks

6 years agoFix additional comments
varkor [Fri, 15 Jun 2018 09:52:46 +0000 (10:52 +0100)]
Fix additional comments

6 years agoFix accidental quadratic loops
varkor [Fri, 15 Jun 2018 09:51:44 +0000 (10:51 +0100)]
Fix accidental quadratic loops

6 years agoRename ty_param_bound to trait_bound
varkor [Thu, 14 Jun 2018 14:00:21 +0000 (15:00 +0100)]
Rename ty_param_bound to trait_bound

6 years agoMake GenericBound explicit
varkor [Thu, 14 Jun 2018 11:23:46 +0000 (12:23 +0100)]
Make GenericBound explicit

6 years agoRename ParamBound(s) to GenericBound(s)
varkor [Thu, 14 Jun 2018 11:08:58 +0000 (12:08 +0100)]
Rename ParamBound(s) to GenericBound(s)

6 years agoAddress various comments
varkor [Thu, 14 Jun 2018 11:05:47 +0000 (12:05 +0100)]
Address various comments

6 years agoLift attrs into hir::GenericParam
varkor [Thu, 14 Jun 2018 10:42:12 +0000 (11:42 +0100)]
Lift attrs into hir::GenericParam

6 years agoRename TraitTyParamBound to ParamBound::Trait
varkor [Thu, 14 Jun 2018 10:25:14 +0000 (11:25 +0100)]
Rename TraitTyParamBound to ParamBound::Trait

6 years agoFix HasAttrs support for GenericParam
varkor [Wed, 13 Jun 2018 12:29:40 +0000 (13:29 +0100)]
Fix HasAttrs support for GenericParam

6 years agoIntroduce ParamName and use it in place of LifetimeName
varkor [Fri, 1 Jun 2018 22:23:48 +0000 (23:23 +0100)]
Introduce ParamName and use it in place of LifetimeName

6 years agoFix NodeLifetime/NodeGenericParam confusion
varkor [Thu, 31 May 2018 21:00:35 +0000 (22:00 +0100)]
Fix NodeLifetime/NodeGenericParam confusion

6 years agoTake advantage of the lifetime refactoring
varkor [Thu, 31 May 2018 14:52:17 +0000 (15:52 +0100)]
Take advantage of the lifetime refactoring

6 years agoRemove name from GenericParamKind::Lifetime
varkor [Wed, 30 May 2018 15:49:39 +0000 (16:49 +0100)]
Remove name from GenericParamKind::Lifetime

6 years agoLift name into GenericParam
varkor [Mon, 28 May 2018 13:55:23 +0000 (14:55 +0100)]
Lift name into GenericParam

6 years agoHandle lifetimes in NodeGenericParam also
varkor [Mon, 28 May 2018 13:05:06 +0000 (14:05 +0100)]
Handle lifetimes in NodeGenericParam also

6 years agoUse ParamBounds in WhereRegionPredicate
varkor [Mon, 28 May 2018 14:23:16 +0000 (15:23 +0100)]
Use ParamBounds in WhereRegionPredicate

6 years agoLift bounds into GenericParam
varkor [Mon, 28 May 2018 12:33:28 +0000 (13:33 +0100)]
Lift bounds into GenericParam

6 years agoSimply joint lifetime/type iteration
varkor [Sun, 27 May 2018 20:54:10 +0000 (21:54 +0100)]
Simply joint lifetime/type iteration

6 years agoRefactor counting methods
varkor [Sun, 27 May 2018 19:37:52 +0000 (20:37 +0100)]
Refactor counting methods

6 years agoRename structures in ast
varkor [Sun, 27 May 2018 19:07:09 +0000 (20:07 +0100)]
Rename structures in ast

6 years agoRefactor generic parameters in rustdoc/clean
varkor [Sun, 27 May 2018 15:56:01 +0000 (16:56 +0100)]
Refactor generic parameters in rustdoc/clean

6 years agoRemove all traces of lifetimes() and types() methods
varkor [Sun, 27 May 2018 00:43:03 +0000 (01:43 +0100)]
Remove all traces of lifetimes() and types() methods

6 years agoRename DefPathData::LifetimeDef to LifetimeParam
varkor [Sat, 26 May 2018 22:56:34 +0000 (23:56 +0100)]
Rename DefPathData::LifetimeDef to LifetimeParam

6 years agoRemove AngleBracketedArgs impl
varkor [Sat, 26 May 2018 22:54:48 +0000 (23:54 +0100)]
Remove AngleBracketedArgs impl

6 years agoRemove methods from ast::GenericParam and ast::Generics
varkor [Sat, 26 May 2018 22:21:08 +0000 (23:21 +0100)]
Remove methods from ast::GenericParam and ast::Generics

6 years agoRefactor ast::GenericParam as a struct
varkor [Sat, 26 May 2018 18:16:21 +0000 (19:16 +0100)]
Refactor ast::GenericParam as a struct

6 years agoRemove hir::GenericParam::is_*_param
varkor [Sat, 26 May 2018 12:22:51 +0000 (13:22 +0100)]
Remove hir::GenericParam::is_*_param

6 years agoRemove specific parameter iterators from hir::Generics
varkor [Sat, 26 May 2018 12:11:39 +0000 (13:11 +0100)]
Remove specific parameter iterators from hir::Generics

6 years agoRefactor hir::GenericParam as a struct
varkor [Fri, 25 May 2018 23:27:54 +0000 (00:27 +0100)]
Refactor hir::GenericParam as a struct

6 years agoRename ast::GenericParam and ast::GenericArg
varkor [Fri, 25 May 2018 17:41:03 +0000 (18:41 +0100)]
Rename ast::GenericParam and ast::GenericArg

It's so confusing to have everything having the same name, at least while refactoring.

6 years agoMake method and variable names more consistent
varkor [Wed, 16 May 2018 11:57:45 +0000 (12:57 +0100)]
Make method and variable names more consistent

6 years agoRename "parameter" to "arg"
varkor [Fri, 23 Feb 2018 17:48:54 +0000 (17:48 +0000)]
Rename "parameter" to "arg"

6 years agoRename PathParameter(s) to GenericArg(s)
varkor [Tue, 13 Feb 2018 11:32:37 +0000 (11:32 +0000)]
Rename PathParameter(s) to GenericArg(s)

6 years agoAbstract walk_path_parameters
varkor [Sun, 25 Feb 2018 13:46:45 +0000 (13:46 +0000)]
Abstract walk_path_parameters

6 years agoRename *Parameter to *Param
varkor [Mon, 12 Feb 2018 21:44:05 +0000 (21:44 +0000)]
Rename *Parameter to *Param

6 years agoConsolidate PathParameters and AngleBracketedParameterData
varkor [Thu, 8 Feb 2018 08:58:13 +0000 (08:58 +0000)]
Consolidate PathParameters and AngleBracketedParameterData

6 years agoAuto merge of #51638 - spastorino:diagnostic-suggest-drop-in-reverse, r=nikomatsakis
bors [Wed, 20 Jun 2018 09:30:02 +0000 (09:30 +0000)]
Auto merge of #51638 - spastorino:diagnostic-suggest-drop-in-reverse, r=nikomatsakis

Diagnostic suggest drop in reverse

Closes #51195

6 years agoAuto merge of #51644 - Sgeo:patch-1, r=rkruppe
bors [Wed, 20 Jun 2018 06:54:17 +0000 (06:54 +0000)]
Auto merge of #51644 - Sgeo:patch-1, r=rkruppe

Remove erroneous example of main as a non-Result function.

6 years agoAuto merge of #51631 - WiSaGaN:patch-1, r=Mark-Simulacrum
bors [Wed, 20 Jun 2018 03:46:05 +0000 (03:46 +0000)]
Auto merge of #51631 - WiSaGaN:patch-1, r=Mark-Simulacrum

Fix links in RELEASES.md

6 years agoAuto merge of #51617 - nnethercote:nll-allocs, r=pnkfelix
bors [Wed, 20 Jun 2018 01:39:43 +0000 (01:39 +0000)]
Auto merge of #51617 - nnethercote:nll-allocs, r=pnkfelix

Reduce number of allocations done by NLL

A couple of easy wins. Here are the NLL speedups that exceed 1%:
```
sentry-cli-check
        avg: -3.5%      min: -3.5%      max: -3.5%
inflate-check
        avg: -1.9%      min: -1.9%      max: -1.9%
inflate
        avg: -1.7%      min: -1.7%      max: -1.7%
clap-rs-check
        avg: -1.6%      min: -1.6%      max: -1.6%
cargo-check
        avg: -1.6%      min: -1.6%      max: -1.6%
ripgrep-check
        avg: -1.4%      min: -1.4%      max: -1.4%
serde-check
        avg: -1.2%      min: -1.2%      max: -1.2%
regex-check
        avg: -1.0%      min: -1.0%      max: -1.0%
sentry-cli
        avg: -1.0%      min: -1.0%      max: -1.0%
```
r? @nikomatsakis

6 years agoUpdate error code numbers
Esteban Küber [Tue, 19 Jun 2018 23:22:37 +0000 (16:22 -0700)]
Update error code numbers

6 years agoUpdate message for `!Sized` types
Esteban Küber [Tue, 19 Jun 2018 22:53:51 +0000 (15:53 -0700)]
Update message for `!Sized` types

6 years agoRun rustfmt
Santiago Pastorino [Wed, 20 Jun 2018 00:22:52 +0000 (21:22 -0300)]
Run rustfmt

6 years agoSuggest that values are dropped in the opposite order they are defined
Santiago Pastorino [Wed, 13 Jun 2018 17:51:53 +0000 (14:51 -0300)]
Suggest that values are dropped in the opposite order they are defined

6 years agoAuto merge of #51639 - SimonSapin:missing-alloc, r=rkruppe
bors [Tue, 19 Jun 2018 23:37:09 +0000 (23:37 +0000)]
Auto merge of #51639 - SimonSapin:missing-alloc, r=rkruppe

Update the error message for a missing global allocator

Don’t mention `#[default_lib_allocator]` (which is an implementation detail irrelevant to most users) and  instead suggest using `#[global_allocator]`, which is often the correct fix.

6 years agoAdd test for updated parser error
Esteban Küber [Tue, 19 Jun 2018 18:34:20 +0000 (11:34 -0700)]
Add test for updated parser error

6 years agoRemove erroneous example of main as a non-Result function.
Sgeo [Tue, 19 Jun 2018 22:32:44 +0000 (18:32 -0400)]
Remove erroneous example of main as a non-Result function.

6 years agoFix tidy and remove unused method
Esteban Küber [Sun, 10 Jun 2018 02:00:32 +0000 (19:00 -0700)]
Fix tidy and remove unused method

6 years agoPoint to previous line for single expected token
Esteban Küber [Sun, 10 Jun 2018 01:39:14 +0000 (18:39 -0700)]
Point to previous line for single expected token

6 years agoAdd link to book for `Sized` errors
Esteban Küber [Sun, 10 Jun 2018 01:37:52 +0000 (18:37 -0700)]
Add link to book for `Sized` errors

6 years agoAdd message to `rustc_on_unimplemented` attributes in core
Esteban Küber [Sat, 9 Jun 2018 23:53:36 +0000 (16:53 -0700)]
Add message to `rustc_on_unimplemented` attributes in core

6 years agoAuto merge of #51275 - pnkfelix:nll-diagnostics-revise-check-access-permissions,...
bors [Tue, 19 Jun 2018 21:31:36 +0000 (21:31 +0000)]
Auto merge of #51275 - pnkfelix:nll-diagnostics-revise-check-access-permissions, r=nikomatsakis

NLL diagnostics: revise `fn check_access_permissions`

NLL: revise `fn check_access_permissions` so that its (still branchy) shares more code paths between the different cases, and also provide more diagnostics in more cases (though the added diagnostics still do not always meet the quality bar established by AST-borrowck)

----

Transcribing "checklist" suggested by Niko, except I am rendering it as a table to make it clear that I do not regard every item in the list to be a "must have" for landing this PR.

goal | does this PR do it?
-----|------------------------------
no suggestions for `ref mut` |  yes
suggestions for direct local assignment (`{ let x = 3; x = 4; }`) | yes (see commits at end)
suggestions for direct field assignment (`{ let x = (3, 4); x.0 = 5; }` | yes (see commits at end)
suggestions for upvars (`let x = 3; let c = \|\| { &mut x; }`) | yes

Note that I added support for a couple of rows via changes that are not strictly part of `fn check_access_permissions`. If desired I can remove those commits from this PR and leave them for a later PR.

Fix #51031
Fix #51032
(bug #51191 needs a little more investigation before closing.)
Fix #51578

6 years agoAuto merge of #51543 - SimonSapin:oom, r=SimonSapin
bors [Tue, 19 Jun 2018 19:22:12 +0000 (19:22 +0000)]
Auto merge of #51543 - SimonSapin:oom, r=SimonSapin

Rename OOM to allocation error

The acronym is not descriptive unless one has seen it before.

* Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle.
* Rename `set_oom_hook` to `set_alloc_error_hook`
* Rename `take_oom_hook` to `take_alloc_error_hook`

Bikeshed: `on` v.s. `for`, `alloc` v.s. `allocator`, `error` v.s. `failure`

6 years agoAdd code to incorrect `pub` restriction error
Esteban Küber [Sat, 9 Jun 2018 23:08:47 +0000 (16:08 -0700)]
Add code to incorrect `pub` restriction error

6 years agoAdd code to `invalid ABI` error
Esteban Küber [Sat, 9 Jun 2018 22:44:32 +0000 (15:44 -0700)]
Add code to `invalid ABI` error

6 years agoUpdate the error message for a missing global allocator
Simon Sapin [Tue, 19 Jun 2018 18:10:56 +0000 (20:10 +0200)]
Update the error message for a missing global allocator

Don’t mention `#[default_lib_allocator]` (which is an implementation detail
irrelevant to most users) and instead suggest using `#[global_allocator]`,
which is often the correct fix.

6 years agoAdd a UI test for the missing allocator error message
Simon Sapin [Tue, 19 Jun 2018 17:44:18 +0000 (19:44 +0200)]
Add a UI test for the missing allocator error message

6 years agoAdd unit test for case that didn't seem to be covered in existing UI tests
Felix S. Klock II [Fri, 15 Jun 2018 03:51:42 +0000 (05:51 +0200)]
Add unit test for case that didn't seem to be covered in existing UI tests
(since I made this mistake at first but the tests didn't catch it):
we should not suggest adding `mut` to a reassigned `ref` or `ref mut` binding.

(The Rust language, since at least 1.0, does not have `mut ref mut` or
`ref mut mut` etc.)

6 years agoUpdate the existing compile-fail tests to reflect diagnostic changes in NLL.
Felix S. Klock II [Fri, 15 Jun 2018 03:49:53 +0000 (05:49 +0200)]
Update the existing compile-fail tests to reflect diagnostic changes in NLL.

6 years agoUpdate the existing UI tests to reflect diagnostic changes in NLL.
Felix S. Klock II [Fri, 15 Jun 2018 03:49:29 +0000 (05:49 +0200)]
Update the existing UI tests to reflect diagnostic changes in NLL.

6 years agoAdded diagnostics for suggesting `mut x` on repeated mutations of `x`.
Felix S. Klock II [Fri, 15 Jun 2018 03:47:36 +0000 (05:47 +0200)]
Added diagnostics for suggesting `mut x` on repeated mutations of `x`.

(Follow-on commits updating the test suite show the resulting changes
to diagnostic output.)

6 years agoupdates to compile-fail tests for changes to NLL.
Felix S. Klock II [Tue, 12 Jun 2018 17:12:19 +0000 (19:12 +0200)]
updates to compile-fail tests for changes to NLL.

6 years agoNLL: Updates to diagnostic output in `test/ui`.
Felix S. Klock II [Tue, 12 Jun 2018 16:01:48 +0000 (18:01 +0200)]
NLL: Updates to diagnostic output in `test/ui`.