]> git.lizzy.rs Git - rust.git/commitdiff
PR feedback
authorScott McMurray <scottmcm@users.noreply.github.com>
Mon, 10 May 2021 05:05:02 +0000 (22:05 -0700)
committerScott McMurray <scottmcm@users.noreply.github.com>
Mon, 10 May 2021 05:05:02 +0000 (22:05 -0700)
library/alloc/src/lib.rs
library/core/src/iter/traits/iterator.rs
src/test/codegen/try_identity.rs
src/test/mir-opt/simplify-arm.rs
src/test/mir-opt/simplify_try.rs

index a635d6ffe995aafa5bcd6ec7571dc43e9adfd04e..3bc376482e9988875f8c194b0f2a4f0b8c73e958 100644 (file)
 #![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)]
index ffac4534b20730a2f6cfd31b42b3dbae5cb87763..777e4bc2c89206728497c9a17c449915d745a38a 100644 (file)
@@ -2418,7 +2418,8 @@ fn try_find<F, R, E>(&mut self, f: F) -> Result<Option<Self::Item>, E>
         Self: Sized,
         F: FnMut(&Self::Item) -> R,
         R: Try<Output = bool>,
-        // 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<Residual = Result<crate::convert::Infallible, E>>,
     {
         #[inline]
index 78da06b2fe44045a7dfcfdfb2ca13e9cc775f6a2..71bfc3b44daf6c0857f578ee809f7354f5f0dfa3 100644 (file)
@@ -7,10 +7,10 @@
 
 type R = Result<u64, i32>;
 
-// 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:
index b789b87f6c2dc943904bd446b3e024d3e4280de2..6a6e39e68f9394cb677f5eb8c5a6f69f0232a890 100644 (file)
@@ -28,10 +28,10 @@ fn from_error<T, E>(e: E) -> Result<T, E> {
     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<u8, i32>) -> Result<u8, i32> {
     let x = match into_result(r) {
         Err(e) => return from_error(From::from(e)),
index a95cb665a97f371f54cd023c087e6526178ef43a..b91a7bfe68fa6895a70e3e524364e61eb15901c3 100644 (file)
@@ -13,10 +13,10 @@ fn from_error<T, E>(e: E) -> Result<T, E> {
     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<u32, i32>) -> Result<u32, i32> {
     let y = match into_result(x) {
         Err(e) => return from_error(From::from(e)),