Commit Graph

122658 Commits

Author SHA1 Message Date
Adrian Cruceru
db6fa2fff5 Remove deprecated comments 2020-06-25 12:30:27 +02:00
Adrian Cruceru
343a9212b0 Fix comments 2020-06-25 12:01:02 +02:00
Alexis Bourget
5232e2025f Document the super keyword 2020-06-25 11:40:07 +02:00
Mateusz Mikuła
f27dcd7ee0 Rename remaining fallback to self_contained 2020-06-25 11:32:27 +02:00
Mateusz Mikuła
54293c1f15 Rename get_self_contained_lib_path 2020-06-25 11:32:09 +02:00
Mateusz Mikuła
2e3f51775a Add unstable rustc option to control self-contained linkage mode 2020-06-25 11:27:06 +02:00
bors
229e5b2640 Auto merge of #72559 - Aaron1011:feature/assoc-lang-items, r=oli-obk
Implement associated lang items

Fixes #70718

This commit allows making associated items (e.g. associated functions
and types) into lang items via the `#[lang]` attribute. This allows such
items to be accessed directly, rather than by iterating over the parent
item's associated items.

I've added `FnOnce::Output` as a lang item, and updated one old usage to
use the new lang item. The remaining uses can be updated separately.
2020-06-25 08:58:37 +00:00
Alexis Bourget
3d09017477 Add a compile fail example, binding -> variable, apply suggestions 2020-06-25 10:05:30 +02:00
Esteban Küber
520461f1fb Provide suggestions for some moved value errors
When encountering an used moved value where the previous move happened
in a `match` or `if let` pattern, suggest using `ref`. Fix #63988.

When encountering a `&mut` value that is used in multiple iterations of
a loop, suggest reborrowing it with `&mut *`. Fix #62112.
2020-06-24 17:42:26 -07:00
Dylan DPC
8d1934ec8d
Rollup merge of #73698 - spastorino:patch-1, r=wesleywiser
Add procedure for prioritization notifications on Zulip

This PR was originally opened by @LeSeulArtichaut as #73695, closing that one in favor of this one. Made some slight changes to it but can't push to @LeSeulArtichaut branch.

r? @wesleywiser @rust-lang/wg-prioritization
2020-06-25 02:03:42 +02:00
Dylan DPC
a5839f35b6
Rollup merge of #73688 - poliorcetics:self-keyword, r=joshtriplett
Document the self keyword

Partial fix of #34601.

This documents the `self` keyword, adding several examples and a link to the reference.
2020-06-25 02:03:40 +02:00
Dylan DPC
3b710970e8
Rollup merge of #73634 - nbdd0121:typeck, r=nikomatsakis
Add UI test for issue 73592

It happens that #72280 accidentally fixed a bug which is later discovered in #73592. This PR adds a UI test to prevent future regression.

Closes #73592
2020-06-25 02:03:38 +02:00
Dylan DPC
6c1a91edd9
Rollup merge of #73616 - pickfire:liballoc-hash, r=joshtriplett
Liballoc minor hash import tweak
2020-06-25 02:03:36 +02:00
Dylan DPC
d6c674bc14
Rollup merge of #73516 - Crabapple-iOS:feature/apple-dynamic-linking, r=nikomatsakis
Allow dynamic linking for iOS/tvOS targets

