Commit Graph

74983 Commits

Author SHA1 Message Date
Niko Matsakis
b680b12e94 kill supporting code from type-variable defaults
This was all unused anyway.
2018-03-01 08:04:26 -07:00
Niko Matsakis
047a8d0161 kill custom type inference defaults (these don't really work anyway) 2018-03-01 08:04:26 -07:00
Niko Matsakis
7112d6584c make Default Copy and Clone 2018-03-01 08:04:26 -07:00
Niko Matsakis
d516b263c6 use {} for Known variant just for more parity 2018-03-01 08:04:26 -07:00
Niko Matsakis
d4df52cacb introduce UniverseIndex into ParamEnv
Always using root environment for now.
2018-03-01 08:04:26 -07:00
Niko Matsakis
e7efce2361 add some comments to Obligation 2018-03-01 08:04:26 -07:00
Niko Matsakis
803bd76127 introduce Universe struct 2018-03-01 08:04:26 -07:00
bors
3eeb5a665e Auto merge of #46785 - leodasvacas:type-check-defaults-at-declaration, r=nikomatsakis
[Underspecified semantics] Type check defaults at declaration.

Fixes  #46669. See the test for code that compiles on stable but will no longer compile. This falls under a "Underspecified language semantics" fix. **Needs crater**.

On type and trait declarations, we currently allow anything that name checks as a type parameter default. That allows the user to write a default that can never be applied, or even a default that may conditionally be applied depending on the type of another parameter. Mostly this just defers the error to use sites, but also allows clever hacks such as `Foo<T, U = <T as Iterator>::Item>` where `U` will be able to apply it's default only when `T: Iterator`. Maybe that means this bug is a feature, but it's a fiddly behaviour that seems undesirable.

This PR validates defaults at declaration sites by ensuring all predicates on the parameter are valid for the default. With the exception of `Self: Sized` which we don't want to check to allow things like `trait Add<RHS = Self>`.
2018-03-01 13:19:18 +00:00
Scott McMurray
5105fc1681 Fix braces 2018-03-01 02:29:46 -08:00
Scott McMurray
11fefeb61c Add a Zip::nth test for side effects 2018-03-01 02:17:50 -08:00
Scott McMurray
70d5a4600b Specialize Zip::nth for TrustedRandomAccess
Makes the bench asked about on URLO 58x faster :)
2018-03-01 01:57:25 -08:00
Ryan Cumming
363d6040fd Add ignore-pretty for issue-48506.rs
The out-of-line module #37195
2018-03-01 17:51:14 +11:00
M Farkas-Dyck
25b69c4ede impl Default + Hash for ::core::cmp::Reverse 2018-02-28 21:00:48 -08:00
Tobias Stolzmann
6edbe37437
Fix link to rustc guide in README.md 2018-03-01 03:13:17 +01:00
bors
a85417f593 Auto merge of #48349 - nrc:update, r=alexcrichton
Update RLS

r? @alexcrichton
2018-03-01 02:11:35 +00:00
bors
0e3c9bba8e Auto merge of #48615 - Manishearth:rollup, r=Manishearth
Rollup of 10 pull requests

- Successful merges: #48355, #48359, #48380, #48419, #48420, #48461, #48522, #48570, #48572, #48603
- Failed merges:
2018-02-28 23:10:14 +00:00
Manish Goregaokar
b2b9707696
Rollup merge of #48603 - pthariensflame:patch-1, r=frewsxcv
Fixes #47311.
r? @nrc
2018-02-28 15:09:31 -08:00
Manish Goregaokar
f57835b7f4
Rollup merge of #48461 - Manishearth:epoch-dyn-trait, r=nmatsakis
Fixes #47311.
r? @nrc
2018-02-28 15:09:29 -08:00
Manish Goregaokar
6b5519ddac
Rollup merge of #48420 - teiesti:path_parents, r=BurntSushi
Fixes #47311.
r? @nrc
2018-02-28 15:09:27 -08:00
Manish Goregaokar
12515608cb
Rollup merge of #48380 - nikomatsakis:issue-48251-master, r=acrichto
Fixes #47311.
r? @nrc
2018-02-28 15:09:26 -08:00
Manish Goregaokar
fac7d7cfb2
Rollup merge of #48359 - jsgf:remap-path-prefix, r=sanxiyn
Fixes #47311.
r? @nrc
2018-02-28 15:09:24 -08:00
Manish Goregaokar
f59ab8e96a
Rollup merge of #48355 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis
Fixes #47311.
r? @nrc
2018-02-28 15:09:22 -08:00
Stjepan Glavina
cb56b2d152 Fix a bug introduced in previous commit 2018-03-01 00:07:27 +01:00
Vadim Petrochenkov
c9aff92e6d Support parentheses in patterns under feature gate
Improve recovery for trailing comma after `..`
2018-03-01 01:47:56 +03:00
Alex Crichton
804666f4ad rustc: Tweak funclet cleanups of ffi functions
This commit is targeted at addressing #48251 by specifically fixing a case where
a longjmp over Rust frames on MSVC runs cleanups, accidentally running the
"abort the program" cleanup as well. Added in #46833 `extern` ABI functions in
Rust will abort the process if Rust panics, and currently this is modeled as a
normal cleanup like all other destructors.

Unfortunately it turns out that `longjmp` on MSVC is implemented with SEH, the
same mechanism used to implement panics in Rust. This means that `longjmp` over
Rust frames will run Rust cleanups (even though we don't necessarily want it
to). Notably this means that if you `longjmp` over a Rust stack frame then that
probably means you'll abort the program because one of the cleanups will abort
the process.

