Commit Graph

106686 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
ef63e88a9d rustc_codegen_ssa: use debug_introduce_local on Operand call results. 2020-02-09 16:39:23 +02:00
John Kåre Alsaker
d304cd0c55 More comments 2020-02-09 14:35:50 +01:00
John Kåre Alsaker
e763ddc6b9 Add some comments 2020-02-09 14:26:13 +01:00
Matthew Jasper
fa5a3c35dc Don't parse mut a @ b as mut a @ mut b 2020-02-09 13:19:06 +00:00
Matthew Jasper
842938a82f cache adt_drop_tys 2020-02-09 10:56:18 +00:00
matthewjasper
3eb5241884 Apply suggestions from code review
Co-Authored-By: varkor <github@varkor.com>
2020-02-09 10:49:39 +00:00
bors
6dff769e37 Auto merge of #68975 - Dylan-DPC:rollup-jzab8oh, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #68718 (Move `rustc_hir::def_id` to `rustc_span::def_id`)
 - #68834 (Fix and test implementation of BTreeMap's first/last_entry, pop_first/last)
 - #68857 (perf: Reduce Vec allocations in normalization by passing &mut Vec)
 - #68918 (Don't use the word "unwrap" to describe "unwrap" methods)
 - #68946 (Mark several functions and methods in core::cmp as #[must_use])
 - #68958 (Clean up E0277 and E0282 explanations)
 - #68960 (codegen: misc cleanups around debuginfo scopes and locations.)

Failed merges:

r? @ghost
2020-02-09 10:20:46 +00:00
Patryk Wychowaniec
a8d34c1062
Improve reporting errors and suggestions for trait bounds 2020-02-09 10:33:47 +01:00
bors
64ea639c12 Auto merge of #68689 - estebank:where-clause-sugg-missing-fn, r=varkor
When suggesting associated fn with type parameters, include in the structured suggestion

Address #50734.

```
error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `baz`
  --> file.rs:14:1
   |
14 | impl TraitA<()> for S {
   | ^^^^^^^^^^^^^^^^^^^^^ missing `foo`, `bar`, `baz` in implementation
   |
   = help: implement the missing item: `fn foo<T>(_: T) -> Self where T: TraitB, TraitB::Item = A { unimplemented!() }`
   = help: implement the missing item: `fn bar<T>(_: T) -> Self { unimplemented!() }`
   = help: implement the missing item: `fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: std::marker::Copy { unimplemented!() }`
```

It doesn't work well for associated types with `ty::Predicate::Projection`s as we need to resugar `T: Trait, Trait::Assoc = K` → `T: Trait<Assoc = K>`.
2020-02-09 07:11:56 +00:00
Dylan MacKenzie
ea958422da Test ASCII ctype methods in a const context 2020-02-08 22:16:47 -08:00
Dylan MacKenzie
a9212b8e93 Make the ASCII ctype inherent methods const 2020-02-08 21:29:25 -08:00
Esteban Küber
3cdd7ae59e review comment 2020-02-08 21:08:59 -08:00
Esteban Küber
d51f2bd9d7 review comments 2020-02-08 21:05:43 -08:00
bors
f8d830b4de Auto merge of #68376 - Centril:move-ref-patterns, r=matthewjasper
Initial implementation of `#![feature(move_ref_pattern)]`

Following up on #45600, under the gate `#![feature(move_ref_pattern)]`, `(ref x, mut y)` is allowed subject to restrictions necessary for soundness. The match checking implementation and tests for `#![feature(bindings_after_at)]` is also adjusted as necessary.

Closes #45600.
Tracking issue: #68354.

r? @matthewjasper
2020-02-09 04:01:28 +00:00
Dylan MacKenzie
0755c41ae2 Test NonZeroU8::new in a const context 2020-02-08 16:06:42 -08:00
Dylan MacKenzie
0b20ce97f7 Make num::NonZeroX::new an unstable const fn 2020-02-08 16:02:20 -08:00
Dylan DPC
9dabf80d55
Rollup merge of #68960 - eddyb:llvm-dbg-cleanup, r=nagisa
codegen: misc cleanups around debuginfo scopes and locations.

