Commit graph

90841 commits

Author SHA1 Message Date
Mazdak Farrokhzad
c22566d96d
Rollup merge of #59132 - nikomatsakis:issue-53548-generator-bound, r=pnkfelix
ignore higher-ranked object bound conditions created by WF

In the `issue-53548` test added in this PR, the `Box<dyn Trait>` type is expanded to `Box<dyn Trait + 'static>`, but the generator "witness" that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF code was encountering an ICE (when debug-assertions were enabled) and an unexpected compilation error (without debug-asserions) when trying to process this `'r` region bound. In particular, to be WF, the region bound must meet the requirements of the trait, and hence we got `for<'r> { 'r: 'static }`. This would ICE because the `Binder` constructor we were using was assering that no higher-ranked regions were involved (because the WF code is supposed to skip those). The error (if debug-asserions were disabled) came because we obviously cannot prove that `'r: 'static` for any region `'r`.  Pursuant with
our "lazy WF" strategy for higher-ranked regions, the fix is not to require that `for<'r> { 'r: 'static }` holds (this is also analogous to what we would do for higher-ranked regions appearing within the trait in other positions).

Fixes #53548

r? @pnkfelix
2019-03-13 03:33:56 +01:00
Mazdak Farrokhzad
3623c1ac4e
Rollup merge of #59130 - RalfJung:non-null, r=rkruppe
Note that NonNull does not launder shared references for mutation

See https://users.rust-lang.org/t/relative-pointer-an-abstraction-to-build-movable-self-referential-types/26186/6
2019-03-13 03:33:54 +01:00
Mazdak Farrokhzad
b70a98f261
Rollup merge of #59129 - sanxiyn:visit-impl-trait, r=varkor
Visit impl Trait for dead_code lint

Fix #59085.
2019-03-13 03:33:53 +01:00
Mazdak Farrokhzad
f3dc046362
Rollup merge of #59124 - sntdevco:master, r=Centril
Replace assert with assert_eq

Use `assert_eq!` instead of `assert!` for the tests
2019-03-13 03:33:51 +01:00
Mazdak Farrokhzad
106159dd06
Rollup merge of #59121 - czipperz:fix_assert_result_fromiterater, r=Centril
impl FromIterator for Result: Use assert_eq! instead of assert!
2019-03-13 03:33:50 +01:00
Mazdak Farrokhzad
6c9bdc3410
Rollup merge of #59101 - kenta7777:reduce-code-repetition, r=oli-obk
Reduces Code Repetitions like `!n >> amt`

Fixes #49937 .
This PR contains defining a function which operates bit inversion and reducing bit operation like `!0u128 >> (128 - size.bits())`.
2019-03-13 03:33:49 +01:00
Mazdak Farrokhzad
f95bbf3da3
Rollup merge of #59093 - Zoxc:no-prealloc, r=michaelwoerister
Remove precompute_in_scope_traits_hashes

r? @michaelwoerister
2019-03-13 03:33:47 +01:00
Mazdak Farrokhzad
c0dcfedd9f
Rollup merge of #59083 - kyren:master, r=varkor
Fix #54822 and associated faulty tests

Type checking associated constants can require trait bounds, but an empty
parameter environment was provided to the trait solver.  Providing an
appropriate parameter environment seems to fix #54822 and also make one of the
cases in src/test/ui/nll/trait-associated-constant.rs that should compile
successfully do so.  It also (slightly) improves the error message in
src/test/ui/associated-const/associated-const-generic-obligations.rs
2019-03-13 03:33:46 +01:00
Mazdak Farrokhzad
13a894288f
Rollup merge of #59080 - nbaksalyar:fix-llvm-codegen-doc, r=frewsxcv
Fix incorrect links in librustc_codegen_llvm documentation
2019-03-13 03:33:44 +01:00
Mazdak Farrokhzad
1008150b1c
Rollup merge of #59057 - czipperz:standardize_range_documentation, r=shepmaster
Standardize `Range*` documentation

