Skip to content

Rollup of 16 pull requests #61131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 37 commits into from
Closed
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2e39b9c
Make find_local iterate instead of recurse
spastorino May 23, 2019
d5e0353
Update cargo
ehuss May 23, 2019
46ffb6a
tidy: don't short-circuit on license error
ehuss May 23, 2019
d3c73dd
typo
blkerby May 19, 2019
0123fab
Fix typo "spit_paths", add link
blkerby May 24, 2019
fbc6a4b
Revert edition-guide toolstate override
ehuss May 24, 2019
9be8b7e
Fixed type-alias-bounds lint doc
Cerber-Ursi May 24, 2019
a8fc09b
Use FnOnce instead of FnBox in libtest
SimonSapin May 24, 2019
67ee286
Remove the incorrect warning from README.md
scottmcm May 24, 2019
73fd349
Deprecate `FnBox`. `Box<dyn FnOnce()>` can be called directly, since …
SimonSapin May 24, 2019
e396f99
Don't arena-allocate static symbols.
nnethercote May 23, 2019
698e50f
Delay ICE in fold_region so feature gate has chance to stop compilati…
pnkfelix May 24, 2019
8e4132a
Delay ICE in early_free_scope so feature gate has chance to stop comp…
pnkfelix May 24, 2019
c235ba4
Regression test for issue #60654.
pnkfelix May 24, 2019
d01ef7d
improve debug-printing of scalars
RalfJung May 24, 2019
a90cdcc
this is for tidy
RalfJung May 24, 2019
34314ca
Make find iterate instead of recurse
spastorino May 23, 2019
03dc30d
Make sanitize_place iterate instead of recurse
spastorino May 23, 2019
aba152d
Updated my mailmap entry
XAMPPRocky May 24, 2019
10fe269
Make ignore_borrow iterate instead of recurse
spastorino May 23, 2019
cf9ebe4
Make eval_place iterate instead of recurse
spastorino May 24, 2019
5cbb7a1
Rollup merge of #61077 - nnethercote:tweak-prefill, r=petrochenkov
Centril May 24, 2019
cd95523
Rollup merge of #61092 - spastorino:sanitize-place-iterative, r=oli-obk
Centril May 24, 2019
7c386fc
Rollup merge of #61094 - spastorino:find-local-iterate, r=oli-obk
Centril May 24, 2019
1c58342
Rollup merge of #61095 - ehuss:update-cargo, r=alexcrichton
Centril May 24, 2019
c4b2bdf
Rollup merge of #61096 - ehuss:tidy-license-short-circuit, r=Centril
Centril May 24, 2019
7bf0d5d
Rollup merge of #61099 - spastorino:ignore-borrow-iterate, r=oli-obk
Centril May 24, 2019
684c8f2
Rollup merge of #61103 - spastorino:find-iterate, r=oli-obk
Centril May 24, 2019
23cd10e
Rollup merge of #61107 - blkerby:docs_typos, r=Centril
Centril May 24, 2019
6bcc256
Rollup merge of #61110 - ehuss:revert-edition-override, r=Mark-Simula…
Centril May 24, 2019
7d55346
Rollup merge of #61111 - Cerberuser:patch-1, r=steveklabnik
Centril May 24, 2019
28a9c4f
Rollup merge of #61113 - SimonSapin:fnbox, r=alexcrichton
Centril May 24, 2019
9262748
Rollup merge of #61116 - scottmcm:vcpp-download-link, r=alexcrichton
Centril May 24, 2019
35ccfc1
Rollup merge of #61118 - pnkfelix:issue-60654-dont-ice-on-gat, r=varkor
Centril May 24, 2019
d214743
Rollup merge of #61120 - spastorino:eval-place-iterate, r=oli-obk
Centril May 24, 2019
072011e
Rollup merge of #61121 - RalfJung:miri-value-printing, r=oli-obk
Centril May 24, 2019
ca1784f
Rollup merge of #61125 - XAMPPRocky:master, r=jonas-schievink
Centril May 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mailmap
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
#