After some discussion on IRC it turns out that `longjmp` doesn't run cleanups
for *caught* exceptions, it only runs cleanups for cleanup pads. Using this
information this commit tweaks the codegen for an `extern` function to
a catch-all clause for exceptions instead of a cleanup block. This catch-all is
equivalent to the C++ code:

    try {
        foo();
    } catch (...) {
        bar();
    }

and in fact our codegen here is designed to match exactly what clang emits for
that C++ code!

With this tweak a longjmp over Rust code will no longer abort the process. A
longjmp will continue to "accidentally" run Rust cleanups (destructors) on MSVC.
Other non-MSVC platforms will not rust destructors with a longjmp, so we'll
probably still recommend "don't have destructors on the stack", but in any case
this is a more surgical fix than #48567 and should help us stick to standard
personality functions a bit longer.
2018-02-28 13:31:23 -08:00
Stjepan Glavina
082dd6d7af Fix a few run-pass tests 2018-02-28 20:52:38 +01:00
Esteban Küber
24be75d420 fix rebase 2018-02-28 10:56:07 -08:00
Mark Mansi
2ec79f936a Remove E0245; improve E0404 explanation 2018-02-28 12:05:04 -06:00
Niko Matsakis
11eb83ae74
Update issue-48551.rs 2018-02-28 13:04:12 -05:00
Stjepan Glavina
27fae2b24a Remove thread_local_state 2018-02-28 18:59:12 +01:00
leonardo.yvens
3e84aeda0f Update UI test 2018-02-28 12:59:30 -03:00
Niko Matsakis
c84b7815b3 add a comment 2018-02-28 12:33:16 -03:00
leonardo.yvens
a7c7c8a4d7 Check only concrete defaults for well formedness 2018-02-28 12:33:16 -03:00
leonardo.yvens
c74f85f935 Check only predicates with a single param with a concrete default.
This is the most conservative possible and should be always correct.
2018-02-28 12:33:16 -03:00
leonardo.yvens
ac17948d0f Mark non-defaulted params as TyError to avoid a custom visitor. 2018-02-28 12:33:15 -03:00
leonardo.yvens
81ab26c99a Add tests for dependent defaults. 2018-02-28 12:33:15 -03:00
leonardo.yvens
75997d85c5 Check WF of predicates with defaults only if all params have defaults 2018-02-28 12:33:15 -03:00
leonardo.yvens
addc404d32 Check WF of predicate with defaults only if all in LHS have default
Given a trait predicate, if all params appearing in the LHS have
defaults then it should be a backwards compatible predicate. We verify
that by checking the WF of predicate with all defaults substituted
simultaneously.
2018-02-28 12:33:15 -03:00
leonardo.yvens
35499aa9fc Expand comments, address nits. 2018-02-28 12:33:15 -03:00
leonardo.yvens
7c1b6848db use map_bound instead of skip_binder 2018-02-28 12:33:14 -03:00
leonardo.yvens
3b4a06272e Go back to checking only the LHS of trait predicates. 2018-02-28 12:33:14 -03:00
leonardo.yvens
d9c336afb7 default WF: Substitute defaults individually in the clauses. 2018-02-28 12:33:14 -03:00
leonardo.yvens
87c2ad048a default WF: Leverage type substitution, less workarounding
`Predicate` is `TypeFoldable`, use that. Be less clever with the
workaround.
2018-02-28 12:33:14 -03:00
leonardo.yvens
a6bb32c9cc Check WF of defaults even when there are no bounds. 2018-02-28 12:33:14 -03:00
leonardo.yvens
4d9703373d Type check defaults.
And refactor duplicated code.
2018-02-28 12:33:14 -03:00
Amanieu d'Antras
f756ad3d94 Add AArch64 features 2018-02-28 14:47:17 +00:00
Amanieu d'Antras
90b28135cc Remove the v7 feature from AArch64
It isn't a valid LLVM feature for this architecture.
2018-02-28 14:46:31 +00:00
Tobias Stolzmann
b9e9b4a146
Add std::path::Path::ancestors
Squashed commit of the following:

commit 1b5d55e26f667b1a25c83c5db0cbb072013a5122
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Wed Feb 28 00:06:15 2018 +0100

    Bugfix

commit 4265c2db0b0aaa66fdeace5d329665fd2d13903a
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Tue Feb 27 22:59:12 2018 +0100

    Rename std::path::Path::parents into std::path::Path::ancestors

commit 2548e4b14d377d20adad0f08304a0dd6f8e48e23
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Tue Feb 27 12:50:37 2018 +0100

    Add tracking issue

commit 3e2ce51a6eea0e39af05849f76dd2cefd5035e86
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Mon Feb 26 15:05:15 2018 +0100

    impl FusedIterator for Parents

commit a7e096420809740311e19d963d4aba6df77be2f9
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Mon Feb 26 14:38:41 2018 +0100

    Clarify that the iterator returned will yield at least one value

commit 796a36ea203cd197cc4c810eebd21c7e3433e6f1
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Thu Feb 22 14:01:21 2018 +0100

    Fix examples

commit e279383b21f11c97269cb355a5b2a0ecdb65bb0c
Author: Tobias Stolzmann <tobias.stolzmann@gmail.com>
Date:   Thu Feb 22 04:47:24 2018 +0100

    Add std::path::Path::parents
2018-02-28 15:29:16 +01:00
Tatsuyuki Ishi
989134e71b Add regression test for #48551 2018-02-28 22:59:27 +09:00
Stjepan Glavina
c99f4c4c5b Stabilize LocalKey::try_with 2018-02-28 12:41:36 +01:00