This updates the final example in the documentation for the types
`Range`, `RangeFrom`, `RangeFull`, `RangeInclusive`, `RangeTo`,
`RangeToInclusive`.
2019-03-13 03:33:43 +01:00
Mazdak Farrokhzad
68abd9a999
Rollup merge of #59056 - scottmcm:even-fewer-lifetimes, r=sfackler
Use lifetime contravariance to elide more lifetimes in core+alloc+std

Sample:
```diff
-    impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> {
+    impl<A: ?Sized, B: ?Sized> PartialEq<&mut B> for &mut A where A: PartialEq<B> {
         #[inline]
-        fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
+        fn eq(&self, other: &&mut B) -> bool { PartialEq::eq(*self, *other) }
         #[inline]
-        fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
+        fn ne(&self, other: &&mut B) -> bool { PartialEq::ne(*self, *other) }
     }
```

[I didn't know this worked](https://internals.rust-lang.org/t/why-can-you-use-different-unconstrained-lifetimes-to-implement-traits/9544/2?u=scottmcm) until recently, but since defining methods contravariantly in their lifetimes this way has worked back to Rust 1.0, we might as well take advantage of combining it with IHLE.
2019-03-13 03:33:41 +01:00
Mazdak Farrokhzad
fc19f0e75b
Rollup merge of #58998 - xTibor:doc_from_bytes, r=scottmcm
Fix documentation of from_ne_bytes and from_le_bytes

Copypasta mistake, the documentation of `from_ne_bytes` and `from_le_bytes` used the big-endian variant in the example snippets.
2019-03-13 03:33:39 +01:00
Mazdak Farrokhzad
2049d6f4d4
Rollup merge of #58908 - JohnTitor:improve-rand, r=scottmcm
Update rand version

cc: #57724

r? @scottmcm
2019-03-13 03:33:37 +01:00
Mazdak Farrokhzad
ad7b650815
Rollup merge of #58876 - estebank:numeric-lifetime, r=petrochenkov
Parse lifetimes that start with a number and give specific error

Fix #58786.
2019-03-13 03:33:36 +01:00
Mazdak Farrokhzad
445c4bc0f8
Rollup merge of #58829 - Xanewok:scoped-tls, r=Zoxc
librustc_interface: Update scoped-tls to 1.0

Done previously as a part of https://github.com/rust-lang/rust/pull/58748.

r? @Zoxc
2019-03-13 03:33:34 +01:00
John Kåre Alsaker
bc3a84a7f3 Add missing project attributes 2019-03-13 00:08:36 +01:00
John Kåre Alsaker
3936aff216 Use derive macro for HashStable 2019-03-13 00:03:13 +01:00
John Kåre Alsaker
48757a70a3 Fix newtype_index 2019-03-13 00:03:10 +01:00
kyren
aa9bd68fa8 Rename test struct names to something more sensible 2019-03-12 18:33:27 -04:00
bors
f8860f217d Auto merge of #58743 - varkor:bulk-needstest-1, r=alexcrichton
Add tests for several E-needstest issues

This PR adds a number of tests for various `E-needstest` errors. These tend to have been left open for a long time and seem unlikely to be closed otherwise.

Closes https://github.com/rust-lang/rust/issues/10876.
Closes https://github.com/rust-lang/rust/issues/26448.
Closes https://github.com/rust-lang/rust/issues/26577.
Closes https://github.com/rust-lang/rust/issues/26619.
Closes https://github.com/rust-lang/rust/issues/27054.
Closes https://github.com/rust-lang/rust/issues/44127.
Closes https://github.com/rust-lang/rust/issues/44255.
Closes https://github.com/rust-lang/rust/issues/55731.
Closes https://github.com/rust-lang/rust/issues/57781.
2019-03-12 22:15:07 +00:00
Tim Vermeulen
6cc5a3d9cc Forward max and min to max_by and min_by respectively 2019-03-12 20:24:10 +01:00
varkor
5b3e1be724 Remove compiletest comments from tests 2019-03-12 19:06:13 +00:00
bors
7c19e1eed5 Auto merge of #58015 - icefoxen:tryfrom-docs, r=SimonSapin
Expand docs for `TryFrom` and `TryInto`.

The examples are still lacking for now, both for module docs and for methods/impl's.  Will be adding those in further pushes.

Should hopefully resolve the doc concern in #33417 when finished?
2019-03-12 18:58:23 +00:00
Vadim Petrochenkov
1d6f4d66ad resolve: Simplify import resolution for mixed 2015/2018 edition mode 2019-03-12 21:57:02 +03:00
varkor
d17da3a17e Add NLL test error output 2019-03-12 18:34:43 +00:00
varkor
57c6a0b17b Remove invalid ASM tests
These still fail on some architectures.
2019-03-12 18:34:43 +00:00
varkor
216bee499f Ignore WASM on asm tests 2019-03-12 18:34:43 +00:00
varkor
4aa5fd0806 Update test for issue #55731 2019-03-12 18:34:43 +00:00
varkor
1dea6e00de Add a test for #27054 2019-03-12 18:34:43 +00:00
varkor
b4b8a6e0bb Add a test for #26577 2019-03-12 18:34:43 +00:00
varkor
5917d9fc62 Add a test for #28587 2019-03-12 18:34:43 +00:00
varkor
295b6fd0f7 Add a test for #22892 2019-03-12 18:34:43 +00:00
varkor
e3297e7ce3 Add a test for #57781 2019-03-12 18:34:43 +00:00
varkor
b7763af526 Add a test for #55731 2019-03-12 18:34:43 +00:00
varkor
776411bb5a Add a test for #46101 2019-03-12 18:34:43 +00:00
varkor
ec56d6e5b9 Add a test for #44255 2019-03-12 18:34:43 +00:00
varkor
3f16518c05 Add a test for #44127 2019-03-12 18:34:43 +00:00
varkor
d49f4f86d9 Add a test for #26619 2019-03-12 18:34:43 +00:00
varkor
651c1abfb7 Add tests for #26448 2019-03-12 18:34:43 +00:00
varkor
5c563f98b8 Add a test for #10876 2019-03-12 18:34:42 +00:00
Tim Vermeulen
1819250556 Add tests to ensure that Iterator::min and Iterator::max are stable 2019-03-12 19:25:44 +01:00
Tim Vermeulen
0de63d901b Fix comment 2019-03-12 17:53:25 +01:00
Tim Vermeulen
b23a0473b3 Remove the projection part of select_fold1 2019-03-12 17:52:26 +01:00
Tim Vermeulen
8d18e57b8a Fix the bench_max and bench_max_by_key benchmarks 2019-03-12 17:52:10 +01:00
Simon Sapin
db99a3bccd Remove stabilized feature gate in doctest 2019-03-12 17:42:42 +01:00
bors
d06a020e2b Auto merge of #58330 - GuillaumeGomez:rustdoc-js-non-std, r=QuietMisdreavus,Mark-Simulacrum
Add rustdoc JS non-std tests

@QuietMisdreavus: You asked it, here it is!

r? @QuietMisdreavus
2019-03-12 15:33:59 +00:00
Niko Matsakis
261daf27c9 ignore higher-ranked WF requirements for trait objects
In the `issue-53548` test added in this commit, the `Box<dyn Trait>`
type is expanded to `Box<dyn Trait + 'static>`, but the generator
"witness" that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF
code was encountering an ICE (when debug-assertions were enabled) and
an unexpected compilation error (without debug-asserions) when trying
to process this `'r` region bound. In particular, to be WF, the region
bound must meet the requirements of the trait, and hence we got
`for<'r> { 'r: 'static }`. This would ICE because the `Binder`
constructor we were using was assering that no higher-ranked regions
were involved (because the WF code is supposed to skip those). The
error (if debug-asserions were disabled) came because we obviously
cannot prove that `'r: 'static` for any region `'r`.  Pursuant with
our "lazy WF" strategy for higher-ranked regions, the fix is not to
require that `for<'r> { 'r: 'static }` holds (this is also analogous
to what we would do for higher-ranked regions appearing within the
trait in other positions).
2019-03-12 10:57:06 -04:00
Niko Matsakis
4632e3345b add a useful debug printout 2019-03-12 10:52:29 -04:00
Oliver Scherer
2a1eb1cef1 Document the precomputation algorithm's purpose 2019-03-12 15:00:12 +01:00
Oliver Scherer
1ae131211b Explain the bits of UndefMask 2019-03-12 14:43:49 +01:00