Commit Graph

119456 Commits

Author SHA1 Message Date
Esteban Küber
6648a08b30 fix rebase 2020-05-02 18:24:07 -07:00
Esteban Küber
299bd12fe5 Point at associated types when they have a default type
Associated types with a default type in a trait can't be relied upon to
remain of that default type when in use, so literals of that type can't
be used in the trait's items. Point at the associated type and state
that information.

Reduce verbosity for associated consts of the wrong type.
2020-05-02 18:24:07 -07:00
Esteban Küber
ee96b8b119 review comment: use or patterns 2020-05-02 18:24:07 -07:00
Esteban Küber
31b3566196 When a projection is expected, suggest constraining or calling method 2020-05-02 18:24:07 -07:00
Esteban Küber
3a795fba03 On type mismatch involving associated type, suggest constraint
When an associated type is found when a specific type was expected, if
possible provide a structured suggestion constraining the associated
type in a bound.

```
error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
  --> $DIR/associated-types-multiple-types-one-trait.rs:13:5
   |
LL |     want_y(t);
   |     ^^^^^^ expected `i32`, found associated type
...
LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
   |                 ----- required by this bound in `want_y`
   |
   = note:         expected type `i32`
           found associated type `<T as Foo>::Y`
help: consider constraining the associated type `<T as Foo>::Y` to `i32`
   |
LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T)
   |                             ^^^^^^^^^
```

```
error[E0308]: mismatched types
  --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9
   |
LL |     qux(x.func())
   |         ^^^^^^^^ expected `usize`, found associated type
   |
   = note:         expected type `usize`
           found associated type `<impl Trait as Trait>::A`
help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize`
   |
LL | fn foo(x: impl Trait<A = usize>) {
   |                     ^^^^^^^^^^
```
2020-05-02 18:23:46 -07:00
bors
f05a524044 Auto merge of #69274 - LeSeulArtichaut:target-feature-11, r=hanna-kruppe
Implement RFC 2396: `#[target_feature]` 1.1

Tracking issue: #69098

r? @nikomatsakis
cc @gnzlbg @joshtriplett
2020-05-02 20:24:50 +00:00
bors
d20113d0f5 Auto merge of #71794 - RalfJung:miri, r=RalfJung
update Miri

This contains the concurrency support by @vakaras :)

Fixes https://github.com/rust-lang/rust/issues/71729
r? @ghost
Cc @rust-lang/miri
2020-05-02 16:24:51 +00:00
bors
53d3bc02ed Auto merge of #70655 - oli-obk:subrepo_funness, r=Mark-Simulacrum
Make clippy a git subtree instead of a git submodule

r? @eddyb

cc #70651

documentation at https://github.com/rust-lang/rust/pull/70654
2020-05-02 13:19:30 +00:00
bors
7184d137f6 Auto merge of #71795 - RalfJung:rollup-yqxfi5a, r=RalfJung
Rollup of 6 pull requests

Successful merges:

 - #71712 (Miri: port error backtraces to std::backtrace)
 - #71736 (bootstrap: also apply unused-attributes hack without deny_warnings)
 - #71738 (remove AllocId generalization of Pointer)
 - #71739 (remove obsolete comment)
 - #71781 (Uncomment test code for failure to use `Box::pin`)
 - #71782 (Use a non-existent test path instead of clobbering /dev/null)

Failed merges:

r? @ghost
2020-05-02 10:13:57 +00:00
Ralf Jung
2ee49eb738
Rollup merge of #71782 - cuviper:leave-dev-null-alone, r=Mark-Simulacrum
Use a non-existent test path instead of clobbering /dev/null

Fixes #71502.
r? @Mark-Simulacrum
2020-05-02 12:08:15 +02:00
Ralf Jung
a9c818ebb2
Rollup merge of #71781 - estebank:box-pin-test, r=tmandry
Uncomment test code for failure to use `Box::pin`

Close #69083.
2020-05-02 12:08:13 +02:00
Ralf Jung
509896fb96
Rollup merge of #71739 - tshepang:master, r=Dylan-DPC
remove obsolete comment

Referenced was removed in 9f492fefef
2020-05-02 12:08:12 +02:00
Ralf Jung
6616e2ca27
Rollup merge of #71738 - RalfJung:pointer-no-alloc-id, r=oli-obk
remove AllocId generalization of Pointer

This was only needed for the "snapshot" machinery, which is gone.

r? @oli-obk
2020-05-02 12:08:10 +02:00
Ralf Jung
72b8a31cae
Rollup merge of #71736 - RalfJung:silence-spurious-unused, r=Mark-Simulacrum
bootstrap: also apply unused-attributes hack without deny_warnings

This is a follow-up to https://github.com/rust-lang/rust/pull/70881 that also silences these warnings when deny_warnings is off. They otherwise spam my screen during development and make it hard to see actual warnings.

