Commit Graph

122316 Commits

Author SHA1 Message Date
Matthew Jasper
d660dbc630 Check associated type satisfy their bounds
This was currently only happening due to eager normalization, which
isn't possible if there's specialization or bound variables.
2020-06-20 14:34:50 +01:00
Oliver Scherer
98e97a46e2 Address review comments 2020-06-20 14:58:15 +02:00
Oliver Scherer
53686b91ca Satisfy tidy 2020-06-20 14:15:36 +02:00
Oliver Scherer
9e88b48133 Refer just to the issue in the raw ptr cmp diagnostic instead of explaining everything in the diagnostic 2020-06-20 14:09:07 +02:00
marmeladema
13104ef1c5 Pre-compute def_id_to_hir_id table 2020-06-20 13:02:05 +01:00
Donough Liu
f1e07103d3 Prevent incorrect help message for dereference suggestion 2020-06-20 20:00:36 +08:00
Ralf Jung
5eaee0d887 update Miri 2020-06-20 13:33:47 +02:00
Guillaume Gomez
59d8c4549a Clean up E0695 explanation 2020-06-20 13:28:01 +02:00
Matthew Jasper
04e589ced8 Consider fewer predicates for projection candidates
We now require that projection candidates are applicable with the
idenitity substs of the trait, rather than allowing predicates that are
only applicable for certain substs.
2020-06-20 12:13:21 +01:00
Matthew Jasper
29272fc514 Correctly handle binders inside trait predicates 2020-06-20 12:13:20 +01:00
David Wood
2e781ddacc
lint: normalize projections using opaque types
This commit normalizes projections which contain opaque types (opaque types
are otherwise linted against, which is would have previously made the
test cases added in this commit fail).

Signed-off-by: David Wood <david@davidtw.co>
2020-06-20 12:07:23 +01:00
Donough Liu
ef68bf3929 Try to suggest dereferences when trait selection failed. 2020-06-20 18:53:59 +08:00
Donough Liu
51555186b6 Decouple Autoderef with FnCtxt and move Autoderef to librustc_trait_selection. 2020-06-20 18:29:13 +08:00
Lukas Kalbertodt
1e6e082039
Remove uses of Vec::remove_item 2020-06-20 12:12:28 +02:00
marmeladema
94817e38e1 Pre-compute hir_id_to_def_id mapping 2020-06-20 11:03:58 +01:00
marmeladema
6a0f1af19d Remove HirId to NodeId conversion APIs 2020-06-20 11:03:58 +01:00
marmeladema
a98f35f503 Remove NodeId to HirId conversion APIs 2020-06-20 11:03:57 +01:00
marmeladema
936b6bfa64 Move trait_map into hir::Crate 2020-06-20 11:03:53 +01:00
Lukas Kalbertodt
ef10694d3b
Deprecate Vec::remove_item 2020-06-20 11:09:53 +02:00
Bastian Kauschke
180334c7a8 remove pop_placeholders 2020-06-20 10:58:05 +02:00
Bastian Kauschke
a24c8977ee int -> i32 2020-06-20 10:49:43 +02:00
Bastian Kauschke
c4840db8fc skol -> placeholder 2020-06-20 10:43:16 +02:00
Tomasz Miąsko
66e7a145e8 bootstrap: Factor out common code in supported_sanitizers 2020-06-20 09:48:14 +02:00
Tomasz Miąsko
d2e6e9373b ci: Enable sanitizers on dist-aarch64-linux 2020-06-20 09:48:14 +02:00
Tomasz Miąsko
a3e88beffa bootstrap: Build sanitizer runtimes for aarch64-unknown-linux-gnu 2020-06-20 09:48:14 +02:00
Tomasz Miąsko
2851c9ffb5 Support sanitizers on aarch64-unknown-linux-gnu 2020-06-20 09:48:14 +02:00
Rakshith Ravi
0624a5a063 Squashed all commits 2020-06-20 13:00:16 +05:30
jumbatm
556b7baca2 Update existing test cases.
- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for #5791
- Update test case for #1866
- Update extern-abi-from-macro test case
2020-06-20 16:54:32 +10:00
jumbatm
8f079522e4 Add clashing-extern-fn.rs stderr. 2020-06-20 16:54:32 +10:00
jumbatm
6b74e3cbb9 Add ClashingExternDecl lint.
This lint checks that all declarations for extern fns of the same name
are declared with the same types.
2020-06-20 16:54:32 +10:00
jumbatm
a540b1b38d Add ClashingExternDecl test case. 2020-06-20 16:54:32 +10:00
bors
033013cab3 Auto merge of #73528 - Manishearth:rollup-7djz8nd, r=Manishearth
Rollup of 16 pull requests

