Commit Graph

85350 Commits

Author SHA1 Message Date
Aaron Hill
4f2624cac9
Fix Rustdoc ICE when checking blanket impls
Fixes #55001, #54744

Previously, SelectionContext would unconditionally cache the selection
result for an obligation. This worked fine for most users of
SelectionContext, but it caused an issue when used by Rustdoc's blanket
impl finder.

The issue occured when SelectionContext chose a ParamCandidate which
contained inference variables. Since inference variables can change
between calls to select(), it's not safe to cache the selection result -
the chosen candidate might not be applicable for future results, leading
to an ICE when we try to run confirmation.

This commit prevents SelectionContext from caching any ParamCandidate
that contains inference variables. This should always be completely
safe, as trait selection should never depend on a particular result
being cached.

I've also added some extra debug!() statements, which I found helpful in
tracking down this bug.
2018-10-22 19:40:43 -04:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
dd91c8fc5a [review comments] modify test and clean up code
Co-Authored-By: estebank <esteban@kuber.com.ar>
2018-10-22 14:56:03 -07:00
Esteban Küber
d0bd69a2d5 review comments 2018-10-22 14:56:02 -07:00
Esteban Küber
e1e52eb5a0 Suggest appropriate syntax on missing lifetime specifier in return type
Suggest using `'static` when a lifetime is missing in the return type
with a structured suggestion instead of a note.
2018-10-22 14:54:29 -07:00
Nicholas Nethercote
b5336c0b97 Add a cheap mode for compute_missing_ctors.
`compute_missing_ctors` is called a lot. It produces a vector, which can
be reasonably large (e.g. 100+ elements), but the vector is almost
always only checked for emptiness.

This commit changes `compute_missing_ctors` so it can be called in a
cheap way that just indicates if the vector would be empty. If
necessary, the function can subsequently be called in an expensive way
to compute the full vector.

This change reduces instruction counts for several benchmarks up to 2%.
2018-10-23 08:20:52 +11:00
Shotaro Yamada
80a6b736ac Unimplement ExactSizeIterator
If root is not START_BLOCK, `basic_blocks().len() - visited` does not represent
their exact size.
2018-10-23 01:54:02 +09:00
Niko Matsakis
64b5599352 stop reporting "unsatisfied lifetime bounds" errors after the first
In particular, after the first for a given region variable. This
suppresses a lot of duplicate errors.
2018-10-22 11:41:46 -04:00
Michael Bradshaw
5b84550d7c Keep an obligation for both sized and unsized types 2018-10-22 07:06:22 -07:00
Niko Matsakis
2921fbaaa8 flesh out closure-substs test 2018-10-22 10:04:47 -04:00
Niko Matsakis
0afccbb654 fix incremental test 2018-10-22 10:04:47 -04:00
Niko Matsakis
dbbdce51dc add regression test for #54124
Fixes #54124
2018-10-22 10:04:47 -04:00
Niko Matsakis
3a17880539 start enforcing closure types 2018-10-22 10:04:47 -04:00
Niko Matsakis
e0871ed318 record supplied sig of closure 2018-10-22 10:04:47 -04:00
Niko Matsakis
a8f3d6dafc convert user-provided signatures into def-id 2018-10-22 10:04:47 -04:00
Niko Matsakis
167b460961 add a table to track user-provided signatures 2018-10-22 10:00:32 -04:00
csmoe
a76690f6a4 optimize unsupported literal diag message 2018-10-22 20:28:37 +08:00
François Mockers
8fe6688fcf better dummy span detection and remove redundant branch 2018-10-22 09:08:09 +02:00
bors
a66dc8a148 Auto merge of #55224 - kryptan:master, r=matthewjasper
Use a keyword in raw identifier example

That's a very small documentation fix. The text says "you can now use keywords as identifiers" but example didn't use a keyword and would work without raw identifiers.
2018-10-22 03:41:28 +00:00
Michael Bradshaw
412ad9bf37 Allow extern statics with an extern type
Fixes #55239
2018-10-21 20:09:42 -07:00
bors
5481485670 Auto merge of #55126 - GuillaumeGomez:improve-search-tabs, r=QuietMisdreavus
improve search tabs look