See each commit message. Most of these seem to be leftovers from the transition to MIR codegen.

r? @nagisa cc @bjorn3
2020-02-09 00:54:00 +01:00
Dylan DPC
8333115100
Rollup merge of #68958 - GuillaumeGomez:clean-up-e0277-e0282, r=Dylan-DPC
Clean up E0277 and E0282 explanations

r? @Dylan-DPC
2020-02-09 00:53:58 +01:00
Dylan DPC
d6087b91db
Rollup merge of #68946 - mjbshaw:must_use, r=mjbshaw
Mark several functions and methods in core::cmp as #[must_use]

These functions and methods aren't mutating functions and ignoring the result of them is likely a bug in the user's code.
2020-02-09 00:53:56 +01:00
Dylan DPC
2be062a4b0
Rollup merge of #68918 - brson:unwrapdoc, r=Dylan-DPC
Don't use the word "unwrap" to describe "unwrap" methods

It's tautological, and "unwrap" is essentially Rust-specific jargon.

I was teaching a newbie some Rust, and doing the usual hand-waving about error handling using unwrap. They asked what 'unwrap' means. I said look it up in the docs. The docs read (paraphrased) "unwrap unwraps". I was embarrassed.

This changes all the Option/Result functions with unwrapping behavior to use a variation on a single description:

> "Returns the contained `Some/Ok` value [or ...]."

It also renames the closure of `Result::unwrap_or_else` to `default` for consistency with `Option`, and perhaps makes a few other small tweaks.

Previous: https://github.com/rust-lang/rust/pull/68849
2020-02-09 00:53:55 +01:00
Dylan DPC
664d87f9b1
Rollup merge of #68857 - Marwes:allocations, r=matthewjasper
perf: Reduce Vec allocations in normalization by passing &mut Vec

Complicates the code a bit but allocation/freeing were a few percent of the overall runtime in trait heavy code.
2020-02-09 00:53:53 +01:00
Dylan DPC
cb87c958ef
Rollup merge of #68834 - ssomers:btree_first_last_fix68829, r=KodrAus
Fix and test implementation of BTreeMap's first/last_entry, pop_first/last

Properly implement and test `first_entry` & `last_entry` to fix problem report #68829
2020-02-09 00:53:52 +01:00
Dylan DPC
d17bc9f061 Rollup merge of #68718 - Aaron1011:move-def-hir-span, r=petrochenkov
Move `rustc_hir::def_id` to `rustc_span::def_id`

This will allow `HygieneData` to refer to `DefId` and `DefIndex`, which
will enable proper serialization of Span hygiene information.

This also reduces the number of things imported from `rustc_hir`, which
might make it easier to remove dependencies on it.
2020-02-09 00:53:50 +01:00
CAD97
136008c15b Disable failing codegen test 2020-02-08 18:47:41 -05:00
CAD97
3e115b6c9d Remove problematic specialization from RangeInclusive 2020-02-08 18:47:41 -05:00
Aaron Hill
619051e4f0
Move librustc_hir/def_id.rs to librustc_span/def_id.rs
For noww, librustc_hir re-exports the `def_id` module from
librustc_span, so the rest of rustc can continue to reference
rustc_hir::def_id
2020-02-08 16:48:01 -05:00
Josh White
d705ad28a0 Merge branch 'master' of https://github.com/jwhite927/rust into E0637 2020-02-08 16:30:40 -05:00
bors
a19edd6b16 Auto merge of #68802 - eddyb:debuginfo-there-can-only-be-one-arg, r=nagisa
rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments.

Fixes #67586 by limiting `ArgumentVariable` special-casing to `VarDebugInfo` entries that are in `OUTERMOST_SOURCE_SCOPE`, i.e. the function's own argument scope.
That excludes `VarDebugInfo` from inlined callees, which can also point to the caller's argument locals.