Successful merges:

 - #71420 (Specialization is unsound)
 - #71899 (Refactor `try_find` a little)
 - #72689 (add str to common types)
 - #72791 (update coerce docs and unify relevant tests)
 - #72934 (forbid mutable references in all constant contexts except for const-fns)
 - #73027 (Make `need_type_info_err` more conservative)
 - #73347 (Diagnose use of incompatible sanitizers)
 - #73359 (shim.rs: avoid creating `Call` terminators calling `Self`)
 - #73399 (Clean up E0668 explanation)
 - #73436 (Clean up E0670 explanation)
 - #73440 (Add src/librustdoc as an alias for src/tools/rustdoc)
 - #73442 (pretty/mir: const value enums with no variants)
 - #73452 (Unify region variables when projecting associated types)
 - #73458 (Use alloc::Layout in DroplessArena API)
 - #73484 (Update the doc for std::prelude to the correct behavior)
 - #73506 (Bump Rustfmt and RLS)

Failed merges:

r? @ghost
2020-06-20 02:45:08 +00:00
Manish Goregaokar
3e40cca65a
Rollup merge of #73506 - Xanewok:update-rls, r=Xanewok
Bump Rustfmt and RLS

Fixes #73406
Fixes #73199
Fixes #73407
Fixes #73200

cc @calebcartwright @topecongiro

r? @ghost

Let's see what CI says first
2020-06-19 19:43:13 -07:00
Manish Goregaokar
7777b0b03d
Rollup merge of #73484 - poliorcetics:use-prelude-doc, r=sfackler
Update the doc for std::prelude to the correct behavior

Fixes #64686.

One line change to ensure the docs are correct about the behavior of the compiler when inserting`std::prelude::v1`.

I don't think examples are necessary but I can add some (especially those from the original issue) if needed.
2020-06-19 19:43:11 -07:00
Manish Goregaokar
fd1c7835a3
Rollup merge of #73458 - tmiasko:arena-layout, r=matthewjasper
Use alloc::Layout in DroplessArena API
2020-06-19 19:43:09 -07:00
Manish Goregaokar
61f8c3ef27
Rollup merge of #73452 - matthewjasper:auto-rec, r=nikomatsakis
Unify region variables when projecting associated types

This is required to avoid cycles when evaluating auto trait predicates.
Notably, this is required to be able add Chalk types to `CtxtInterners` for `cfg(parallel_compiler)`.

r? @nikomatsakis
2020-06-19 19:43:07 -07:00
Manish Goregaokar
db7203d6f8
Rollup merge of #73442 - davidtwco:issue-72181-pretty-print-const-val-enum-no-variants, r=oli-obk
pretty/mir: const value enums with no variants

Fixes #72181.

This PR modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants).

I'm not convinced that this is the correct approach, folks more familiar with `destructure_const` would be able to say - happy to adjust the PR. Looking through `destructure_const` and the functions that it invokes, it didn't seem like it was written to handle zero-variant-enums - I assume that case is handled earlier in some way so `destructure_const` doesn't need to under normal circumstances. It didn't seem like it would be straightforward to make `destructure_const` handle this case in a first-class-feeling way (e.g. adding a `Variants::None` variant), so this PR makes some minimal changes to avoid ICEs.
2020-06-19 19:43:05 -07:00
Manish Goregaokar
d69d4c39ed
Rollup merge of #73440 - jyn514:bootstrap/build-rustdoc, r=Mark-Simulacrum
Add src/librustdoc as an alias for src/tools/rustdoc

No one actually works with src/tools/rustdoc, it's almost empty.

Closes https://github.com/rust-lang/rust/issues/73439
2020-06-19 19:43:03 -07:00
Manish Goregaokar
2377a50f42
Rollup merge of #73436 - GuillaumeGomez:cleanup-e0670, r=Dylan-DPC
Clean up E0670 explanation

r? @Dylan-DPC
2020-06-19 19:43:01 -07:00
Manish Goregaokar
2dbb8b6ac6
Rollup merge of #73399 - GuillaumeGomez:cleanup-e0668, r=Dylan-DPC
Clean up E0668 explanation

r? @Dylan-DPC
2020-06-19 19:42:59 -07:00
Manish Goregaokar
fe4b4858ca
Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasper
shim.rs: avoid creating `Call` terminators calling `Self`

Also contains some cleanup and doc comment additions so I could make sense of the code.

Fixes https://github.com/rust-lang/rust/issues/73109
Closes https://github.com/rust-lang/rust/pull/73175

