From bf0e34c00159b60472ca2f78adb8837b9f5849a2 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 9 May 2021 22:05:02 -0700 Subject: [PATCH] PR feedback --- library/alloc/src/lib.rs | 4 ++-- library/core/src/iter/traits/iterator.rs | 3 ++- src/test/codegen/try_identity.rs | 8 ++++---- src/test/mir-opt/simplify-arm.rs | 8 ++++---- src/test/mir-opt/simplify_try.rs | 8 ++++---- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index a635d6ffe995..3bc376482e99 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -140,8 +140,8 @@ #![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_uninit_array)] #![feature(alloc_layout_extra)] #![feature(trusted_random_access)] -#![feature(try_trait)] -#![feature(try_trait_v2)] +#![cfg_attr(bootstrap, feature(try_trait))] +#![cfg_attr(not(bootstrap), feature(try_trait_v2))] #![feature(min_type_alias_impl_trait)] #![feature(associated_type_bounds)] #![feature(slice_group_by)] diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index ffac4534b207..777e4bc2c892 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -2418,7 +2418,8 @@ pub trait Iterator { Self: Sized, F: FnMut(&Self::Item) -> R, R: Try, - // FIXME: This is a weird bound; the API should change + // FIXME: This bound is rather strange, but means minimal breakage on nightly. + // See #85115 for the issue tracking a holistic solution for this and try_map. R: crate::ops::TryV2>, { #[inline] diff --git a/src/test/codegen/try_identity.rs b/src/test/codegen/try_identity.rs index 78da06b2fe44..71bfc3b44daf 100644 --- a/src/test/codegen/try_identity.rs +++ b/src/test/codegen/try_identity.rs @@ -7,10 +7,10 @@ type R = Result; -// This was written to the `?` from `try_trait`, -// but `try_trait_v2` uses a different structure, -// so the relevant desugar is copied inline -// in order to keep the test testing the same thing. +// This was written to the `?` from `try_trait`, but `try_trait_v2` uses a different structure, +// so the relevant desugar is copied inline in order to keep the test testing the same thing. +// FIXME: while this might be useful for `r#try!`, it would be nice to have a MIR optimization +// that picks up the `?` desugaring, as `SimplifyArmIdentity` does not. See #85133 #[no_mangle] pub fn try_identity(x: R) -> R { // CHECK: start: diff --git a/src/test/mir-opt/simplify-arm.rs b/src/test/mir-opt/simplify-arm.rs index b789b87f6c2d..6a6e39e68f93 100644 --- a/src/test/mir-opt/simplify-arm.rs +++ b/src/test/mir-opt/simplify-arm.rs @@ -28,10 +28,10 @@ fn from_error(e: E) -> Result { Err(e) } -// This was written to the `?` from `try_trait`, -// but `try_trait_v2` uses a different structure, -// so the relevant desugar is copied inline -// in order to keep the test testing the same thing. +// This was written to the `?` from `try_trait`, but `try_trait_v2` uses a different structure, +// so the relevant desugar is copied inline in order to keep the test testing the same thing. +// FIXME: while this might be useful for `r#try!`, it would be nice to have a MIR optimization +// that picks up the `?` desugaring, as `SimplifyArmIdentity` does not. See #85133 fn id_try(r: Result) -> Result { let x = match into_result(r) { Err(e) => return from_error(From::from(e)), diff --git a/src/test/mir-opt/simplify_try.rs b/src/test/mir-opt/simplify_try.rs index a95cb665a97f..b91a7bfe68fa 100644 --- a/src/test/mir-opt/simplify_try.rs +++ b/src/test/mir-opt/simplify_try.rs @@ -13,10 +13,10 @@ fn from_error(e: E) -> Result { Err(e) } -// This was written to the `?` from `try_trait`, -// but `try_trait_v2` uses a different structure, -// so the relevant desugar is copied inline -// in order to keep the test testing the same thing. +// This was written to the `?` from `try_trait`, but `try_trait_v2` uses a different structure, +// so the relevant desugar is copied inline in order to keep the test testing the same thing. +// FIXME: while this might be useful for `r#try!`, it would be nice to have a MIR optimization +// that picks up the `?` desugaring, as `SimplifyArmIdentity` does not. See #85133 fn try_identity(x: Result) -> Result { let y = match into_result(x) { Err(e) => return from_error(From::from(e)),