This is a snippet from the optimized MIR (including inlining) of the testcase:
```rust
fn  foo(_1: usize) -> usize {
    debug bar => _1;                     // in scope 0 at ./example.rs:2:12: 2:15
    let mut _0: usize;                   // return place in scope 0 at ./example.rs:2:27: 2:32
    scope 1 {
        debug x => _1;                   // in scope 1 at /rustc/9ed29b6ff6aa2e048b09c27af8f62ee3040bdb37/src/libcore/convert/mod.rs:106:26: 106:27
    }
```
`scope 1` is from inlining the `identity` call, and `debug x => _1;` comes from the body of `core::convert::identity`, so they are now ignored for the purposes of determining the `ArgumentVariable` debuginfo associated to `_1`.
2020-02-08 21:28:05 +00:00
Josh White
9d54bb28b3 Tidied up E0637.md 2020-02-08 16:26:09 -05:00
Markus Westerlind
51b891ae2c Reduce Vec allocations in normalization by passing &mut Vec 2020-02-08 20:52:22 +01:00
Josh White
8c351182de Corrected E0637.md based on test failures 2020-02-08 14:24:35 -05:00
Michael Bradshaw
4ac468c038 Mark several functions and methods in core::cmp as #[must_use] 2020-02-08 10:42:23 -08:00
bors
07a34df18b Auto merge of #68452 - msizanoen1:riscv-abi, r=nagisa,eddyb
Implement proper C ABI lowering for RISC-V

This is necessary for full RISC-V psABI compliance when passing argument across C FFI boundary.

cc @lenary
2020-02-08 18:10:48 +00:00
Eduard-Mihai Burtescu
bdb72e7b5a rustc_codegen_ssa: remove unnecessary source_locations_enabled. 2020-02-08 18:27:49 +02:00
Eduard-Mihai Burtescu
1385fc4c40 rustc_codegen_llvm: remove InternalDebugLocation and simplify dbg_var_addr. 2020-02-08 18:07:44 +02:00
Eduard-Mihai Burtescu
d6ccbf6ff8 rustc_codegen_llvm: remove unnecessary special-casing of root scopes' children. 2020-02-08 17:58:00 +02:00
Guillaume Gomez
1177d0669a Clean up E0277 and E0282 explanations 2020-02-08 15:47:29 +01:00
Jonas Schievink
58a9284bff Add missing import 2020-02-08 14:44:32 +01:00
Jonas Schievink
e0cb1ae24a Make provided_trait_methods use impl Iterator 2020-02-08 14:37:40 +01:00
Jonas Schievink
52f77110d4 Add a fast path to inherent impl overlap check
Quickly skip impls that do not define any items with the same name
2020-02-08 14:37:40 +01:00
Jonas Schievink
f4165731ad Use associated_items query in impl overlap check
This reduces the number of `associated_item` queries done here.
2020-02-08 14:37:03 +01:00
Jonas Schievink
66fd4e6ed8 Make associated_items query return a slice 2020-02-08 14:29:18 +01:00
Josh White
a804d476a6 Corrected E0637.md based on test failure 2020-02-08 08:14:28 -05:00
Chris Simpkins
77d158d401 shorten comment blocks to < 100 characters 2020-02-08 08:13:01 -05:00
bors
85ffd44d3d Auto merge of #68443 - eddyb:abi-compat-enum, r=nagisa
rustc_target: treat enum variants like union members, in call ABIs.

Fixes #68190, by handling non-C-like `enum`s as-if they were an `union` of `struct`s, in call ABIs.
Tests were provided by @sw17ch, from theirs and @bitwalker's original examples.

cc @nagisa @rkruppe
2020-02-08 13:02:21 +00:00
Eduard-Mihai Burtescu
d20e4aa8e3 test: use all: $(call NATIVE_STATICLIB,test) to build a C lib. 2020-02-08 13:40:50 +02:00
Josh White
58d0e67f50 Added compiler flags to example code, removed unexpected curly 2020-02-08 06:18:42 -05:00
Chris Simpkins
9b10fc4205 remove unnecessary import statement, PEP8 format spacing 2020-02-08 00:38:20 -05:00
Chris Simpkins
814aa0667b PEP8 format spacing 2020-02-08 00:31:12 -05:00
Josh White
409146673c Removed trailing white spaces 2020-02-08 00:22:15 -05:00