r? @matthewjasper
2020-06-19 19:42:57 -07:00
Manish Goregaokar
17b80d947d
Rollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikic
Diagnose use of incompatible sanitizers

Emit an error when incompatible sanitizer are configured through command
line options. Previously the last one configured prevailed and others
were silently ignored.

Additionally use a set to represent configured sanitizers, making it
possible to enable multiple sanitizers at once. At least in principle,
since currently all of them are considered to be incompatible with
others.
2020-06-19 19:42:55 -07:00
Manish Goregaokar
2d1bd57e60
Rollup merge of #73027 - doctorn:issue-72690, r=estebank
Make `need_type_info_err` more conservative

Makes sure arg patterns we are going to suggest on are actually contained within the span of the obligation that caused the inference error (credit to @lcnr for suggesting this fix).

There's a subtle trade-off regarding the handling of local patterns which I've left a comment about.

Resolves #72690
2020-06-19 19:42:53 -07:00
Manish Goregaokar
dac512e04a
Rollup merge of #72934 - christianpoveda:mut-borrows-in-consts, r=oli-obk
forbid mutable references in all constant contexts except for const-fns

PR to address #71212

cc: @ecstatic-morse
2020-06-19 19:42:51 -07:00
Manish Goregaokar
c0a25bec96
Rollup merge of #72791 - lcnr:coerce-refactor, r=estebank
update coerce docs and unify relevant tests

Merges `test/ui/coerce` with `test/ui/coercion`.
Updates the documentation of `librustc_typeck/check/coercion.rs`.
Adds 2 new coercion tests.
2020-06-19 19:42:49 -07:00
Manish Goregaokar
218b90f643
Rollup merge of #72689 - lcnr:common_str, r=estebank
add str to common types

I already expected this to be the case and it may slightly improve perf.

Afaict if we ever want to change str into a lang item this would have to get reverted.
As that would be fairly simple I don't believe this to cause any problems in the future.
2020-06-19 19:42:47 -07:00
Manish Goregaokar
5c9cd82454
Rollup merge of #71899 - cuviper:try_find_map, r=dtolnay
Refactor `try_find` a little

~~This works like `find_map`, but mapping to a `Try` type. It stops when `Ok` is `Some(value)`, with an additional short-circuit on `Try::Error`. This is similar to the unstable `try_find`, but has the advantage of being able to directly return the user's `R: Try` type directly, rather than converting to `Result`.~~
(removed -- `try_find_map` was declined in review)

This PR also refactors `try_find` a little to match style. The `E` type parameter was unnecessary, so it's now removed. The folding closure now has reduced parametricity on just `T = Self::Item`, rather
than the whole `Self` iterator type. There's otherwise no functional change in this.
2020-06-19 19:42:45 -07:00
Manish Goregaokar
203305d095
Rollup merge of #71420 - RalfJung:specialization-incomplete, r=matthewjasper
Specialization is unsound

As discussed in https://github.com/rust-lang/rust/issues/31844#issuecomment-617013949, it might be a good idea to warn users of specialization that the feature they are using is unsound.

I also expanded the "incomplete feature" warning to link the user to the tracking issue.
2020-06-19 19:42:43 -07:00
Joshua Nelson
95f8daa82b Fix -Z unpretty=everybody_loops
It turns out that this has not been working for who knows how long.
Previously:

```
pub fn h() { 1 + 2; }
```

After this change:

```
pub fn h() { loop {} }
```

This only affected the pass when run with the command line
pretty-printing option, so rustdoc was still replacing bodies with
`loop {}`.
2020-06-19 20:27:22 -04:00
bors
34c5cd9a64 Auto merge of #73511 - Manishearth:rollup-3iffxd8, r=Manishearth
Rollup of 13 pull requests

Successful merges:

 - #71568 (Document unsafety in slice/sort.rs)
 - #72709 (`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc)
 - #73214 (Add asm!() support for hexagon)
 - #73248 (save_analysis: improve handling of enum struct variant)
 - #73257 (ty: projections in `transparent_newtype_field`)
 - #73261 (Suggest `?Sized` when applicable for ADTs)
 - #73300 (Implement crate-level-only lints checking.)
 - #73334 (Note numeric literals that can never fit in an expected type)
 - #73357 (Use `LocalDefId` for import IDs in trait map)
 - #73364 (asm: Allow multiple template string arguments; interpret them as newline-separated)
 - #73382 (Only display other method receiver candidates if they actually apply)
 - #73465 (Add specialization of `ToString for char`)
 - #73489 (Refactor hir::Place)

Failed merges:

r? @ghost
2020-06-19 23:04:41 +00:00