Cc  @eddyb r? @Mark-Simulacrum
2020-05-02 12:08:09 +02:00
Ralf Jung
cd824a5232
Rollup merge of #71712 - RalfJung:error-backtrace, r=oli-obk
Miri: port error backtraces to std::backtrace

No need to pull in an external dependency if libstd already includes this feature (using the same dependency internally, but... still).

r? @oli-obk
2020-05-02 12:08:03 +02:00
Ralf Jung
9c4ae74ce6 update Miri 2020-05-02 12:04:13 +02:00
Oliver Scherer
bce9fae97a Add 'src/tools/clippy/' from commit 'd2708873ef711ec8ab45df1e984ecf24a96cd369'
git-subtree-dir: src/tools/clippy
git-subtree-mainline: 06c44816c1
git-subtree-split: d2708873ef
2020-05-02 09:49:00 +02:00
Oliver Scherer
06c44816c1 Delete the clippy submodule 2020-05-02 09:48:46 +02:00
Oliver Scherer
1ef5a93af6 Also build clippy with ./x.py check 2020-05-02 09:46:42 +02:00
Oliver Scherer
a1824505d8 Gate on clippy on CI 2020-05-02 09:46:42 +02:00
bors
08dfbfb618 Auto merge of #70170 - eddyb:wf-early-exit, r=nikomatsakis
wf: handle "livelock" checking before reaching `WfPredicates::compute`.

For `wf::obligations`'s "livelock" handling, this PR shouldn't cause any behavioral changes, as the check moved to it should be equivalent to the old one in `WfPredicates::compute`.

However, it fixes #70168 by making *other* users of `WfPredicates::compute` (that is, `wf::predicate_obligations` and `compute`'s own upvar handling) correct for `ty::Infer`, in that they now get a `WellFormed(ty::Infer(_))` obligation instead of silently ignoring the type.

r? @nikomatsakis
2020-05-02 06:51:08 +00:00
bors
dae90c1959 Auto merge of #71716 - alexcrichton:bitcode-follow-up, r=nnethercote
Rename `bitcode-in-rlib` option to `embed-bitcode`

This commit finishes work first pioneered in #70458 and started in #71528.
The `-C bitcode-in-rlib` option, which has not yet reached stable, is
renamed to `-C embed-bitcode` since that more accurately reflects what
it does now anyway. Various tests and such are updated along the way as
well.

This'll also need to be backported to the beta channel to ensure we
don't accidentally stabilize `-Cbitcode-in-rlib` as well.
2020-05-02 03:39:04 +00:00
bors
19ae74d0d0 Auto merge of #71776 - Dylan-DPC:rollup-k1iuuow, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71018 (handle ConstValue::ByRef in relate)
 - #71758 (Remove leftover chalk types)
 - #71760 (Document unsafety for `*const T` and `*mut T`)
 - #71761 (doc: reference does not exist, probably a typo)
 - #71762 (doc: this resulted in a link pointing to a non-existent target)

Failed merges:

 - #71726 (Suggest deref when coercing `ty::Ref` to `ty::RawPtr` with arbitrary mutability)

r? @ghost
2020-05-02 00:21:39 +00:00
Esteban Küber
b3a8f212f8 Uncomment test code for failure to use Box::pin
Close #69083.
2020-05-01 16:53:20 -07:00
Josh Stone
fbd3fbdb24 Use a non-existent test path instead of clobbering /dev/null 2020-05-01 16:50:10 -07:00
Dylan DPC
f2fddd35af
Rollup merge of #71762 - tshepang:typo, r=jonas-schievink
doc: this resulted in a link pointing to a non-existent target
2020-05-01 23:16:40 +02:00
Dylan DPC
50f212e4d5
Rollup merge of #71761 - tshepang:missing-target, r=jonas-schievink
doc: reference does not exist, probably a typo
2020-05-01 23:16:38 +02:00
Dylan DPC
05b1991e76
Rollup merge of #71760 - LeSeulArtichaut:document-unsafety, r=Mark-Simulacrum
Document unsafety for `*const T` and `*mut T`

Helps with #66219
r? @Mark-Simulacrum
2020-05-01 23:16:36 +02:00
Dylan DPC
8aad12b87d
Rollup merge of #71758 - jackh726:chalk-remove, r=jackh726
Remove leftover chalk types

Split out from #69406

Since the other PR is having memory problems with `parallel-compiler = true`, figured I should split this out. Surprisingly, this actually changes some errors, and I'm not quite sure why.

r? @nikomatsakis
2020-05-01 23:16:35 +02:00
Dylan DPC
14c3ee906b
Rollup merge of #71018 - lcnr:custom-const-param, r=eddyb
handle ConstValue::ByRef in relate

fixes #68615

r? @eddyb
2020-05-01 23:16:32 +02:00
bors
dba944a6b7 Auto merge of #69808 - cjgillot:vtbl, r=pnkfelix
Avoid duplicating code for each query