Aaron Todd <[email protected]>
Aaron Power <[email protected]>
Aaron Power <[email protected]> Erin Power <[email protected]>
Abhishek Chanda <[email protected]> Abhishek Chanda <[email protected]>
Adolfo Ochagavía <[email protected]>
Adrien Tétar <[email protected]>
49 changes: 42 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -253,15 +253,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "cargo"
version = "0.37.0"
version = "0.38.0"
dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crates-io 0.25.0",
"crates-io 0.26.0",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"curl 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -278,7 +278,7 @@ dependencies = [
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ignore 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"im-rc 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"im-rc 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jobserver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -300,6 +300,7 @@ dependencies = [
"serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"strip-ansi-escapes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -537,7 +538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "crates-io"
version = "0.25.0"
version = "0.26.0"
dependencies = [
"curl 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1163,10 +1164,11 @@ dependencies = [

[[package]]
name = "im-rc"
version = "12.3.0"
version = "13.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"sized-chunks 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -2239,7 +2241,7 @@ dependencies = [
name = "rls"
version = "1.36.0"
dependencies = [
"cargo 0.37.0",
"cargo 0.38.0",
"cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy_lints 0.0.212",
"crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3263,6 +3265,14 @@ name = "siphasher"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "sized-chunks"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "slab"
version = "0.4.2"
@@ -3348,6 +3358,14 @@ name = "string_cache_shared"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "strip-ansi-escapes"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"vte 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "strsim"
version = "0.7.0"
@@ -3924,6 +3942,11 @@ name = "utf8-ranges"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "utf8parse"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "vcpkg"
version = "0.2.6"
@@ -3954,6 +3977,14 @@ name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "vte"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "wait-timeout"
version = "0.1.5"
@@ -4158,7 +4189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec"
"checksum ignore 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8dc57fa12805f367736a38541ac1a9fc6a52812a0ca959b1d4d4b640a89eb002"
"checksum im-rc 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9460397452f537fd51808056ff209f4c4c4c9d20d42ae952f517708726284972"
"checksum im-rc 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0197597d095c0d11107975d3175173f810ee572c2501ff4de64f4f3f119806"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053"
"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450"
@@ -4309,13 +4340,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
"checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4"
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
"checksum sized-chunks 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2eb3fe454976eefb479f78f9b394d34d661b647c6326a3a6e66f68bb12c26"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db"
"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"
"checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa"
"checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423"
"checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da"
"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
"checksum strip-ansi-escapes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d63676e2abafa709460982ddc02a3bb586b6d15a49b75c212e06edd3933acee"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e"
"checksum strum_macros 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8baacebd7b7c9b864d83a6ba7a246232983e277b86fa5cdec77f565715a4b136"
@@ -4368,11 +4401,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e7d099f1ee52f823d4bdd60c93c3602043c728f5db3b97bdb548467f7bddea"
"checksum utf-8 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1262dfab4c30d5cb7c07026be00ee343a6cf5027fdc0104a9160f354e5db75c"
"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
"checksum utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d"
"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6aba5e34f93dc7051dfad05b98a18e9156f27e7b431fe1d2398cb6061c0a1dba"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum vte 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f42f536e22f7fcbb407639765c8fd78707a33109301f834a594758bedd6e8cf"
"checksum wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9f3bf741a801531993db6478b95682117471f76916f5e690dd8d45395b09349"
"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -134,9 +134,8 @@ MSVC builds of Rust additionally require an installation of Visual Studio 2017

[Visual Studio Build Tools]: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

At last check (cmake 3.14.3 and msvc 16.0.3) using the 2019 tools fails to
build the in-tree LLVM build with a CMake error, so use 2017 instead by
including the “MSVC v141 – VS 2017 C++ x64/x86 build tools (v14.16)” component.
(If you're installing cmake yourself, be careful that “C++ CMake tools for
Windows” doesn't get included under “Individual components”.)

With these dependencies installed, you can build the compiler in a `cmd.exe`
shell with:
@@ -151,7 +150,7 @@ then you may need to force rustbuild to use an older version. This can be done
by manually calling the appropriate vcvars file before running the bootstrap.

```batch
> CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
> CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
> python x.py build
```

4 changes: 1 addition & 3 deletions src/ci/docker/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
@@ -74,9 +74,7 @@ status_check() {
check_dispatch $1 beta nomicon src/doc/nomicon
check_dispatch $1 beta reference src/doc/reference
check_dispatch $1 beta rust-by-example src/doc/rust-by-example
# Temporarily disabled until
# https://github.com/rust-lang/rust/issues/60459 is fixed.
# check_dispatch $1 beta edition-guide src/doc/edition-guide
check_dispatch $1 beta edition-guide src/doc/edition-guide
check_dispatch $1 beta rls src/tools/rls
check_dispatch $1 beta rustfmt src/tools/rustfmt
check_dispatch $1 beta clippy-driver src/tools/clippy
11 changes: 7 additions & 4 deletions src/doc/rustc/src/lints/listing/warn-by-default.md
Original file line number Diff line number Diff line change
@@ -529,18 +529,21 @@ This lint detects bounds in type aliases. These are not currently enforced.
Some example code that triggers this lint:

```rust
#[allow(dead_code)]
type SendVec<T: Send> = Vec<T>;
```

This will produce:

```text
warning: type alias is never used: `SendVec`
--> src/main.rs:1:1
warning: bounds on generic parameters are not enforced in type aliases
--> src/lib.rs:2:17
|
1 | type SendVec<T: Send> = Vec<T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | type SendVec<T: Send> = Vec<T>;
| ^^^^
|
= note: #[warn(type_alias_bounds)] on by default
= help: the bound will not be checked when the type alias is used, and should be removed
```

## tyvar-behind-raw-pointer
42 changes: 33 additions & 9 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
@@ -759,13 +759,14 @@ impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> {
}
}

/// `FnBox` is deprecated and will be removed.
/// `Box<dyn FnOnce()>` can be called directly, since Rust 1.35.0.
///
/// `FnBox` is a version of the `FnOnce` intended for use with boxed
/// closure objects. The idea is that where one would normally store a
/// `Box<dyn FnOnce()>` in a data structure, you should use
/// closure objects. The idea was that where one would normally store a
/// `Box<dyn FnOnce()>` in a data structure, you whould use
/// `Box<dyn FnBox()>`. The two traits behave essentially the same, except
/// that a `FnBox` closure can only be called if it is boxed. (Note
/// that `FnBox` may be deprecated in the future if `Box<dyn FnOnce()>`
/// closures become directly usable.)
/// that a `FnBox` closure can only be called if it is boxed.
///
/// # Examples
///
@@ -777,6 +778,7 @@ impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> {
///
/// ```
/// #![feature(fnbox)]
/// #![allow(deprecated)]
///
/// use std::boxed::FnBox;
/// use std::collections::HashMap;
@@ -796,16 +798,38 @@ impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> {
/// }
/// }
/// ```
///
/// In Rust 1.35.0 or later, use `FnOnce`, `FnMut`, or `Fn` instead:
///
/// ```
/// use std::collections::HashMap;
///
/// fn make_map() -> HashMap<i32, Box<dyn FnOnce() -> i32>> {
/// let mut map: HashMap<i32, Box<dyn FnOnce() -> i32>> = HashMap::new();
/// map.insert(1, Box::new(|| 22));
/// map.insert(2, Box::new(|| 44));
/// map
/// }
///
/// fn main() {
/// let mut map = make_map();
/// for i in &[1, 2] {
/// let f = map.remove(&i).unwrap();
/// assert_eq!(f(), i * 22);
/// }
/// }
/// ```
#[rustc_paren_sugar]
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
#[unstable(feature = "fnbox", issue = "28796")]
#[rustc_deprecated(reason = "use `FnOnce`, `FnMut`, or `Fn` instead", since = "1.37.0")]
pub trait FnBox<A>: FnOnce<A> {
/// Performs the call operation.
fn call_box(self: Box<Self>, args: A) -> Self::Output;
}

#[unstable(feature = "fnbox",
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
#[unstable(feature = "fnbox", issue = "28796")]
#[rustc_deprecated(reason = "use `FnOnce`, `FnMut`, or `Fn` instead", since = "1.37.0")]
#[allow(deprecated, deprecated_in_future)]
impl<A, F> FnBox<A> for F
where F: FnOnce<A>
{
2 changes: 1 addition & 1 deletion src/libcore/cell.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
//! mutate it.
//!
//! Shareable mutable containers exist to permit mutability in a controlled manner, even in the
//! presence of aliasing. Both `Cell<T>` and `RefCell<T>` allows to do this in a single threaded
//! presence of aliasing. Both `Cell<T>` and `RefCell<T>` allow doing this in a single-threaded
//! way. However, neither `Cell<T>` nor `RefCell<T>` are thread safe (they do not implement
//! `Sync`). If you need to do aliasing and mutation between multiple threads it is possible to
//! use [`Mutex`](../../std/sync/struct.Mutex.html),
15 changes: 9 additions & 6 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
@@ -658,12 +658,15 @@ impl<'tcx> ScopeTree {
// The lifetime was defined on node that doesn't own a body,
// which in practice can only mean a trait or an impl, that
// is the parent of a method, and that is enforced below.
assert_eq!(Some(param_owner_id), self.root_parent,
"free_scope: {:?} not recognized by the \
region scope tree for {:?} / {:?}",
param_owner,
self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)),
self.root_body.map(|hir_id| DefId::local(hir_id.owner)));
if Some(param_owner_id) != self.root_parent {
tcx.sess.delay_span_bug(
DUMMY_SP,
&format!("free_scope: {:?} not recognized by the \
region scope tree for {:?} / {:?}",
param_owner,
self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)),
self.root_body.map(|hir_id| DefId::local(hir_id.owner))));
}

// The trait/impl lifetime is in scope for the method's body.
self.root_body.unwrap().local_id
16 changes: 15 additions & 1 deletion src/librustc/mir/interpret/pointer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt;

use crate::mir;
use crate::ty::layout::{self, HasDataLayout, Size};
use rustc_macros::HashStable;
@@ -70,7 +72,7 @@ impl<T: layout::HasDataLayout> PointerArithmetic for T {}
///
/// Pointer is also generic over the `Tag` associated with each pointer,
/// which is used to do provenance tracking during execution.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd,
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
RustcEncodable, RustcDecodable, Hash, HashStable)]
pub struct Pointer<Tag=(),Id=AllocId> {
pub alloc_id: Id,
@@ -80,6 +82,18 @@ pub struct Pointer<Tag=(),Id=AllocId> {

static_assert_size!(Pointer, 16);

impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for Pointer<Tag, Id> {
default fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}.{:#x}[{:?}]", self.alloc_id, self.offset.bytes(), self.tag)
}
}
// Specialization for no tag
impl<Id: fmt::Debug> fmt::Debug for Pointer<(), Id> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}.{:#x}", self.alloc_id, self.offset.bytes())
}
}

/// Produces a `Pointer` which points to the beginning of the Allocation
impl From<AllocId> for Pointer {
#[inline(always)]
34 changes: 32 additions & 2 deletions src/librustc/mir/interpret/value.rs
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ impl<'tcx> ConstValue<'tcx> {
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 8 bytes in
/// size. Like a range of bytes in an `Allocation`, a `Scalar` can either represent the raw bytes
/// of a simple value or a pointer into another `Allocation`
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd,
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd,
RustcEncodable, RustcDecodable, Hash, HashStable)]
pub enum Scalar<Tag=(), Id=AllocId> {
/// The raw bytes of a simple value.
@@ -113,6 +113,27 @@ pub enum Scalar<Tag=(), Id=AllocId> {
#[cfg(target_arch = "x86_64")]
static_assert_size!(Scalar, 24);

impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for Scalar<Tag, Id> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Scalar::Ptr(ptr) =>
write!(f, "{:?}", ptr),
&Scalar::Bits { bits, size } => {
if size == 0 {
assert_eq!(bits, 0, "ZST value must be 0");
write!(f, "<ZST>")
} else {
assert_eq!(truncate(bits, Size::from_bytes(size as u64)), bits,
"Scalar value {:#x} exceeds size of {} bytes", bits, size);
// Format as hex number wide enough to fit any value of the given `size`.
// So bits=20, size=1 will be "0x14", but with size=4 it'll be "0x00000014".
write!(f, "0x{:>0width$x}", bits, width=(size*2) as usize)
}
}
}
}
}