Fixes #55056.

![screenshot from 2018-10-16 19-06-48](https://user-images.githubusercontent.com/3050060/47034247-1e08b280-d177-11e8-9c1e-c7320af9b561.png)

![screenshot from 2018-10-16 19-09-39](https://user-images.githubusercontent.com/3050060/47034255-2365fd00-d177-11e8-8686-4765d3e56ff5.png)

With this, I think it'll be more obvious.

cc @memoryruins

r? @QuietMisdreavus
2018-10-22 01:04:52 +00:00
varkor
c675111095
Correct trailing ellipsis in name_from_pat 2018-10-22 00:31:07 +01:00
Zack M. Davis
b0d3d3b959 only issue "variant of the expected type" suggestion for enums
Felix S. Klock II pointed out that this suggestion (introduced in
pull-request #43178 / eac74104) was being issued for one-field-struct
expected types (in which case it is misleading and outright wrong),
even though it was only intended for one-field enum-variants (most
notably, `Some`). Particularly tender-hearted code-historians may be
inclined to show mercy towards the author of #43178 on the grounds
that it's somewhat confusing that struct field definitions are given
in a type called `ty::VariantDef`.

Add a conditional to adhere to the original intent. (It would be
possible to generalize to structs, but not obviously net desirable.)
This adds a level of indentation, so the diff here is going to be
easier to read in ignore-whitespace mode (`-w`).

Resolves #55250.
2018-10-21 15:50:45 -07:00
Simon Sapin
ac18635435 Add MaybeUninit::new
Sometimes it *is* initialized!
2018-10-21 23:56:09 +02:00
Jakub Kądziołka
9f7009628f
Fix a typo in the documentation of RangeInclusive 2018-10-21 23:42:19 +02:00
bors
424a749a01 Auto merge of #55179 - bjorn3:miri_public_op_field, r=RalfJung
Give OpTy access to locals for priroda

r? @oli-obk
2018-10-21 20:07:34 +00:00
Peter Hall
0f6e2741f6
Clarified code example
The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of collection elements by the item size. This change demonstrates the idea more straightforwardly, without the calculation.
2018-10-21 18:53:09 +01:00
bors
12a88a6b09 Auto merge of #55236 - petrochenkov:pfail, r=davidtwco
Move parse-fail tests to UI

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

r? @davidtwco
2018-10-21 17:26:16 +00:00
Guillaume Gomez
dc5242592b improve search tabs look 2018-10-21 19:25:33 +02:00
Matthias Krüger
9378705f82 submodules: update clippy from 5afdf8b7 to b1d03437
Changes:
````
new_ret_no_self: add sample from #3313 to Known Problems section.
Support multiline comments and hopefully fix panic
Check for comments in collapsible ifs
Resolve ICE in needless range loop lint
RIIR update_lints: Update changelog links
Rename if_let_redundant_pattern_matching to redundant_pattern_matching
Add lint for redundant pattern matching for explicit return boolean
Fix issue #3322: reword help message for len_zero
Simplify manual_memcpy suggestion in some cases
Fix dogfood
Update known problems for unnecessary_fold
RIIR update_lints: Replace lint count in README.md
Rename `active_lints` to `usable_lints`
Add comment on WalkDir vs. fs::read_dir
sort_by -> sort_by_key
Some more documentation for clippy_dev
Use `WalkDir` to also gather from subdirectories
Avoid linting `boxed_local` on trait implementations.
Website: Make lint categories linkable
Restore clippy_dummy's placeholder name
Swap order of methods in `needless_range_loop` suggestion in some cases
Revert "Exclude pattern guards from unnecessary_fold lint"
Exclude pattern guards from unnecessary_fold lint
````
2018-10-21 17:56:00 +02:00
bors
0e2f912050 Auto merge of #52984 - fabric-and-ink:remove-canonical-var, r=scalexm
Replace CanonicalVar with DebruijnIndex

Close #49887
2018-10-21 14:42:35 +00:00
bjorn3
b178553e55 Address review comments 2018-10-21 16:16:23 +02:00
bjorn3
c32cf25689 Rename read_local_of_frame to access_local 2018-10-21 15:49:20 +02:00
bjorn3
f46e3ba308 Rename alloc_map_ref to alloc_map 2018-10-21 15:49:20 +02:00
bjorn3
825b55e763 Add alloc_map accessor 2018-10-21 15:49:19 +02:00
bjorn3
3742892749 Use read_local_of_frame in eval_place_to_op
Also make `layout_of_local` accept any `Frame`
2018-10-21 15:49:19 +02:00
bjorn3
7d406c9146 Fix errors 2018-10-21 15:49:19 +02:00
bjorn3
3e62ba1af6 Add method to get OpTy for local from arbitrary frame 2018-10-21 15:49:19 +02:00
bjorn3
ea51e32043 Make OpTy field op public for priroda 2018-10-21 15:49:19 +02:00
bors
31b97f789f Auto merge of #55069 - matthewjasper:explain-free-region-liveness, r=nikomatsakis
[NLL] Use new region infer errors when explaining borrows

Use the new free region infer errors for explaining borrows

This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:

* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure to a captured variable. (E0521)

Closes #51026 - `regions-nested-fns-2.rs` isn't changed to that diagnostic, since that would not be the correct error here.
Closes #51169
cc #53882 - The error is (IMO) better now, but it could be better when we trace lifetimes in these error messages.

r? @nikomatsakis cc @pnkfelix
2018-10-21 12:04:25 +00:00
Matthew Jasper
2a3969a3f7 Use new region infer errors for explaining borrows
This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:

* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value
  referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure
  to a captured variable.
2018-10-21 12:35:00 +01:00
Vadim Petrochenkov
21d67c45a3 Fix a few tests with target-specific output
Enable one fully ignored test
2018-10-21 14:06:29 +03:00
Vadim Petrochenkov
7977250fb4 Make sure all ui/parse tests have -Z parse-only
Except those testing parsing during macro expansion
2018-10-21 14:06:29 +03:00
Vadim Petrochenkov
64c0efab85 Make some ui/parser tests compile-pass 2018-10-21 14:06:28 +03:00
Vadim Petrochenkov
51f3b6241d Move more parsing tests to ui/parser 2018-10-21 14:06:28 +03:00
Vadim Petrochenkov
52ede63263 Remove the parse-fail test suite 2018-10-21 14:06:28 +03:00
Vadim Petrochenkov
73e1f8970f Move parse-fail tests to UI 2018-10-21 14:06:28 +03:00
bors
66910ba686 Auto merge of #55125 - RalfJung:stacked-borrows, r=oli-obk
miri engine: Hooks for basic stacked borrows

r? @oli-obk
2018-10-21 09:32:25 +00:00
bors
554b7874a9 Auto merge of #54919 - alexcrichton:update-cargo, r=Mark-Simulacrum
Update Cargo, build curl/OpenSSL statically via features

In addition to to updating Cargo's submodule and Cargo's dependencies,
this also updates Cargo's build to build OpenSSL statically into Cargo
as well as libcurl unconditionally. This removes OpenSSL build logic
from the bootstrap code, and otherwise requests that even on OSX we
build curl statically.
2018-10-21 06:48:10 +00:00
Alex Crichton
4f661c016f Update Cargo, build curl/OpenSSL statically via features
In addition to to updating Cargo's submodule and Cargo's dependencies,
this also updates Cargo's build to build OpenSSL statically into Cargo
as well as libcurl unconditionally. This removes OpenSSL build logic
from the bootstrap code, and otherwise requests that even on OSX we
build curl statically.
2018-10-20 18:47:01 -07:00
Ralf Jung
3f5b550296 update miri 2018-10-21 01:32:45 +02:00