Commit Graph

4640 Commits

Author SHA1 Message Date
bors
b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
David Wood
ee82d09b6c
Check user type annotations for range patterns.
This commit builds on the fix from #58161 (which fixed miscompilation
caused by the introduction of `AscribeUserType` patterns for associated
constants) to start checking these patterns are well-formed for ranges
(previous fix just ignored them so that miscompilation wouldn't occur).
2019-02-12 19:37:54 +01:00
Alexander Regueiro
370f1f26ce Added tests. 2019-02-12 14:33:58 +00:00
bors
c84e797642 Auto merge of #58098 - oli-obk:maybe_allow_internal_unstable, r=petrochenkov
Require a list of features in `#[allow_internal_unstable]`

The blanket-permission slip is not great and will likely give us trouble some point down the road.
2019-02-12 12:10:10 +00:00
bors
16ca0b9f63 Auto merge of #58180 - davidtwco:issue-58053, r=estebank
Fix span for closure return type when annotated.

Fixes #58053.

This PR adjusts the span used to label closure return types so that
if the user specifies the return type, i.e. `|_| -> X {}` instead of
`|_| {}`, we correctly highlight all of it and not just the last
character.

r? @pnkfelix
2019-02-12 00:44:24 +00:00
Esteban Küber
87dd2e1df9 Use hidden suggestions for unused imports lint 2019-02-11 11:16:22 -08:00
David Wood
48b0c9da69
Only suggest imports if not imported.
This commit modifies name resolution error reporting so that if a name
is in scope and has been imported then we do not suggest importing it.

This can occur when we add a label about constructors not being visible
due to private fields. In these cases, we know that the struct/variant
has been imported and we should silence any suggestions to import the
struct/variant.
2019-02-11 19:29:10 +01:00
Oliver Scherer
d3c212c552 Require a list of features to allow in allow_internal_unstable 2019-02-11 15:08:16 +01:00
varkor
b5fa870760 Add a test for rustc_deprecated 2019-02-11 13:18:33 +00:00
varkor
3737d4d87d Do not apply future deprecation warning for #[deprecated] 2019-02-11 11:17:35 +00:00
bors
57d7cfc3cf Auto merge of #56645 - pietroalbini:fix-unused-imports, r=estebank
Initial implementation of rustfixable unused_imports lint

This PR adds the initial implementation of rustfixable `unused_imports` lint. The implementation works, but rustfix is not able to apply all the suggestions until https://github.com/rust-lang/rust/issues/53934 is fixed. It also needs https://github.com/rust-lang/rust/pull/58296 to hide the suggested note since it's really useless.

cc https://github.com/rust-lang/rust/issues/47888

<details><summary><code>cargo fix</code> in action on the <code>unused_imports</code> lint</summary>

![screenshot from 2018-12-09 15-49-01](https://user-images.githubusercontent.com/2299951/49698874-3a026080-fbca-11e8-9bf1-24060b6c59c8.png)

</details>
2019-02-11 10:34:09 +00:00
Alexander Regueiro
f943296a76 Re-blessed tests. 2019-02-10 23:57:26 +00:00
Alexander Regueiro
b87363e763 tests: doc comments 2019-02-10 23:42:32 +00:00
bors
3315728c06 Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obk
Deduplicate mismatched delimiter errors

Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently.

Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-09 20:15:57 +00:00
bors
4c9233cdeb Auto merge of #57885 - arielb1:xform-probe, r=nikomatsakis
Avoid committing to autoderef in object method probing

This fixes the "leak" introduced in #57835 (see test for details, also apparently #54252 had no tests for the "leaks" that were fixed in it, so go ahead and add one).

Maybe beta-nominating because regression, but I'm against landing things on beta we don't have to.

r? @nikomatsakis
2019-02-09 15:11:43 +00:00
bors
618f5a08a1 Auto merge of #57617 - mark-i-m:multiple-matcher-bindings, r=petrochenkov
Error on duplicate matcher bindings

fix  #57593

This should not be merged without a crater run and maybe an FCP. Discussion is ongoing at  #57593.

TODO:
- [x] write tests
- [x] crater run
- [x] ~maybe need edition gating?~ not for 1 regression /centril

r? @petrochenkov
2019-02-09 09:48:41 +00:00
bors
a2ec156a5b Auto merge of #58161 - davidtwco:issue-57960, r=arielb1
Lower constant patterns with ascribed types.

Fixes #57960.

This PR fixes a bug introduced by #55937 which started checking user
type annotations for associated type patterns. Where lowering a
associated constant expression would previously return a
`PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType`
with a `PatternKind::Constant` inside, this PR unwraps that to
access the constant pattern inside and behaves as before.

r? @pnkfelix
2019-02-08 17:13:56 +00:00
gnzlbg
94defa9364 Add simd_saturating_{add,sub} intrinsics 2019-02-08 16:53:53 +01:00
Esteban Küber
802c897eb3 review comments: (marginally) reduce memory consumtion 2019-02-08 06:37:29 -08:00
varkor
03d4fd973a Use descriptive variant name 2019-02-08 14:30:13 +01:00
Esteban Küber
fb3c4fbfc3 Fix nll test output 2019-02-08 01:16:56 -08:00
Pietro Albini
5ef71508fe
unused_imports: update tests 2019-02-08 08:44:56 +01:00
Esteban Küber
7eb6a2a972 Add test for type mismatch on first match arm 2019-02-07 16:12:12 -08:00
Igor Sadikov
f753d304c6 Suggest removing parentheses surrounding lifetimes 2019-02-07 16:13:19 -05:00
Mark Mansi
c25d6b8344 update test 2019-02-07 12:17:27 -06:00
Mark Mansi
802b256283 Make it an incompatibility lint for now 2019-02-07 12:17:27 -06:00
mark
3e790a7c30 add a test 2019-02-07 12:15:32 -06:00
mark
1d94cc2a22 fix existing tests 2019-02-07 12:15:31 -06:00
varkor
05f0dee04a Improve the error messages for missing stability attributes
This makes the capitalisation consistent and provides more context (especially for missing top-level attributes).
2019-02-07 19:08:30 +01:00
varkor
f2fe71c02a Resolve incorrect diagnostic for using a non-const value in a constant 2019-02-07 16:03:12 +01:00
varkor
1b933a5ce9 Add a test forbidding the use of const parameters in inner items 2019-02-07 15:03:20 +01:00
varkor
4e0e188999 Make name resolution handle consts in GenericParamsFromOuterFunction properly 2019-02-07 15:03:20 +01:00
varkor
451f128783 Parse negative literals in const generic arguments 2019-02-07 15:03:20 +01:00
varkor
9ad04b9960 Add warning for a parameter list with an attribute but no parameters 2019-02-07 15:03:20 +01:00
varkor
dbc7924b3f Add test for generic parameter list solely containing an attribute 2019-02-07 15:03:20 +01:00
varkor
61f35f0641 Adjust generic const param resolution 2019-02-07 15:03:20 +01:00
varkor
bbdcc4e7ce Adjust parser generic parameter errors 2019-02-07 15:02:17 +01:00
varkor
7461a5e655 Fix ast_validation printing of const generics 2019-02-07 15:02:17 +01:00
varkor
bf2f62cb98 Add test for const parameter before other generic parameters 2019-02-07 15:02:17 +01:00
varkor
ed51b6148f Add test for const parameter depending on type parameter 2019-02-07 15:02:17 +01:00
varkor
2f73245ca4 Add test forbidding const parameters in const fn 2019-02-07 15:02:17 +01:00
varkor
455d659e91 Update tests
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07 15:02:17 +01:00
varkor
8fd5979006 Add const generics feature gate test
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07 15:02:17 +01:00
Esteban Küber
9e934e2215 Reweork incompatible match arms error
- Point at the body expression of the match arm with the type error.
- Point at the prior match arms explicitely stating the evaluated type.
- Point at the entire match expr in a secondary span, instead of primary.
- For type errors in the first match arm, the cause is outside of the
  match, treat as implicit block error to give a more appropriate error.
2019-02-07 05:39:54 -08:00
bors
ad433894ab Auto merge of #58010 - Zoxc:parallel-passes, r=michaelwoerister
Move privacy checking later in the pipeline and make some passes run in parallel

r? @michaelwoerister
2019-02-07 09:49:08 +00:00
Esteban Küber
6e62129b36 add doc comment and revert angle bracket change 2019-02-07 01:42:54 -08:00
Esteban Küber
336c48cc7b tweak wording based on in person feedback 2019-02-07 01:42:54 -08:00
Esteban Küber
c086bafc8f Update test output after rebase 2019-02-07 01:42:54 -08:00
Esteban Küber
60459429c5 Add missing trailing newline 2019-02-07 01:42:54 -08:00
Esteban Küber
1495d30448 Remove spurious complaint about missing expression for bare semicolons 2019-02-07 01:42:54 -08:00
Esteban Küber
7451cd8dc0 Deduplicate mismatched delimiter errors
Delay unmatched delimiter errors until after the parser has run to
deduplicate them when parsing and attempt recovering intelligently.
2019-02-07 01:41:30 -08:00
bors
825f355c74 Auto merge of #57998 - niklasf:align-enum, r=nagisa
Allow #[repr(align(x))] on enums (#57996)

Tracking issue: #57996

Implements an extension of [RFC 1358](https://github.com/rust-lang/rfcs/blob/master/text/1358-repr-align.md) behind a feature flag (`repr_align_enum`). Originally introduced here for structs: #39999.

It seems like only HIR-level changes are required, since enums are already aware of their alignment (due to alignment of their limbs).

cc @bitshifter
2019-02-07 04:26:08 +00:00
David Wood
6717727fcb
Lower constant patterns with ascribed types.
This commit fixes a bug introduced by #55937 which started checking user
type annotations for associated type patterns. Where lowering a
associated constant expression would previously return a
`PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType`
with a `PatternKind::Constant` inside, this commit unwraps that to
access the constant pattern inside and behaves as before.
2019-02-06 21:10:43 +01:00
Clint Frederickson
d4c52bfb17 error output updated by ./x.py test --stage 1 src/test/ui --incremental --bless 2019-02-06 08:42:21 -07:00
bors
b139669f37 Auto merge of #56123 - oli-obk:import_miri_from_future, r=eddyb
Add a forever unstable opt-out of const qualification checks

r? @eddyb

cc @RalfJung @Centril

basically a forever unstable way to screw with const things in horribly unsafe, unsound and incoherent ways.

Note that this does *not* affect miri except by maybe violating assumptions that miri makes. But there's no change in how miri evaluates things.
2019-02-06 08:42:46 +00:00
bors
2596bc1368 Auto merge of #58061 - nnethercote:overhaul-syntax-Folder, r=petrochenkov
Overhaul `syntax::fold::Folder`.

This PR changes `syntax::fold::Folder` from a functional style
(where most methods take a `T` and produce a new `T`) to a more
imperative style (where most methods take and modify a `&mut T`), and
renames it `syntax::mut_visit::MutVisitor`.

This makes the code faster and more concise.
2019-02-06 06:01:37 +00:00
Nicholas Nethercote
9fcb1658ab Overhaul syntax::fold::Folder.
This commit changes `syntax::fold::Folder` from a functional style
(where most methods take a `T` and produce a new `T`) to a more
imperative style (where most methods take and modify a `&mut T`), and
renames it `syntax::mut_visit::MutVisitor`.

The first benefit is speed. The functional style does not require any
reallocations, due to the use of `P::map` and
`MoveMap::move_{,flat_}map`. However, every field in the AST must be
overwritten; even those fields that are unchanged are overwritten with
the same value. This causes a lot of unnecessary memory writes. The
imperative style reduces instruction counts by 1--3% across a wide range
of workloads, particularly incremental workloads.

The second benefit is conciseness; the imperative style is usually more
concise. E.g. compare the old functional style:
```
fn fold_abc(&mut self, abc: ABC) {
    ABC {
        a: fold_a(abc.a),
        b: fold_b(abc.b),
        c: abc.c,
    }
}
```
with the imperative style:
```
fn visit_abc(&mut self, ABC { a, b, c: _ }: &mut ABC) {
    visit_a(a);
    visit_b(b);
}
```
(The reductions get larger in more complex examples.)

Overall, the patch removes over 200 lines of code -- even though the new
code has more comments -- and a lot of the remaining lines have fewer
characters.

Some notes:

- The old style used methods called `fold_*`. The new style mostly uses
  methods called `visit_*`, but there are a few methods that map a `T`
  to something other than a `T`, which are called `flat_map_*` (`T` maps
  to multiple `T`s) or `filter_map_*` (`T` maps to 0 or 1 `T`s).

- `move_map.rs`/`MoveMap`/`move_map`/`move_flat_map` are renamed
  `map_in_place.rs`/`MapInPlace`/`map_in_place`/`flat_map_in_place` to
  reflect their slightly changed signatures.

- Although this commit renames the `fold` module as `mut_visit`, it
  keeps it in the `fold.rs` file, so as not to confuse git. The next
  commit will rename the file.
2019-02-06 09:06:27 +11:00
Clint Frederickson
a15916b245 [WIP] add better error message for partial move 2019-02-05 13:56:29 -07:00
Andy Russell
113b7f7be1
allow shorthand syntax for deprecation reason 2019-02-05 15:26:26 -05:00
kennytm
3abb03fdb3
Rollup merge of #58138 - ishitatsuyuki:stability-delay, r=estebank
Fix #58101
2019-02-06 00:29:08 +09:00
Oliver Scherer
c93bce85e5 Add more tests 2019-02-05 14:18:09 +01:00
David Wood
b377d0b14c
Fix span for closure return type when annotated.
This commit adjusts the span used to label closure return types so that
if the user specifies the return type, i.e. `|_| -> X {}` instead of
`|_| {}`, we correctly highlight all of it and not just the last
character.
2019-02-05 11:10:04 +01:00
bors
b2c6b8c29f Auto merge of #57973 - davidtwco:issue-52891, r=estebank
Add suggestion for duplicated import.

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
2019-02-05 05:14:15 +00:00
ishitatsuyuki
652f2c753a Add test 2019-02-04 19:26:46 +09:00
David Wood
7102339477
Update visibility of intermediate use items.
Currently, the target of a use statement will be updated with
the visibility of the use statement itself (if the use statement was
visible).

This commit ensures that if the path to the target item is via another
use statement then that intermediate use statement will also have the
visibility updated like the target. This silences incorrect
`unreachable_pub` lints with inactionable suggestions.
2019-02-02 15:29:13 +01:00
bors
852701ad6d Auto merge of #57978 - varkor:fix-irrefutable-integer-range-match, r=oli-obk
Fix bug in integer range matching

Fixes #57894.
2019-02-01 20:57:36 +00:00
varkor
cd1047e0d4 Fix bug in integer range matching 2019-02-01 20:02:21 +00:00
Niko Matsakis
9d2a0b9e82 add regression test for #57979 2019-02-01 12:28:10 -05:00
Oliver Scherer
f2241f640b Make the existential type errors a little bit more helpful 2019-02-01 16:39:50 +01:00
Oliver Scherer
984688ace3 Test more related cases 2019-02-01 16:39:50 +01:00
Oliver Scherer
6f83dcc192 Restrict concrete types to equivalent types 2019-02-01 16:39:50 +01:00
Oliver Scherer
cf01b514c8 Generic type parameters are flexible even for existential types 2019-02-01 16:38:46 +01:00
Oliver Scherer
0d25ff8842 Test aller things 2019-02-01 16:38:46 +01:00
Oliver Scherer
ed10a5ba01 Test all the things 2019-02-01 16:38:46 +01:00
Oliver Scherer
6982fd21d1 Be more permissive with required bounds on existential types 2019-02-01 16:38:46 +01:00
bors
742fcc7167 Auto merge of #57586 - Aaron1011:feature/pub-priv-dep, r=petrochenkov
Implement public/private dependency feature

Implements https://github.com/rust-lang/rust/issues/44663

The core implementation is done - however, there are a few issues that still need to be resolved:

- [x] The `EXTERNAL_PRIVATE_DEPENDENCY` lint currently does notthing when the `public_private_dependencies` is not enabled. Should mentioning the lint (in an `allow` or `deny` attribute) be an error if the feature is not enabled? (Resolved- the feature was removed)
- [x] Crates with the name `core` and `std` are always marked public, without the need to explcitily specify them on the command line. Is this what we want to do? Do we want to allow`no_std`/`no_core` crates to explicitly control this in some way? (Resolved - private crates are now explicitly specified)
- [x] Should I add additional UI tests? (Resolved - added more tests)
- [x] Does it make sense to be able to allow/deny the `EXTERNAL_PRIVATE_DEPENDENCY` on an individual item? (Resolved - this is implemented)
2019-02-01 15:24:26 +00:00
Aaron Hill
541d315313
Update tests for future-compat warning removal 2019-02-01 09:43:57 -05:00
Aaron Hill
a05bfc6aeb
Test allowing individual struct field 2019-02-01 09:43:57 -05:00
Aaron Hill
48ec29d38e
Replace --extern-public with --extern-private 2019-02-01 09:43:57 -05:00
Aaron Hill
b29a21fbae
Remove feature from test 2019-02-01 09:43:57 -05:00
Aaron Hill
3fa36471e8
Rename external_private_dependency to exported_private_dependencies 2019-02-01 09:43:56 -05:00
Aaron Hill
bc2221f7b6
Add test for 'std' crate being public 2019-02-01 09:43:56 -05:00
Aaron Hill
d60214cdf7
Clippy fixes, rename stuff to match RFC 2019-02-01 09:43:56 -05:00
Aaron Hill
12f9b796ff
Improve UI tests 2019-02-01 09:43:56 -05:00
Aaron Hill
93d872dbc8
Add UI test 2019-02-01 09:43:56 -05:00
bors
c9a8687951 Auto merge of #57916 - Zoxc:incr-passes4, r=michaelwoerister
Misc performance tweaks

r? @michaelwoerister
2019-02-01 12:52:54 +00:00
bors
741a3d42cb Auto merge of #58002 - oli-obk:deprecated_sugg, r=zackmdavis
Add suggestions to deprecation lints

Clippy used to do this suggestion, but the clippy lints happen after the deprecation lints so we ended up never seeing the structured suggestions.
2019-02-01 01:06:15 +00:00
Niklas Fiekas
73bf0703a7 Add more tests for #[repr(align(x))] on enums 2019-01-31 14:18:51 +01:00
Oliver Scherer
d0129a613c Add a forever unstable opt-out of const qualification checks 2019-01-31 14:03:01 +01:00
David Wood
1595163356
Add suggestion for duplicated import.
This commit adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
2019-01-31 12:01:28 +01:00
Mazdak Farrokhzad
877dee7c67
Rollup merge of #58008 - matthewjasper:places-conflict-args, r=oli-obk
Pass correct arguments to places_conflict

The borrow place *must* be a place that we track borrows for, otherwise
we will likely ICE.

Closes #57989
2019-01-31 02:10:53 +01:00
Mazdak Farrokhzad
bc7be96cb9
Rollup merge of #58007 - estebank:issue-58006, r=petrochenkov
Don't panic when accessing enum variant ctor using `Self` in match

Fix #58006.

r? @petrochenkov
2019-01-31 02:10:52 +01:00
Mazdak Farrokhzad
bb91a192c0
Rollup merge of #57999 - jethrogb:jb/movbe-feature, r=alexcrichton
Add MOVBE x86 CPU feature

I have no idea if this is correct. I basically copied the ADX feature. I verified the feature is also called `movbe` in LLVM.

I marked this to become stable immediately, as part of the RFC 2045.

r? @alexcrichton
2019-01-31 02:10:49 +01:00
Mazdak Farrokhzad
ab844daadb
Rollup merge of #57008 - Knium:misleading-try-adding-parentheses-in-match-with-comma, r=oli-obk
suggest `|` when `,` founds in invalid match value

Issue #54807
I get stuck on (what | how) I should implement...
2019-01-31 02:10:40 +01:00
John Kåre Alsaker
38bcd4b42a Move privacy checking later in the pipeline and make some passes run in parallel 2019-01-30 21:19:02 +01:00
Matthew Jasper
6fe370c7ce Pass correct arguments to places_conflict
The borrow place *must* be a place that we track borrows for, otherwise
we will likely ICE.
2019-01-30 19:49:31 +00:00
Esteban Küber
74675fed68 Don't panic when accessing enum variant ctor using Self in match 2019-01-30 11:39:56 -08:00
Oliver Scherer
4056b575e2 Add suggestions to deprecation lints 2019-01-30 17:49:04 +01:00
Jethro Beekman
a3f0af2e67 Add MOVBE feature 2019-01-30 21:07:48 +05:30
Niklas Fiekas
c6f6101180 Allow #[repr(align(x))] on enums (#57996) 2019-01-30 14:15:38 +01:00
Knium_
62867b4992 Suggest to add each of | and () when unexpected , is found in pattern 2019-01-30 13:50:44 +09:00
John Kåre Alsaker
0e2ad51e36 Fix tests 2019-01-29 21:10:36 +01:00
bors
7425663011 Auto merge of #57901 - lqd:issue_57362, r=nikomatsakis
Add information to higher-ranked lifetimes conflicts error messages

Make these errors go through the new "placeholder error" code path, to have self tys displayed and make them hopefully less confusing.

Should fix #57362.

r? @nikomatsakis — so we can iterate on the specific wording you wanted.
2019-01-29 16:58:15 +00:00
Ariel Ben-Yehuda
0ceb30de6d add tests to a few edge cases in method lookup
These aren't fixed by this PR, but were broken in a few older attempts
at it. Make sure they don't regress.
2019-01-29 01:00:25 +02:00
Rémy Rakic
c97d135452 Refer to synthetically named lifetimes as "some specific lifetime" rather than "the specific lifetime" 2019-01-28 23:12:13 +01:00
Mazdak Farrokhzad
d3bb907eff
Rollup merge of #57904 - euclio:attribute-typos, r=davidtwco
add typo suggestion to unknown attribute error

Provides a suggestion using Levenshtein distance to suggest built-in attributes and attribute macros.

Fixes #49270.
2019-01-28 22:25:47 +01:00
bors
d8a0dd7ae8 Auto merge of #55704 - Nemo157:pinned-generators, r=Zoxc
Use pinning for generators to make trait safe

I'm unsure whether there needs to be any changes to the actual generator transform. Tests are passing so the fact that `Pin<&mut T>` is fundamentally the same as `&mut T` seems to allow it to still work, but maybe there's something subtle here that could go wrong.

This is specified in [RFC 2349 § Immovable generators](https://github.com/rust-lang/rfcs/blob/master/text/2349-pin.md#immovable-generators) (although, since that RFC it has become safe to create an immovable generator, and instead it's unsafe to resume any generator; with these changes both are now safe and instead the unsafety is moved to creating a `Pin<&mut [static generator]>` which there are safe APIs for).

CC #43122
2019-01-28 14:12:15 +00:00
David Wood
5f021e0023
Unused variable suggestions on all patterns.
This commit extends existing suggestions to prefix unused variable
bindings in match arms with an underscore so that it applies to all
patterns in a match arm.
2019-01-28 10:46:31 +01:00
bors
c32515566f Auto merge of #57910 - Mark-Simulacrum:delete-test, r=petrochenkov
Delete long-ignored and useless test

cc @pnkfelix (https://github.com/rust-lang/rust/issues/13745#issuecomment-457599109)

r? @petrochenkov as you re-enabled this test in 21d67c45a3, https://github.com/rust-lang/rust/pull/55236
2019-01-28 03:46:25 +00:00
Andy Russell
5e67021172
add typo suggestion to unknown attribute error 2019-01-27 21:56:50 -05:00
Wim Looman
c4bf5f9d63 Temporary workaround for travis diagnostic difference 2019-01-27 22:59:00 +01:00
Wim Looman
730b18b6e5 Mark static generators as !Unpin 2019-01-27 22:58:59 +01:00
Wim Looman
a3fdee9a75 Change generator trait to use pinning 2019-01-27 22:58:53 +01:00
bors
8611577360 Auto merge of #57765 - Mark-Simulacrum:bootstrap-bump, r=alexcrichton
Bump bootstrap compiler to 1.33 beta

r? @alexcrichton or @pietroalbini

cc @rust-lang/release
2019-01-27 18:18:17 +00:00
Mark Rousskov
e0bc0ba281 Update comment in test which has changed its purpose 2019-01-27 08:59:58 -07:00
Rémy Rakic
489bc4a2c6 When mentioning lifetimes, put either the trait ref or the self type closer to the lifetimes
When mentioning lifetimes, only invert wording between the expected trait and the self type when the self type has the vid.
This way, the lifetimes always stay close to the self type or trait ref that actually contains them.
2019-01-27 10:52:45 +01:00
Rémy Rakic
1730ad4d1c Fix issue-57362-1.rs attributes 2019-01-27 10:52:45 +01:00
Niko Matsakis
ec6405bccd identify when implemented for "some specific lifetime" 2019-01-27 10:52:44 +01:00
Niko Matsakis
c5dea5753f break apart tests 2019-01-27 10:52:43 +01:00
Remy Rakic
f5a74d40d9 Test new placeholder error messages in previously untested combinations 2019-01-27 10:52:43 +01:00
Remy Rakic
a79f135be6 Update test expectations for new placeholder error messages 2019-01-27 10:52:43 +01:00
lqd
ce61b1b9fa Update two E308 tests to the new placeholder error 2019-01-27 10:52:42 +01:00
Mark Rousskov
7a58c6d1de Replace deprecated ATOMIC_INIT consts 2019-01-26 15:27:38 -07:00
bors
20c2cba61d Auto merge of #57918 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #57407 (Stabilize extern_crate_self)
 - #57703 (Make MutexGuard's Debug implementation more useful.)
 - #57764 (Fix some minor warnings)
 - #57825 (un-deprecate mem::zeroed)
 - #57827 (Ignore aarch64 in simd-intrinsic-generic-reduction)
 - #57908 (resolve: Fix span arithmetics in the import conflict error)
 - #57913 (Change crate-visibility-modifier issue number in The Unstable Book)

Failed merges:

r? @ghost
2019-01-26 18:14:46 +00:00
Mazdak Farrokhzad
bbe8dd9ca3
Rollup merge of #57908 - petrochenkov:errepice, r=estebank
resolve: Fix span arithmetics in the import conflict error

https://github.com/rust-lang/rust/pull/56937 rebased and fixed

Fixes https://github.com/rust-lang/rust/issues/56411
Fixes https://github.com/rust-lang/rust/issues/57071
Fixes https://github.com/rust-lang/rust/issues/57787

r? @estebank
2019-01-26 18:21:47 +01:00
Mazdak Farrokhzad
5e6c2f40d0
Rollup merge of #57407 - mehcode:stabilize-extern-crate-self, r=Centril
Stabilize extern_crate_self

Fixes #56409
2019-01-26 18:21:41 +01:00
bors
46a43dc1e9 Auto merge of #57852 - davidtwco:issue-57819, r=estebank
Suggest removing leading left angle brackets.

Fixes #57819.

This PR adds errors and accompanying suggestions as below:

```
bar::<<<<<T as Foo>::Output>();
     ^^^ help: remove extra angle brackets
```

r? @estebank
2019-01-26 15:33:43 +00:00
bors
42eb5ff404 Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelix
Implement optimize(size) and optimize(speed) attributes

This PR implements both `optimize(size)` and `optimize(speed)` attributes.

While the functionality itself works fine now, this PR is not yet complete: the code might be messy in places and, most importantly, the compiletest must be improved with functionality to run tests with custom optimization levels. Otherwise the new attribute cannot be tested properly. Oh, and not all of the RFC is implemented – attribute propagation is not implemented for example.

# TODO

* [x] Improve compiletest so that tests can be written;
* [x] Assign a proper error number (E9999 currently, no idea how to allocate a number properly);
* [ ] Perhaps reduce the duplication in LLVM attribute assignment code…
2019-01-26 07:08:18 +00:00
bors
37d51aa8f3 Auto merge of #57898 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #56233 (Miri and miri-related code contains repetitions of `(n << amt) >> amt`)
 - #57645 (distinguish "no data" from "heterogeneous" in ABI)
 - #57734 (Fix evaluating trivial drop glue in constants)
 - #57886 (Add suggestion for moving type declaration before associated type bindings in generic arguments.)
 - #57890 (Fix wording in diagnostics page)

Failed merges:

r? @ghost
2019-01-25 23:27:20 +00:00
Vadim Petrochenkov
1b659d69bc Address review comments and cleanup code 2019-01-26 01:49:55 +03:00
François Mockers
ac4b685650 #56411 do not suggest a fix for a import conflict in a macro 2019-01-25 22:39:14 +03:00
Simonas Kazlauskas
ce289c6c99 Resolve breakage 2019-01-25 19:20:38 +02:00
Mazdak Farrokhzad
7768358e72
Rollup merge of #57886 - davidtwco:issue-57385, r=estebank
Add suggestion for moving type declaration before associated type bindings in generic arguments.

Fixes #57385.

r? @estebank
2019-01-25 16:59:29 +01:00
Mazdak Farrokhzad
141fa859b8
Rollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelix
Fix evaluating trivial drop glue in constants

```rust
struct A;
impl Drop for A {
    fn drop(&mut self) {}
}

const FOO: Option<A> = None;

const BAR: () = (FOO, ()).1;
```

was erroring with

```
error: any use of this value will cause an error
 --> src/lib.rs:9:1
  |
9 | const BAR: () = (FOO, ()).1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^
  |                           |
  |                           calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))`
  |
  = note: #[deny(const_err)] on by default

error: aborting due to previous error
```

before this PR. According to godbolt this last compiled successfully in 1.27
2019-01-25 16:59:27 +01:00
Mazdak Farrokhzad
7779bb9907
Rollup merge of #57645 - nikomatsakis:issue-56877-abi-aggregates, r=eddyb
distinguish "no data" from "heterogeneous" in ABI

Ignore zero-sized types when computing whether something is a homogeneous aggregate, except be careful of VLA.

cc #56877

r? @arielb1
cc @eddyb
2019-01-25 16:59:26 +01:00
Niko Matsakis
8e4c57fca2 distinguish "no data" from "heterogeneous" for ABI purposes
Also, add a testing infrastructure and tests that lets us dump layout.
2019-01-25 10:03:47 -05:00
bors
0b1669d96c Auto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelix
[NLL] Clean up handling of type annotations

* Renames (Canonical)?UserTypeAnnotation -> (Canonical)?UserType so that the name CanonicalUserTypeAnnotation is free.
* Keep the inferred type associated to user type annotations in the MIR, so that it can be compared against the annotated type, even when the annotated expression gets removed from the MIR. (#54943)
* Use the inferred type to allow infallible handling of user type projections (#57531)
* Uses revisions for the tests in #56993
* Check the types of `Unevaluated` constants with no annotations (#46702)
* Some drive-by cleanup

Closes #46702
Closes #54943
Closes #57531
Closes #57731
cc #56993 leaving this open to track the underlying issue: we are not running tests with full NLL enabled on CI at the moment

r? @nikomatsakis
2019-01-25 14:25:37 +00:00
Felix S. Klock II
620a03f5aa Unit test from #57866. 2019-01-25 15:19:37 +01:00
David Wood
7a0abbff8b
Combining move lifetime and type suggestions.
This commit combines the move lifetime and move type suggestions so that
when rustfix applies them they don't conflict with each other.
2019-01-25 11:54:21 +01:00
David Wood
463e623ca9
Suggestion moving types before associated types.
This commit extends existing suggestions to move lifetimes before types
in generic arguments to also suggest moving types behind associated type
bindings.
2019-01-25 11:15:16 +01:00
Oliver Scherer
506393eaaf Add a compile-fail test for Drop in constants in the presence of Options 2019-01-25 09:54:25 +01:00
Mazdak Farrokhzad
a9950f6a45
Rollup merge of #57802 - davidtwco:issue-56943, r=estebank
Print visible name for types as well as modules.

Fixes #56943 and fixes #57713.

This commit extends previous work in #55007 where the name from the
visible parent was used for modules. Now, we also print the name from
the visible parent for types.

r? @estebank
2019-01-25 01:37:02 +01:00
Mazdak Farrokhzad
f20c6c8581
Rollup merge of #57294 - estebank:point-copy-less, r=nikomatsakis
When using value after move, point at span of local

When trying to use a value after move, instead of using a note, point
at the local declaration that has a type that doesn't implement `Copy`
trait.

```
error[E0382]: use of moved value: `x`
  --> $DIR/issue-34721.rs:27:9
   |
LL |     pub fn baz<T: Foo>(x: T) -> T {
   |                -       - move occurs because `x` has type `T`, which does not implement the `Copy` trait
   |                |
   |                consider adding a `Copy` constraint to this type argument
LL |         if 0 == 1 {
LL |             bar::bar(x.zero())
   |                      - value moved here
LL |         } else {
LL |             x.zero()
   |             - value moved here
LL |         };
LL |         x.zero()
   |         ^ value used here after move
```

Fix #34721.
2019-01-25 01:36:59 +01:00
bors
278067d34d Auto merge of #57879 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57380 (Fix Instant/Duration math precision & associativity on Windows)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57803 (Several changes to libunwind for SGX target)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost
2019-01-24 21:23:11 +00:00
Esteban Küber
baa0828ee3 Fix --compare-mode=nll tests 2019-01-24 10:53:43 -08:00
Esteban Küber
29e8e63c84 review comments 2019-01-24 10:36:50 -08:00
Esteban Küber
0e2d6e0175 Point at type argument suggesting adding Copy constraint 2019-01-24 10:36:50 -08:00
Esteban Küber
e0a606c6a9 Add test for #34721 2019-01-24 10:36:50 -08:00
Esteban Küber
5e9c8d7369 When using value after move, point at span of local
When trying to use a value after move, instead of using a note, point
at the local declaration that has a type that doesn't implement `Copy`
trait.
2019-01-24 10:36:50 -08:00
Simonas Kazlauskas
89e34d3e32 Add a feature gate test for #[optimize] 2019-01-24 20:13:51 +02:00