impl<Tag> fmt::Display for Scalar<Tag> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
@@ -412,7 +433,7 @@ impl<Tag> From<Pointer<Tag>> for Scalar<Tag> {
}
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
pub enum ScalarMaybeUndef<Tag=(), Id=AllocId> {
Scalar(Scalar<Tag, Id>),
Undef,
@@ -425,6 +446,15 @@ impl<Tag> From<Scalar<Tag>> for ScalarMaybeUndef<Tag> {
}
}

impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for ScalarMaybeUndef<Tag, Id> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ScalarMaybeUndef::Undef => write!(f, "Undef"),
ScalarMaybeUndef::Scalar(s) => write!(f, "{:?}", s),
}
}
}

impl<Tag> fmt::Display for ScalarMaybeUndef<Tag> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
9 changes: 5 additions & 4 deletions src/librustc/ty/subst.rs
Original file line number Diff line number Diff line change
@@ -479,21 +479,22 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
// the specialized routine `ty::replace_late_regions()`.
match *r {
ty::ReEarlyBound(data) => {
let r = self.substs.get(data.index as usize).map(|k| k.unpack());
match r {
let rk = self.substs.get(data.index as usize).map(|k| k.unpack());
match rk {
Some(UnpackedKind::Lifetime(lt)) => {
self.shift_region_through_binders(lt)
}
_ => {
let span = self.span.unwrap_or(DUMMY_SP);
span_bug!(
span,
let msg = format!(
"Region parameter out of range \
when substituting in region {} (root type={:?}) \
(index={})",
data.name,
self.root_ty,
data.index);
self.tcx.sess.delay_span_bug(span, &msg);
r
}
}
}
153 changes: 78 additions & 75 deletions src/librustc_mir/borrow_check/nll/type_check/mod.rs
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionV
use rustc::infer::type_variable::TypeVariableOrigin;
use rustc::mir::interpret::{InterpError::BoundsCheck, ConstValue};
use rustc::mir::tcx::PlaceTy;
use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext, NonMutatingUseContext};
use rustc::mir::visit::{PlaceContext, Visitor, NonMutatingUseContext};
use rustc::mir::*;
use rustc::traits::query::type_op;
use rustc::traits::query::type_op::custom::CustomTypeOp;
@@ -447,92 +447,95 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
context: PlaceContext,
) -> PlaceTy<'tcx> {
debug!("sanitize_place: {:?}", place);
let place_ty = match place {
Place::Base(PlaceBase::Local(index)) =>
PlaceTy::from_ty(self.mir.local_decls[*index].ty),
Place::Base(PlaceBase::Static(box Static { kind, ty: sty })) => {
let sty = self.sanitize_type(place, sty);
let check_err =
|verifier: &mut TypeVerifier<'a, 'b, 'gcx, 'tcx>,
place: &Place<'tcx>,
ty,
sty| {
if let Err(terr) = verifier.cx.eq_types(
sty,
ty,
location.to_locations(),
ConstraintCategory::Boring,
) {
span_mirbug!(
verifier,
place,
"bad promoted type ({:?}: {:?}): {:?}",
ty,
sty,
terr
);

place.iterate(|place_base, place_projection| {
let mut place_ty = match place_base {
PlaceBase::Local(index) =>
PlaceTy::from_ty(self.mir.local_decls[*index].ty),
PlaceBase::Static(box Static { kind, ty: sty }) => {
let sty = self.sanitize_type(place, sty);
let check_err =
|verifier: &mut TypeVerifier<'a, 'b, 'gcx, 'tcx>,
place: &Place<'tcx>,
ty,
sty| {
if let Err(terr) = verifier.cx.eq_types(
sty,
ty,
location.to_locations(),
ConstraintCategory::Boring,
) {
span_mirbug!(
verifier,
place,
"bad promoted type ({:?}: {:?}): {:?}",
ty,
sty,
terr
);
};
};
};
match kind {
StaticKind::Promoted(promoted) => {
if !self.errors_reported {
let promoted_mir = &self.mir.promoted[*promoted];
self.sanitize_promoted(promoted_mir, location);

let promoted_ty = promoted_mir.return_ty();
check_err(self, place, promoted_ty, sty);
match kind {
StaticKind::Promoted(promoted) => {
if !self.errors_reported {
let promoted_mir = &self.mir.promoted[*promoted];
self.sanitize_promoted(promoted_mir, location);

let promoted_ty = promoted_mir.return_ty();
check_err(self, place, promoted_ty, sty);
}
}
}
StaticKind::Static(def_id) => {
let ty = self.tcx().type_of(*def_id);
let ty = self.cx.normalize(ty, location);
StaticKind::Static(def_id) => {
let ty = self.tcx().type_of(*def_id);
let ty = self.cx.normalize(ty, location);

check_err(self, place, ty, sty);
check_err(self, place, ty, sty);
}
}
PlaceTy::from_ty(sty)
}
};

// FIXME use place_projection.is_empty() when is available
if let Place::Base(_) = place {
if let PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) = context {
let tcx = self.tcx();
let trait_ref = ty::TraitRef {
def_id: tcx.lang_items().copy_trait().unwrap(),
substs: tcx.mk_substs_trait(place_ty.ty, &[]),
};

// In order to have a Copy operand, the type T of the
// value must be Copy. Note that we prove that T: Copy,
// rather than using the `is_copy_modulo_regions`
// test. This is important because
// `is_copy_modulo_regions` ignores the resulting region
// obligations and assumes they pass. This can result in
// bounds from Copy impls being unsoundly ignored (e.g.,
// #29149). Note that we decide to use Copy before knowing
// whether the bounds fully apply: in effect, the rule is
// that if a value of some type could implement Copy, then
// it must.
self.cx.prove_trait_ref(
trait_ref,
location.to_locations(),
ConstraintCategory::CopyBound,
);
}
PlaceTy::from_ty(sty)
}
Place::Projection(ref proj) => {
let base_context = if context.is_mutating_use() {
PlaceContext::MutatingUse(MutatingUseContext::Projection)
} else {
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
};
let base_ty = self.sanitize_place(&proj.base, location, base_context);
if base_ty.variant_index.is_none() {
if base_ty.ty.references_error() {

for proj in place_projection {
if place_ty.variant_index.is_none() {
if place_ty.ty.references_error() {
assert!(self.errors_reported);
return PlaceTy::from_ty(self.tcx().types.err);
}
}
self.sanitize_projection(base_ty, &proj.elem, place, location)
place_ty = self.sanitize_projection(place_ty, &proj.elem, place, location)
}
};
if let PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) = context {
let tcx = self.tcx();
let trait_ref = ty::TraitRef {
def_id: tcx.lang_items().copy_trait().unwrap(),
substs: tcx.mk_substs_trait(place_ty.ty, &[]),
};

// In order to have a Copy operand, the type T of the
// value must be Copy. Note that we prove that T: Copy,
// rather than using the `is_copy_modulo_regions`
// test. This is important because
// `is_copy_modulo_regions` ignores the resulting region
// obligations and assumes they pass. This can result in
// bounds from Copy impls being unsoundly ignored (e.g.,
// #29149). Note that we decide to use Copy before knowing
// whether the bounds fully apply: in effect, the rule is
// that if a value of some type could implement Copy, then
// it must.
self.cx.prove_trait_ref(
trait_ref,
location.to_locations(),
ConstraintCategory::CopyBound,
);
}
place_ty
place_ty
})
}

fn sanitize_promoted(&mut self, promoted_mir: &'b Mir<'tcx>, location: Location) {
68 changes: 33 additions & 35 deletions src/librustc_mir/borrow_check/place_ext.rs
Original file line number Diff line number Diff line change
@@ -25,40 +25,36 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
mir: &Mir<'tcx>,
locals_state_at_exit: &LocalsStateAtExit,
) -> bool {
match self {
// If a local variable is immutable, then we only need to track borrows to guard
// against two kinds of errors:
// * The variable being dropped while still borrowed (e.g., because the fn returns
// a reference to a local variable)
// * The variable being moved while still borrowed
//
// In particular, the variable cannot be mutated -- the "access checks" will fail --
// so we don't have to worry about mutation while borrowed.
Place::Base(PlaceBase::Local(index)) => {
match locals_state_at_exit {
LocalsStateAtExit::AllAreInvalidated => false,
LocalsStateAtExit::SomeAreInvalidated { has_storage_dead_or_moved } => {
let ignore = !has_storage_dead_or_moved.contains(*index) &&
mir.local_decls[*index].mutability == Mutability::Not;
debug!("ignore_borrow: local {:?} => {:?}", index, ignore);
ignore
self.iterate(|place_base, place_projection| {
let ignore = match place_base {
// If a local variable is immutable, then we only need to track borrows to guard
// against two kinds of errors:
// * The variable being dropped while still borrowed (e.g., because the fn returns
// a reference to a local variable)
// * The variable being moved while still borrowed
//
// In particular, the variable cannot be mutated -- the "access checks" will fail --
// so we don't have to worry about mutation while borrowed.
PlaceBase::Local(index) => {
match locals_state_at_exit {
LocalsStateAtExit::AllAreInvalidated => false,
LocalsStateAtExit::SomeAreInvalidated { has_storage_dead_or_moved } => {
let ignore = !has_storage_dead_or_moved.contains(*index) &&
mir.local_decls[*index].mutability == Mutability::Not;
debug!("ignore_borrow: local {:?} => {:?}", index, ignore);
ignore
}
}
}
}
Place::Base(PlaceBase::Static(box Static{ kind: StaticKind::Promoted(_), .. })) =>
false,
Place::Base(PlaceBase::Static(box Static{ kind: StaticKind::Static(def_id), .. })) => {
tcx.is_mutable_static(*def_id)
}
Place::Projection(proj) => match proj.elem {
ProjectionElem::Field(..)
| ProjectionElem::Downcast(..)
| ProjectionElem::Subslice { .. }
| ProjectionElem::ConstantIndex { .. }
| ProjectionElem::Index(_) => proj.base.ignore_borrow(
tcx, mir, locals_state_at_exit),
PlaceBase::Static(box Static{ kind: StaticKind::Promoted(_), .. }) =>
false,
PlaceBase::Static(box Static{ kind: StaticKind::Static(def_id), .. }) => {
tcx.is_mutable_static(*def_id)
}
};

ProjectionElem::Deref => {
for proj in place_projection {
if proj.elem == ProjectionElem::Deref {
let ty = proj.base.ty(mir, tcx).ty;
match ty.sty {
// For both derefs of raw pointers and `&T`
@@ -71,11 +67,13 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
// original path into a new variable and
// borrowed *that* one, leaving the original
// path unborrowed.
ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) => true,
_ => proj.base.ignore_borrow(tcx, mir, locals_state_at_exit),
ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) => return true,
_ => {}
}
}
},
}
}

ignore
})
}
}
19 changes: 11 additions & 8 deletions src/librustc_mir/dataflow/impls/borrowed_locals.rs
Original file line number Diff line number Diff line change
@@ -91,16 +91,19 @@ struct BorrowedLocalsVisitor<'b, 'c: 'b> {
}

fn find_local<'tcx>(place: &Place<'tcx>) -> Option<Local> {
match *place {
Place::Base(PlaceBase::Local(l)) => Some(l),
Place::Base(PlaceBase::Static(..)) => None,
Place::Projection(ref proj) => {
match proj.elem {
ProjectionElem::Deref => None,
_ => find_local(&proj.base)
place.iterate(|place_base, place_projection| {
for proj in place_projection {
if proj.elem == ProjectionElem::Deref {
return None;
}
}
}

if let PlaceBase::Local(local) = place_base {
Some(*local)
} else {
None
}
})
}

impl<'tcx, 'b, 'c> Visitor<'tcx> for BorrowedLocalsVisitor<'b, 'c> {
27 changes: 14 additions & 13 deletions src/librustc_mir/dataflow/move_paths/mod.rs
Original file line number Diff line number Diff line change
@@ -241,21 +241,22 @@ impl MovePathLookup {
// unknown place, but will rather return the nearest available
// parent.
pub fn find(&self, place: &Place<'tcx>) -> LookupResult {
match *place {
Place::Base(PlaceBase::Local(local)) => LookupResult::Exact(self.locals[local]),
Place::Base(PlaceBase::Static(..)) => LookupResult::Parent(None),
Place::Projection(ref proj) => {
match self.find(&proj.base) {
LookupResult::Exact(base_path) => {
match self.projections.get(&(base_path, proj.elem.lift())) {
Some(&subpath) => LookupResult::Exact(subpath),
None => LookupResult::Parent(Some(base_path))
}
}
inexact => inexact
place.iterate(|place_base, place_projection| {
let mut result = match place_base {
PlaceBase::Local(local) => self.locals[*local],
PlaceBase::Static(..) => return LookupResult::Parent(None),
};

for proj in place_projection {
if let Some(&subpath) = self.projections.get(&(result, proj.elem.lift())) {
result = subpath;
} else {
return LookupResult::Parent(Some(result));
}
}
}

LookupResult::Exact(result)
})
}

pub fn find_local(&self, local: Local) -> MovePathIndex {
52 changes: 26 additions & 26 deletions src/librustc_mir/interpret/place.rs
Original file line number Diff line number Diff line change
@@ -609,40 +609,40 @@ where
/// place; for reading, a more efficient alternative is `eval_place_for_read`.
pub fn eval_place(
&mut self,
mir_place: &mir::Place<'tcx>
mir_place: &mir::Place<'tcx>,
) -> EvalResult<'tcx, PlaceTy<'tcx, M::PointerTag>> {
use rustc::mir::Place::*;
use rustc::mir::PlaceBase;
let place = match *mir_place {
Base(PlaceBase::Local(mir::RETURN_PLACE)) => match self.frame().return_place {
Some(return_place) =>

mir_place.iterate(|place_base, place_projection| {
let mut place = match place_base {
PlaceBase::Local(mir::RETURN_PLACE) => match self.frame().return_place {
Some(return_place) =>
// We use our layout to verify our assumption; caller will validate
// their layout on return.
PlaceTy {
place: *return_place,
layout: self.layout_of(self.monomorphize(self.frame().mir.return_ty())?)?,
},
None => return err!(InvalidNullPointerUsage),
},
Base(PlaceBase::Local(local)) => PlaceTy {
// This works even for dead/uninitialized locals; we check further when writing
place: Place::Local {
frame: self.cur_frame(),
local,
{
PlaceTy {
place: *return_place,
layout: self
.layout_of(self.monomorphize(self.frame().mir.return_ty())?)?,
}
}
None => return err!(InvalidNullPointerUsage),
},
layout: self.layout_of_local(self.frame(), local, None)?,
},
PlaceBase::Local(local) => PlaceTy {
// This works even for dead/uninitialized locals; we check further when writing
place: Place::Local { frame: self.cur_frame(), local: *local },
layout: self.layout_of_local(self.frame(), *local, None)?,
},
_ => self.eval_place_to_mplace(mir_place)?.into(),
};

Projection(ref proj) => {
let place = self.eval_place(&proj.base)?;
self.place_projection(place, &proj.elem)?
for proj in place_projection {
place = self.place_projection(place, &proj.elem)?
}

_ => self.eval_place_to_mplace(mir_place)?.into(),
};

self.dump_place(place.place);
Ok(place)
self.dump_place(place.place);
Ok(place)
})
}

/// Write a scalar to a place
4 changes: 3 additions & 1 deletion src/libstd/env.rs
Original file line number Diff line number Diff line change
@@ -465,7 +465,7 @@ pub struct JoinPathsError {
/// # }
/// ```
///
/// Using `env::join_paths` with `env::spit_paths` to append an item to the `PATH` environment
/// Using `env::join_paths` with [`env::split_paths`] to append an item to the `PATH` environment
/// variable:
///
/// ```
@@ -483,6 +483,8 @@ pub struct JoinPathsError {
/// Ok(())
/// }
/// ```
///
/// [`env::split_paths`]: fn.split_paths.html
#[stable(feature = "env", since = "1.0.0")]
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
where I: IntoIterator<Item=T>, T: AsRef<OsStr>
19 changes: 6 additions & 13 deletions src/libsyntax_pos/symbol.rs
Original file line number Diff line number Diff line change
@@ -866,20 +866,13 @@ pub struct Interner {
}

impl Interner {
fn prefill(init: &[&str]) -> Self {
let mut this = Interner::default();
this.names.reserve(init.len());
this.strings.reserve(init.len());

// We can't allocate empty strings in the arena, so handle this here.
assert!(kw::Invalid.as_u32() == 0 && init[0].is_empty());
this.names.insert("", kw::Invalid);
this.strings.push("");

for string in &init[1..] {
this.intern(string);
fn prefill(init: &[&'static str]) -> Self {
let symbols = (0 .. init.len() as u32).map(Symbol::new);
Interner {
strings: init.to_vec(),
names: init.iter().copied().zip(symbols).collect(),
..Default::default()
}
this
}

pub fn intern(&mut self, string: &str) -> Symbol {
6 changes: 2 additions & 4 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@
#![unstable(feature = "test", issue = "27812")]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![feature(asm)]
#![feature(fnbox)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc, rustc_private))]
#![feature(nll)]
#![feature(set_stdio)]
@@ -56,7 +55,6 @@ pub use self::TestResult::*;

use std::any::Any;
use std::borrow::Cow;
use std::boxed::FnBox;
use std::cmp;
use std::collections::BTreeMap;
use std::env;
@@ -174,7 +172,7 @@ pub trait TDynBenchFn: Send {
pub enum TestFn {
StaticTestFn(fn()),
StaticBenchFn(fn(&mut Bencher)),
DynTestFn(Box<dyn FnBox() + Send>),
DynTestFn(Box<dyn FnOnce() + Send>),
DynBenchFn(Box<dyn TDynBenchFn + 'static>),
}

@@ -1447,7 +1445,7 @@ pub fn run_test(
desc: TestDesc,
monitor_ch: Sender<MonitorMsg>,
nocapture: bool,
testfn: Box<dyn FnBox() + Send>,
testfn: Box<dyn FnOnce() + Send>,
concurrency: Concurrent,
) {
// Buffer for capturing standard I/O
1 change: 1 addition & 0 deletions src/test/run-pass/unsized-locals/fnbox-compat.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(fnbox)]
#![allow(deprecated, deprecated_in_future)]

use std::boxed::FnBox;

12 changes: 4 additions & 8 deletions src/test/ui/confuse-field-and-method/issue-2392.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#![feature(core, fnbox)]

use std::boxed::FnBox;

struct FuncContainer {
f1: fn(data: u8),
f2: extern "C" fn(data: u8),
@@ -18,7 +14,7 @@ struct Obj<F> where F: FnOnce() -> u32 {
}

struct BoxedObj {
boxed_closure: Box<FnBox() -> u32>,
boxed_closure: Box<FnOnce() -> u32>,
}

struct Wrapper<F> where F: FnMut() -> u32 {
@@ -29,8 +25,8 @@ fn func() -> u32 {
0
}

fn check_expression() -> Obj<Box<FnBox() -> u32>> {
Obj { closure: Box::new(|| 42_u32) as Box<FnBox() -> u32>, not_closure: 42 }
fn check_expression() -> Obj<Box<FnOnce() -> u32>> {
Obj { closure: Box::new(|| 42_u32) as Box<FnOnce() -> u32>, not_closure: 42 }
}

fn main() {
@@ -48,7 +44,7 @@ fn main() {
let boxed_fn = BoxedObj { boxed_closure: Box::new(func) };
boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found

let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box<FnBox() -> u32> };
let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box<FnOnce() -> u32> };
boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found

// test expression writing in the notes
28 changes: 14 additions & 14 deletions src/test/ui/confuse-field-and-method/issue-2392.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:39:36: 39:41]>` in the current scope
--> $DIR/issue-2392.rs:40:15
error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:35:36: 35:41]>` in the current scope
--> $DIR/issue-2392.rs:36:15
|
LL | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
@@ -11,8 +11,8 @@ help: to call the function stored in `closure`, surround the field access with p
LL | (o_closure.closure)();
| ^ ^

error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:39:36: 39:41]>` in the current scope
--> $DIR/issue-2392.rs:42:15
error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:35:36: 35:41]>` in the current scope
--> $DIR/issue-2392.rs:38:15
|
LL | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `not_closure` not found for this
@@ -23,7 +23,7 @@ LL | o_closure.not_closure();
| field, not a method

error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
--> $DIR/issue-2392.rs:46:12
--> $DIR/issue-2392.rs:42:12
|
LL | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
@@ -36,7 +36,7 @@ LL | (o_func.closure)();
| ^ ^

error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
--> $DIR/issue-2392.rs:49:14
--> $DIR/issue-2392.rs:45:14
|
LL | struct BoxedObj {
| --------------- method `boxed_closure` not found for this
@@ -49,7 +49,7 @@ LL | (boxed_fn.boxed_closure)();
| ^ ^

error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
--> $DIR/issue-2392.rs:52:19
--> $DIR/issue-2392.rs:48:19
|
LL | struct BoxedObj {
| --------------- method `boxed_closure` not found for this
@@ -62,7 +62,7 @@ LL | (boxed_closure.boxed_closure)();
| ^ ^

error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
--> $DIR/issue-2392.rs:57:12
--> $DIR/issue-2392.rs:53:12
|
LL | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
@@ -75,7 +75,7 @@ LL | (w.wrap.closure)();
| ^ ^

error[E0599]: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
--> $DIR/issue-2392.rs:59:12
--> $DIR/issue-2392.rs:55:12
|
LL | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `not_closure` not found for this
@@ -85,8 +85,8 @@ LL | w.wrap.not_closure();
| |
| field, not a method

error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<(dyn std::boxed::FnBox<(), Output = u32> + 'static)>>` in the current scope
--> $DIR/issue-2392.rs:62:24
error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<(dyn std::ops::FnOnce() -> u32 + 'static)>>` in the current scope
--> $DIR/issue-2392.rs:58:24
|
LL | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
@@ -99,7 +99,7 @@ LL | (check_expression().closure)();
| ^ ^

error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope
--> $DIR/issue-2392.rs:68:31
--> $DIR/issue-2392.rs:64:31
|
LL | struct FuncContainer {
| -------------------- method `f1` not found for this
@@ -112,7 +112,7 @@ LL | ((*self.container).f1)(1);
| ^ ^

error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope
--> $DIR/issue-2392.rs:69:31
--> $DIR/issue-2392.rs:65:31
|
LL | struct FuncContainer {
| -------------------- method `f2` not found for this
@@ -125,7 +125,7 @@ LL | ((*self.container).f2)(1);
| ^ ^

error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope
--> $DIR/issue-2392.rs:70:31
--> $DIR/issue-2392.rs:66:31
|
LL | struct FuncContainer {
| -------------------- method `f3` not found for this
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// rust-lang/rust#60654: Do not ICE on an attempt to use GATs that is
// missing the feature gate.

struct Foo;

impl Iterator for Foo {
type Item<'b> = &'b Foo; //~ ERROR generic associated types are unstable [E0658]

fn next(&mut self) -> Option<Self::Item> {
None
}
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0658]: generic associated types are unstable
--> $DIR/gat-dont-ice-on-absent-feature.rs:7:5
|
LL | type Item<'b> = &'b Foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/44265
= help: add #![feature(generic_associated_types)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 50 files
+1 −0 .travis.yml
+4 −3 Cargo.toml
+1 −0 appveyor.yml
+1 −0 src/bin/cargo/cli.rs
+12 −1 src/cargo/core/compiler/build_config.rs
+5 −0 src/cargo/core/compiler/context/compilation_files.rs
+1 −1 src/cargo/core/compiler/context/mod.rs
+6 −5 src/cargo/core/compiler/custom_build.rs
+1 −1 src/cargo/core/compiler/fingerprint.rs
+6 −6 src/cargo/core/compiler/job_queue.rs
+219 −85 src/cargo/core/compiler/mod.rs
+1 −1 src/cargo/core/compiler/unit.rs
+2 −0 src/cargo/core/features.rs
+2 −0 src/cargo/core/manifest.rs
+1 −1 src/cargo/core/resolver/mod.rs
+2 −2 src/cargo/core/resolver/resolve.rs
+9 −2 src/cargo/lib.rs
+9 −2 src/cargo/ops/cargo_generate_lockfile.rs
+5 −2 src/cargo/ops/cargo_package.rs
+3 −2 src/cargo/ops/common_for_install_and_uninstall.rs
+5 −0 src/cargo/ops/fix.rs
+3 −6 src/cargo/sources/path.rs
+3 −3 src/cargo/sources/registry/index.rs
+2 −2 src/cargo/util/config.rs
+4 −1 src/cargo/util/process_builder.rs
+1 −1 src/crates-io/Cargo.toml
+5 −1 src/doc/man/cargo-metadata.adoc
+5 −1 src/doc/man/generated/cargo-metadata.html
+3 −3 src/doc/src/reference/specifying-dependencies.md
+20 −1 src/doc/src/reference/unstable.md
+4 −46 src/etc/_cargo
+7 −3 src/etc/man/cargo-metadata.1
+19 −2 src/etc/man/cargo-package.1
+19 −2 src/etc/man/cargo.1
+1 −0 tests/testsuite/bench.rs
+18 −4 tests/testsuite/build.rs
+348 −0 tests/testsuite/cache_messages.rs
+4 −2 tests/testsuite/freshness.rs
+1 −0 tests/testsuite/main.rs
+2 −0 tests/testsuite/metabuild.rs
+26 −0 tests/testsuite/metadata.rs
+8 −4 tests/testsuite/package.rs
+29 −0 tests/testsuite/profiles.rs
+1 −0 tests/testsuite/read_manifest.rs
+0 −1 tests/testsuite/registry.rs
+2 −1 tests/testsuite/rustc.rs
+10 −4 tests/testsuite/support/mod.rs
+29 −1 tests/testsuite/support/resolver.rs
+3 −0 tests/testsuite/test.rs
+2 −1 tests/testsuite/update.rs
5 changes: 4 additions & 1 deletion src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
@@ -47,6 +47,9 @@ const EXCEPTIONS: &[&str] = &[
"adler32", // BSD-3-Clause AND Zlib, cargo dep that isn't used
"fortanix-sgx-abi", // MPL-2.0+, libstd but only for `sgx` target
"constant_time_eq", // CC0-1.0, rustfmt
"utf8parse", // Apache-2.0 OR MIT, cargo via strip-ansi-escapes
"vte", // Apache-2.0 OR MIT, cargo via strip-ansi-escapes
"sized-chunks", // MPL-2.0+, cargo via im-rc
];

/// Which crates to check against the whitelist?
@@ -241,7 +244,7 @@ pub fn check(path: &Path, bad: &mut bool) {
}

let toml = dir.path().join("Cargo.toml");
*bad = *bad || !check_license(&toml);
*bad = !check_license(&toml) || *bad;
}
assert!(saw_dir, "no vendored source");
}