There are at the moment roughly 170 queries in librustc.
The way `ty::query` is structured, a lot of code is duplicated for each query.
I suspect this to be responsible for a part of librustc'c compile time.

The first part of this PR reduces the amount of code generic on the query,
replacing it by code generic on the key-value types. I can split it out if needed.

In a second part, the non-inlined methods in the `QueryAccessors` and `QueryDescription` traits
are made into a virtual dispatch table. This allows to reduce even more the number of generated
functions.

This allows to save 1.5s on check build, and 10% on the size of the librustc.rlib.
(Attributed roughly half and half).
My computer is not good enough to measure properly compiling time.
I have no idea of the effect on performance. A perf run may be required.

cc #65031
2020-05-01 21:08:23 +00:00
Jack Huey
ef0da3ba4e Remove leftover chalk types 2020-05-01 14:39:05 -04:00
Tshepang Lekhonkhobe
28f8586698 doc: this resulted in a link pointing to a non-existent target 2020-05-01 20:37:34 +02:00
Tshepang Lekhonkhobe
e0db42b32f doc: reference does not exist, probably a typo 2020-05-01 20:25:50 +02:00
bors
7f65393b9a Auto merge of #71759 - Dylan-DPC:rollup-5hncork, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71744 (remove obsolete comment)
 - #71747 (Remove deadcode in eval_mir_constant_to_operand)
 - #71749 (fix Miri error message padding)
 - #71752 (make Stability doc a more readable (and fix rustdoc warning))
 - #71755 (fix doc reference)

Failed merges:

r? @ghost
2020-05-01 18:00:52 +00:00
LeSeulArtichaut
d61debac64 Document unsafety for *const T and *mut T 2020-05-01 19:49:56 +02:00
Dylan DPC
da42f6897e
Rollup merge of #71755 - tshepang:fix-comment, r=jonas-schievink
fix doc reference

Should of been in e0ce9f8c0a,
but that had a typo.
2020-05-01 19:49:18 +02:00
Dylan DPC
2a3c2b335b
Rollup merge of #71752 - tshepang:more-readable, r=jonas-schievink
make Stability doc a more readable (and fix rustdoc warning)
2020-05-01 19:49:16 +02:00
Dylan DPC
8d9912ef49
Rollup merge of #71749 - RalfJung:miri-error-print, r=oli-obk
fix Miri error message padding

I screwed up in the previous PR, and accidentally padded with spaces instead of 0s...

r? @oli-obk
2020-05-01 19:49:14 +02:00
Dylan DPC
d83d8be65d
Rollup merge of #71747 - spastorino:safety-scheme-around-consts-cleanup, r=oli-obk
Remove deadcode in eval_mir_constant_to_operand

r? @oli-obk @RalfJung
2020-05-01 19:49:13 +02:00
Dylan DPC
54013532cd
Rollup merge of #71744 - tshepang:obsolete-comment, r=Dylan-DPC
remove obsolete comment

Referenced was removed in 8770d0f34a
2020-05-01 19:49:11 +02:00
bors
d2708873ef Auto merge of #5548 - matthiaskrgr:traget_os, r=flip1995
mismatched_target_os: link to respective section in rust reference

changelog: none
2020-05-01 16:33:14 +00:00
Alex Crichton
e1832fa4e4 Rename bitcode-in-rlib option to embed-bitcode
This commit finishes work first pioneered in #70458 and started in #71528.
The `-C bitcode-in-rlib` option, which has not yet reached stable, is
renamed to `-C embed-bitcode` since that more accurately reflects what
it does now anyway. Various tests and such are updated along the way as
well.

This'll also need to be backported to the beta channel to ensure we
don't accidentally stabilize `-Cbitcode-in-rlib` as well.
2020-05-01 09:05:13 -07:00
Tshepang Lekhonkhobe
5f4b7a4585 fix doc reference
Should of been in e0ce9f8c0a,
but that had a typo.
2020-05-01 17:53:52 +02:00
LeSeulArtichaut
8d9f73a690 Add new tests and bless old tests 2020-05-01 17:32:06 +02:00
Tshepang Lekhonkhobe
7a1a69911b make Stability docs a bit more readable, and fix some rustdoc warnings 2020-05-01 16:41:50 +02:00
LeSeulArtichaut
f9b9ba51d3 Prevent functions with #[target_feature] to be coerced to safe function pointers 2020-05-01 16:37:47 +02:00
LeSeulArtichaut
f2c6cbd98f Prevent calls to functions with #[target_feature] in safe contexts 2020-05-01 16:24:59 +02:00
Camille GILLOT
e4976d0caf Restrict access. 2020-05-01 15:10:45 +02:00
Camille GILLOT
282d72f6bb Inline a few things. 2020-05-01 15:10:12 +02:00