From d8052d8ee5981bef474fc5d960d72286110a7219 Mon Sep 17 00:00:00 2001 From: Erin Power Date: Sun, 8 Sep 2019 13:52:29 +0200 Subject: [PATCH 1/4] Updated RELEASES.md for 1.38.0 --- RELEASES.md | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index f26f6e6c888ed..ecf49278f4b52 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,117 @@ +Version 1.38.0 (2019-09-26) +========================== + +Language +-------- +- [The `#[global_allocator]` attribute can now be used in submodules.][62735] +- [The `#[deprecated]` attribute can now be used on macros.][62042] + +Compiler +-------- +- [Added pipelined compilation support to `rustc`.][62766] This will + improve compilation times in some cases. For further information please refer + to the [_"Evaluating pipelined rustc compilation"_][pipeline-internals] thread. +- [Added tier 3\* support for the `aarch64-uwp-windows-msvc`, `i686-uwp-windows-gnu`, + `i686-uwp-windows-msvc`, `x86_64-uwp-windows-gnu`, and + `x86_64-uwp-windows-msvc` targets.][60260] +- [Added tier 3 support for the `armv7-unknown-linux-gnueabi` and + `armv7-unknown-linux-musleabi` targets.][63107] +- [Added tier 3 support for the `hexagon-unknown-linux-musl` target.][62814] +- [Added tier 3 support for the `riscv32i-unknown-none-elf` target.][62784] + +\* Refer to Rust's [platform support page][forge-platform-support] for more +information on Rust's tiered platform support. + +Libraries +--------- +- [`ascii::EscapeDefault` now implements `Clone` and `Display`.][63421] +- [Derive macros for prelude traits (e.g. `Clone`, `Debug`, `Hash`) are now + available at the same path as the trait.][63056] (e.g. The `Clone` derive macro + is available at `std::clone::Clone`). This also makes all built-in macros + available in `std`/`core` root. e.g. `std::include_bytes!`. +- [`str::Chars` now implements `Debug`.][63000] +- [`slice::{concat, connect, join}` now accepts `&[T]` in addition to `&T`.][62528] +- [`*const T` and `*mut T` now implement `marker::Unpin`.][62583] +- [`Arc<[T]>` and `Rc<[T]>` now implement `FromIterator`.][61953] +- [Added euclidean remainder and division operations (`div_euclid`, + `rem_euclid`) to all numeric primitives.][61884] Additionally `checked`, + `overflowing`, and `wrapping` versions are available for all + integer primitives. +- [`thread::AccessError` now implements `Clone`, `Copy`, `Eq`, `Error`, and + `PartialEq`.][61491] +- [`iter::{StepBy, Peekable, Take}` now implement `DoubleEndedIterator`.][61457] + +Stabilized APIs +--------------- +- [`<*const T>::cast`] +- [`<*mut T>::cast`] +- [`Duration::as_secs_f32`] +- [`Duration::as_secs_f64`] +- [`Duration::div_duration_f32`] +- [`Duration::div_duration_f64`] +- [`Duration::div_f32`] +- [`Duration::div_f64`] +- [`Duration::from_secs_f32`] +- [`Duration::from_secs_f64`] +- [`Duration::mul_f32`] +- [`Duration::mul_f64`] +- [`any::type_name`] + +Cargo +----- +- [Added pipelined compilation support to `cargo`.][cargo/7143] +- [You can now pass the `--features` option multiple times to enable + multiple features.][cargo/7084] + +Misc +---- +- [`rustc` will now warn about some incorrect uses of + `mem::{uninitialized, zeroed}` that are known to cause undefined behaviour.][63346] + +Compatibility Notes +------------------- +- Unfortunately the [`x86_64-unknown-uefi` platform can not be built][62785] + with rustc 1.39.0. +- The [`armv7-unknown-linux-gnueabihf` platform is also known to have + issues][62896] for certain crates such as libc. + +[60260]: https://github.com/rust-lang/rust/pull/60260/ +[61457]: https://github.com/rust-lang/rust/pull/61457/ +[61491]: https://github.com/rust-lang/rust/pull/61491/ +[61884]: https://github.com/rust-lang/rust/pull/61884/ +[61953]: https://github.com/rust-lang/rust/pull/61953/ +[62042]: https://github.com/rust-lang/rust/pull/62042/ +[62528]: https://github.com/rust-lang/rust/pull/62528/ +[62583]: https://github.com/rust-lang/rust/pull/62583/ +[62735]: https://github.com/rust-lang/rust/pull/62735/ +[62766]: https://github.com/rust-lang/rust/pull/62766/ +[62784]: https://github.com/rust-lang/rust/pull/62784/ +[62785]: https://github.com/rust-lang/rust/issues/62785/ +[62814]: https://github.com/rust-lang/rust/pull/62814/ +[62896]: https://github.com/rust-lang/rust/issues/62896/ +[63000]: https://github.com/rust-lang/rust/pull/63000/ +[63056]: https://github.com/rust-lang/rust/pull/63056/ +[63107]: https://github.com/rust-lang/rust/pull/63107/ +[63346]: https://github.com/rust-lang/rust/pull/63346/ +[63421]: https://github.com/rust-lang/rust/pull/63421/ +[cargo/7084]: https://github.com/rust-lang/cargo/pull/7084/ +[cargo/7143]: https://github.com/rust-lang/cargo/pull/7143/ +[`<*const T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast +[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast +[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32 +[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64 +[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32 +[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64 +[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32 +[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64 +[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32 +[`Duration::from_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f64 +[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32 +[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64 +[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html +[forge-platform-support]: https://forge.rust-lang.org/platform-support.html +[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199 + Version 1.37.0 (2019-08-15) ========================== From f3ebfab0678962ae5bc0639baafb0eaa59cd3e1b Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 13 Sep 2019 17:06:09 +0200 Subject: [PATCH 2/4] Make fn ptr always structural match, regardless of whether formal types are. Fix #63479. --- src/librustc_mir/hair/pattern/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 5ecfb84b63236..c82bb5d2ed710 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -1203,7 +1203,13 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>, ty::RawPtr(..) => { // `#[structural_match]` ignores substructure of // `*const _`/`*mut _`, so skip super_visit_with - + // + // (But still tell caller to continue search.) + return false; + } + ty::FnDef(..) | ty::FnPtr(..) => { + // types of formals and return in `fn(_) -> _` are also irrelevant + // // (But still tell caller to continue search.) return false; } From 73c70ca4e237bc30009740a68e7c9451220c904b Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 13 Sep 2019 17:08:01 +0200 Subject: [PATCH 3/4] Regression tests for fn ptr and `#[structural_match]` as discussed in #63479. --- .../fn-ptr-is-structurally-matchable.rs | 135 ++++++++++++++++++ .../ui/rfc1445/issue-63479-match-fnptr.rs | 36 +++++ 2 files changed, 171 insertions(+) create mode 100644 src/test/ui/rfc1445/fn-ptr-is-structurally-matchable.rs create mode 100644 src/test/ui/rfc1445/issue-63479-match-fnptr.rs diff --git a/src/test/ui/rfc1445/fn-ptr-is-structurally-matchable.rs b/src/test/ui/rfc1445/fn-ptr-is-structurally-matchable.rs new file mode 100644 index 0000000000000..5b378fb2a5928 --- /dev/null +++ b/src/test/ui/rfc1445/fn-ptr-is-structurally-matchable.rs @@ -0,0 +1,135 @@ +// run-pass + +// This file checks that fn ptrs are considered structurally matchable. +// See also rust-lang/rust#63479. + +fn main() { + let mut count = 0; + + // A type which is not structurally matchable: + struct NotSM; + + // And one that is: + #[derive(PartialEq, Eq)] + struct SM; + + fn trivial() {} + + fn sm_to(_: SM) {} + fn not_sm_to(_: NotSM) {} + fn to_sm() -> SM { SM } + fn to_not_sm() -> NotSM { NotSM } + + // To recreate the scenario of interest in #63479, we need to add + // a ref-level-of-indirection so that we descend into the type. + + fn r_sm_to(_: &SM) {} + fn r_not_sm_to(_: &NotSM) {} + fn r_to_r_sm(_: &()) -> &SM { &SM } + fn r_to_r_not_sm(_: &()) -> &NotSM { &NotSM } + + #[derive(PartialEq, Eq)] + struct Wrap(T); + + // In the code below, we put the match input into a local so that + // we can assign it an explicit type that is an fn ptr instead of + // a singleton type of the fn itself that the type inference would + // otherwise assign. + + // Check that fn() is #[structural_match] + const CFN1: Wrap = Wrap(trivial); + let input: Wrap = Wrap(trivial); + match Wrap(input) { + Wrap(CFN1) => count += 1, + Wrap(_) => {} + }; + + // Check that fn(T) is #[structural_match] when T is too. + const CFN2: Wrap = Wrap(sm_to); + let input: Wrap = Wrap(sm_to); + match Wrap(input) { + Wrap(CFN2) => count += 1, + Wrap(_) => {} + }; + + // Check that fn() -> T is #[structural_match] when T is too. + const CFN3: Wrap SM> = Wrap(to_sm); + let input: Wrap SM> = Wrap(to_sm); + match Wrap(input) { + Wrap(CFN3) => count += 1, + Wrap(_) => {} + }; + + // Check that fn(T) is #[structural_match] even if T is not. + const CFN4: Wrap = Wrap(not_sm_to); + let input: Wrap = Wrap(not_sm_to); + match Wrap(input) { + Wrap(CFN4) => count += 1, + Wrap(_) => {} + }; + + // Check that fn() -> T is #[structural_match] even if T is not. + const CFN5: Wrap NotSM> = Wrap(to_not_sm); + let input: Wrap NotSM> = Wrap(to_not_sm); + match Wrap(input) { + Wrap(CFN5) => count += 1, + Wrap(_) => {} + }; + + // Check that fn(&T) is #[structural_match] when T is too. + const CFN6: Wrap = Wrap(r_sm_to); + let input: Wrap = Wrap(r_sm_to); + match Wrap(input) { + Wrap(CFN6) => count += 1, + Wrap(_) => {} + }; + + // Check that fn() -> &T is #[structural_match] when T is too. + const CFN7: Wrap &SM> = Wrap(r_to_r_sm); + let input: Wrap &SM> = Wrap(r_to_r_sm); + match Wrap(input) { + Wrap(CFN7) => count += 1, + Wrap(_) => {} + }; + + // Check that fn(T) is #[structural_match] even if T is not. + const CFN8: Wrap = Wrap(r_not_sm_to); + let input: Wrap = Wrap(r_not_sm_to); + match Wrap(input) { + Wrap(CFN8) => count += 1, + Wrap(_) => {} + }; + + // Check that fn() -> T is #[structural_match] even if T is not. + const CFN9: Wrap &NotSM> = Wrap(r_to_r_not_sm); + let input: Wrap &NotSM> = Wrap(r_to_r_not_sm); + match Wrap(input) { + Wrap(CFN9) => count += 1, + Wrap(_) => {} + }; + + // Check that a type which has fn ptrs is `#[structural_match]`. + #[derive(PartialEq, Eq)] + struct Foo { + alpha: fn(NotSM), + beta: fn() -> NotSM, + gamma: fn(SM), + delta: fn() -> SM, + } + + const CFOO: Foo = Foo { + alpha: not_sm_to, + beta: to_not_sm, + gamma: sm_to, + delta: to_sm, + }; + + let input = Foo { alpha: not_sm_to, beta: to_not_sm, gamma: sm_to, delta: to_sm }; + match input { + CFOO => count += 1, + Foo { .. } => {} + }; + + // Final count must be 10 now if all + assert_eq!(count, 10); +} diff --git a/src/test/ui/rfc1445/issue-63479-match-fnptr.rs b/src/test/ui/rfc1445/issue-63479-match-fnptr.rs new file mode 100644 index 0000000000000..b3c91cec580bf --- /dev/null +++ b/src/test/ui/rfc1445/issue-63479-match-fnptr.rs @@ -0,0 +1,36 @@ +// run-pass + +// The actual regression test from #63479. (Including this because my +// first draft at fn-ptr-is-structurally-matchable.rs failed to actually +// cover the case this hit; I've since expanded it accordingly, but the +// experience left me wary of leaving this regression test out.) + +#[derive(Eq)] +struct A { + a: i64 +} + +impl PartialEq for A { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.a.eq(&other.a) + } +} + +type Fn = fn(&[A]); + +fn my_fn(_args: &[A]) { + println!("hello world"); +} + +const TEST: Fn = my_fn; + +struct B(Fn); + +fn main() { + let s = B(my_fn); + match s { + B(TEST) => println!("matched"), + _ => panic!("didn't match") + }; +} From e8d2957904cd3680c5eacdc9efcf4ee586074239 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 18 Sep 2019 11:10:46 +0200 Subject: [PATCH 4/4] ci: split aws credentials in two separate users with scoped perms This commit changes our CI to use two separate IAM users to authenticate with AWS: * ci--rust-lang--rust--sccache: has access to the rust-lang-ci-sccache2 S3 bucket and its credentials are available during the whole build. * ci--rust-lang--rust--upload: has access to the rust-lang-ci2 S3 bucket and its credentials are available just during the upload step. The new tokens are available in the `prod-credentials` library. --- src/ci/azure-pipelines/auto.yml | 2 +- src/ci/azure-pipelines/master.yml | 2 +- src/ci/azure-pipelines/steps/run.yml | 11 +++++++---- src/ci/azure-pipelines/try.yml | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ci/azure-pipelines/auto.yml b/src/ci/azure-pipelines/auto.yml index 06fa3bd9f4347..0c7c734e58368 100644 --- a/src/ci/azure-pipelines/auto.yml +++ b/src/ci/azure-pipelines/auto.yml @@ -7,7 +7,7 @@ trigger: - auto variables: -- group: real-prod-credentials +- group: prod-credentials jobs: - job: Linux diff --git a/src/ci/azure-pipelines/master.yml b/src/ci/azure-pipelines/master.yml index 9742c71965851..e2baa923d99f7 100644 --- a/src/ci/azure-pipelines/master.yml +++ b/src/ci/azure-pipelines/master.yml @@ -7,7 +7,7 @@ trigger: - master variables: -- group: real-prod-credentials +- group: prod-credentials pool: vmImage: ubuntu-16.04 diff --git a/src/ci/azure-pipelines/steps/run.yml b/src/ci/azure-pipelines/steps/run.yml index ca32888b74c34..a8791b4b3d220 100644 --- a/src/ci/azure-pipelines/steps/run.yml +++ b/src/ci/azure-pipelines/steps/run.yml @@ -168,7 +168,8 @@ steps: env: CI: true SRC: . - AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) + AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID) + AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY) TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN) condition: and(succeeded(), not(variables.SKIP_JOB)) displayName: Run build @@ -192,7 +193,8 @@ steps: fi retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION env: - AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) + AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID) + AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY) condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1'))) displayName: Upload artifacts @@ -201,7 +203,8 @@ steps: # errors here ever fail the build since this is just informational. - bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv env: - AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) - condition: variables['AWS_SECRET_ACCESS_KEY'] + AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID) + AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY) + condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY'] continueOnError: true displayName: Upload CPU usage statistics diff --git a/src/ci/azure-pipelines/try.yml b/src/ci/azure-pipelines/try.yml index 0df6c6c951f24..c919b1023a0eb 100644 --- a/src/ci/azure-pipelines/try.yml +++ b/src/ci/azure-pipelines/try.yml @@ -3,7 +3,7 @@ trigger: - try variables: -- group: real-prod-credentials +- group: prod-credentials jobs: - job: Linux