During the development and testing of the [Crabapple project](https://github.com/Crabapple-iOS/Crabapple), one obstacle was the lack of `cdylib` target support for iOS. Surprisingly, once `dynamic_linking` was enabled for iOS targets, it worked seemingly flawlessly.

I could not find any information on why this was initially or still is disabled.
2020-06-25 02:03:34 +02:00
Dylan DPC
67db7a2d05
Rollup merge of #72700 - davidtwco:issue-66220-improper-ctypes-declarations, r=lcnr,varkor
`improper_ctypes_definitions` lint

Addresses #19834, #66220, and #66373.

This PR takes another attempt at #65134 (reverted in #66378). Instead of modifying the existing `improper_ctypes` lint to consider `extern "C" fn` definitions in addition to `extern "C" {}` declarations, this PR adds a new lint - `improper_ctypes_definitions` - which only applies to `extern "C" fn` definitions.

In addition, the `improper_ctype_definitions` lint differs from `improper_ctypes` by considering `*T` and `&T` (where `T: Sized`) FFI-safe (addressing #66220).

There wasn't a clear consensus in #66220 (where the issues with #65134 were primarily discussed) on the approach to take, but there has [been some discussion in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2366220.20improper_ctypes.20definitions.20vs.20declarations/near/198903086). I fully expect that we'll want to iterate on this before landing.

cc @varkor + @shepmaster (from #19834) @hanna-kruppe (active in discussing #66220), @SimonSapin (#65134 caused problems for Servo, want to make sure that this PR doesn't)
2020-06-25 02:03:32 +02:00
Esteban Küber
8f40dae93b Suggest type param trait bound for binop only when appropriate
Verify that the binop trait *is* implemented for the types *if* all the
involved type parameters are replaced with fresh inferred types. When
this is the case, it means that the type parameter was indeed missing a
trait bound. If this is not the case, provide a generic `note` refering
to the type that doesn't implement the expected trait.
2020-06-24 16:17:04 -07:00
Aaron Hill
a13d4678fe
Implement associated lang items
Fixes #70718

This commit allows making associated items (e.g. associated functions
and types) into lang items via the `#[lang]` attribute. This allows such
items to be accessed directly, rather than by iterating over the parent
item's associated items.

I've added `FnOnce::Output` as a lang item, and updated one old usage to
use the new lang item. The remaining uses can be updated separately.
2020-06-24 19:08:11 -04:00
Tyler Mandry
887fbd9d34 Split out async fn and generator test
This keeps FileCheck from tripping over unimportant differences in
codegen.
2020-06-24 15:08:59 -07:00
Tyler Mandry
fe3df646fe Give up on checking filename 2020-06-24 15:08:59 -07:00
Tyler Mandry
2d652d9d73 Add generator-debug test for MSVC
..which doesn't use variant types.
2020-06-24 15:08:59 -07:00
Tyler Mandry
477ecc51ca Generalize generator-debug test a bit
Don't be so reliant on particular line ordering (though FileCheck makes
this hard in general, IMO). Also disable for MSVC.
2020-06-24 14:53:30 -07:00
Tyler Mandry
547d86307c Improve GeneratorLayout debug output 2020-06-24 14:53:30 -07:00
Tyler Mandry
242a5cd4c6 Allow calling GeneratorSubsts::variant_name() without substs 2020-06-24 14:53:29 -07:00
Tyler Mandry
367858aedc Add test for generator debuginfo 2020-06-24 14:53:29 -07:00
Tyler Mandry
eb726c0fce Add Artificial flag to generator variants 2020-06-24 14:53:29 -07:00
Tyler Mandry
a5a831f511 Emit line info for generator variants 2020-06-24 14:53:29 -07:00
LeSeulArtichaut
2735f43cef
Fix links in SliceIndex documentation 2020-06-24 23:34:19 +02:00
Esteban Küber
09af1845d7 review comments: clean up code
* deduplicate logic
* fix typos
* remove unnecessary state
2020-06-24 14:23:45 -07:00
bors
67100f61e6 Auto merge of #73660 - flip1995:clippyup, r=nikomatsakis
Update Clippy
2020-06-24 19:33:02 +00:00
Eduardo Sánchez Muñoz
771a1d8e0a Make std::panicking::panic_count::is_zero inline and move the slow path into a separate cold function. 2020-06-24 18:17:27 +02:00
bors
d8ed1b03c2 Auto merge of #73692 - Dylan-DPC:rollup-ehzsbfw, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #73638 (Remove unused crate imports in 2018 edition crates)
 - #73639 (Change heuristic for determining range literal)
 - #73646 (Add some regression tests)
 - #73652 (Add re-exports to use suggestions)
 - #73667 (Update BTreeMap::new() doc)
 - #73675 (Update books)

Failed merges:

r? @ghost
2020-06-24 15:47:22 +00:00
Santiago Pastorino
ff068762a0
Alert @WG-prioritization/alerts instead of @WG-prioritization 2020-06-24 12:36:17 -03:00
Santiago Pastorino
5881b52d9a
Change wg-prioritization stream 2020-06-24 12:32:44 -03:00
Nathan Corbyn
493199626b Fix tests 2020-06-24 15:36:04 +01:00
Nathan Corbyn
c2dfc25c0e Fix tests 2020-06-24 15:10:10 +01:00
Nathan Corbyn
d36d351afc Implement intrinsic 2020-06-24 14:38:42 +01:00
LeSeulArtichaut
78baf421aa
Add procedure for prioritization notifications on Zulip 2020-06-24 15:33:08 +02:00
Alexis Bourget
f44b8b96aa Document the Self keyword 2020-06-24 15:00:05 +02:00
Dylan DPC
be8f381c8a
Rollup merge of #73675 - ehuss:update-books, r=ehuss
Update books

## reference

5 commits in 5d40ba5c2515caffa7790cda621239dc21ef5a72..04d5d5d7ba624b6f5016298451f3a63d557f3260
2020-06-06 20:25:36 -0700 to 2020-06-16 15:08:05 -0700
- Mention `feature="foo"` is a Cargo convention. (rust-lang-nursery/reference#833)
- fix out of date info on type aliases (rust-lang-nursery/reference#831)
- Fix an invalid variable name in the loop example (rust-lang-nursery/reference#832)
- Fix note about using proc_macro with Cargo. (rust-lang-nursery/reference#815)
- Add a link to the definition of Pattern_White_Space. (rust-lang-nursery/reference#824)

## book

7 commits in 30cd9dfe71c446de63826bb4472627af45acc9db..4e7c00bece1544d409312ec93467beb62b5bd0cb
2020-06-07 23:07:19 -0500 to 2020-06-19 09:39:12 -0400
- Link to the reference file that exists
- Link to the reference
- Clean up discussion around advanced lifetime stuff (rust-lang/book#2351)
- Reword Chapter 6 page 2, match (rust-lang/book#2374)
- Clarify some package/crate distinctions in chapter 14 (rust-lang/book#2373)
- Not mandatory with cargo 1.41.0-nightly (rust-lang/book#2368)
- Use same naming for Rhs as libcore/ops (rust-lang/book#2371)

## rust-by-example

4 commits in 7aa82129aa23e7e181efbeb8da03a2a897ef6afc..6f94ccb48da6fa4ed0031290f21411cf789f7d5e
2020-05-25 14:54:26 -0300 to 2020-06-20 17:51:30 -0300
- Update to mdbook 0.3.7 (rust-lang/rust-by-example#1352)
- Update fn.md (rust-lang/rust-by-example#1351)
- Fixed typo in formatted print (rust-lang/rust-by-example#1350)
- This explanation incorrectly inverts the meaning of SuperTrait (rust-lang/rust-by-example#1349)

## embedded-book

5 commits in 5555a97f04ad7974ac6fb8fb47c267c4274adf4a..616962ad0dd80f34d8b802da038d0aed9dd691bb
2020-05-25 18:00:51 +0000 to 2020-06-23 16:03:45 +0000
- Update RTFM name to RTIC, fixed links, updated singletons.md example.  (rust-embedded/book#254)
- Note on how to rebuild if memory.x is changed  (rust-embedded/book#253)
- Ease the readers into the Discovery book  (rust-embedded/book#250)
- Provide a note on 'extern crate' usage in edition 2018 syntax of Rust  (rust-embedded/book#248)
- Fix Typos and Improve Readability  (rust-embedded/book#245)
2020-06-24 14:28:47 +02:00
Dylan DPC
c4e15b5c5a
Rollup merge of #73667 - nrabulinski:master, r=Dylan-DPC
Update BTreeMap::new() doc

Updates the documentation according to [this comment](0c5c644c91 (r433232581)) on #72876
2020-06-24 14:28:45 +02:00
Dylan DPC
2a6e660ae1
Rollup merge of #73652 - da-x:add-reexported-to-use-suggestions, r=petrochenkov
Add re-exports to use suggestions

In the following example, an inaccessible path is suggested via `use foo::bar::X;` whereas an accessible public exported path can be suggested instead.

```rust
mod foo {
    mod bar {
        pub struct X;
    }
    pub use self::bar::X;
}

fn main() { X; }
```

This fixes the issue.
2020-06-24 14:28:43 +02:00
Dylan DPC
45de677b1e
Rollup merge of #73646 - JohnTitor:add-tests, r=Dylan-DPC
Add some regression tests

Closes #44861
Closes #51506
Closes #59435
Closes #69840
2020-06-24 14:28:41 +02:00
Dylan DPC
1d1c400324
Rollup merge of #73639 - ayazhafiz:i/73553, r=davidtwco
Change heuristic for determining range literal

Currently, rustc uses a heuristic to determine if a range expression is
not a literal based on whether the expression looks like a function call
or struct initialization. This fails for range literals whose
lower/upper bounds are the results of function calls. A possibly-better
heuristic is to check if the expression contains `..`, required in range
literals.

Of course, this is also not perfect; for example, if the range
expression is a struct which includes some text with `..` this will
fail, but in general I believe it is a better heuristic.

A better alternative altogether is to add the `QPath::LangItem` enum
variant suggested in #60607. I would be happy to do this as a precursor
to this patch if someone is able to provide general suggestions on how
usages of `QPath` need to be changed later in the compiler with the
`LangItem` variant.

Closes #73553
2020-06-24 14:28:39 +02:00
Dylan DPC
38c85b7393
Rollup merge of #73638 - yuqio:remove-unused-crate-imports, r=nikomatsakis
Remove unused crate imports in 2018 edition crates

Closes #73570
2020-06-24 14:28:33 +02:00
bors
0b66a89735 Auto merge of #73679 - ehuss:update-cargo, r=ehuss
Update cargo

9 commits in 089cbb80b73ba242efdcf5430e89f63fa3b5328d..c26576f9adddd254b3dd63aecba176434290a9f6
2020-06-15 14:38:34 +0000 to 2020-06-23 16:21:21 +0000
- Adding environment variable CARGO_PKG_LICENSE_FILE (rust-lang/cargo#8387)
- Enable "--target-dir" in "cargo install" (rust-lang/cargo#8391)
- Add support for `workspace.metadata` table (rust-lang/cargo#8323)
- Fix overzealous `clean -p` for reserved names. (rust-lang/cargo#8398)
- Fix order-dependent feature resolution. (rust-lang/cargo#8395)
- Correct mispelling of `cargo`. (rust-lang/cargo#8389)
- Add missing license field. (rust-lang/cargo#8386)
- Adding environment variable CARGO_PKG_LICENSE (rust-lang/cargo#8325)
- Cut down on data fetch from git dependencies (rust-lang/cargo#8363)
2020-06-24 12:08:53 +00:00
Alexis Bourget
03661630c9 Document the self keyword 2020-06-24 13:52:57 +02:00
Guillaume Gomez
65becefd4a Clean up E0701 explanation 2020-06-24 13:19:06 +02:00
David Wood
4504648090
improper_ctypes: only allow params in defns mode
This commit adjusts the behaviour introduced in a previous commit so
that generic parameters and projections are only allowed in the
definitions mode - and are otherwise a bug. Generic parameters in
declarations are prohibited earlier in the compiler, so if that branch
were reached, it would be a bug.

Signed-off-by: David Wood <david@davidtw.co>
2020-06-24 12:09:39 +01:00
David Wood
5c8634805c
improper_ctypes: allow pointers to sized types
This commit changes the improper ctypes lint (when operating on
definitions) to consider raw pointers or references to sized types as
FFI-safe.

Signed-off-by: David Wood <david@davidtw.co>
2020-06-24 12:09:37 +01:00
David Wood
14ea7a777f
lints: add improper_ctypes_definitions
This commit adds a new lint - `improper_ctypes_definitions` - which
functions identically to `improper_ctypes`, but on `extern "C" fn`
definitions (as opposed to `improper_ctypes`'s `extern "C" {}`
declarations).

Signed-off-by: David Wood <david@davidtw.co>
2020-06-24 12:09:35 +01:00