nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: openshift-pipelines/pipelines-as-code
Pull request #356 (2021-11-05 20:22:43)

Print only the ApplicationName when no PR
When we don't have a PR created yet, jus t print ApplicationName

improve testing

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>



Patch:
diff --git a/pkg/provider/github/status.go b/pkg/provider/github/status.go
index 8899301a..16a846da 100644
--- a/pkg/provider/github/status.go
+++ b/pkg/provider/github/status.go
@@ -27,6 +27,9 @@ const taskStatusTemplate = `
 
 func getCheckName(status provider.StatusOpts, pacopts *info.PacOpts) string {
 	if pacopts.ApplicationName != "" {
+		if status.OriginalPipelineRunName == "" {
+			return pacopts.ApplicationName
+		}
 		return fmt.Sprintf("%s / %s", pacopts.ApplicationName, status.OriginalPipelineRunName)
 	}
 	return status.OriginalPipelineRunName


Test patch:
diff --git a/pkg/provider/github/status_test.go b/pkg/provider/github/status_test.go
index c589644d..a0f9d621 100644
--- a/pkg/provider/github/status_test.go
+++ b/pkg/provider/github/status_test.go
@@ -254,3 +254,53 @@ func TestGithubProvidercreateStatusCommit(t *testing.T) {
 		})
 	}
 }
+
+func TestGetCheckName(t *testing.T) {
+	type args struct {
+		status  provider.StatusOpts
+		pacopts *info.PacOpts
+	}
+	tests := []struct {
+		name string
+		args args
+		want string
+	}{
+		{
+			name: "no application name",
+			args: args{
+				status: provider.StatusOpts{
+					OriginalPipelineRunName: "HELLO",
+				},
+				pacopts: &info.PacOpts{ApplicationName: ""},
+			},
+			want: "HELLO",
+		},
+		{
+			name: "application and pipelinerun name",
+			args: args{
+				status: provider.StatusOpts{
+					OriginalPipelineRunName: "MOTO",
+				},
+				pacopts: &info.PacOpts{ApplicationName: "HELLO"},
+			},
+			want: "HELLO / MOTO",
+		},
+		{
+			name: "application no pipelinerun name",
+			args: args{
+				status: provider.StatusOpts{
+					OriginalPipelineRunName: "",
+				},
+				pacopts: &info.PacOpts{ApplicationName: "PAC"},
+			},
+			want: "PAC",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := getCheckName(tt.args.status, tt.args.pacopts); got != tt.want {
+				t.Errorf("getCheckName() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
Repository: openshift-pipelines/pipelines-as-code
Pull request #75 (2021-05-20 13:54:56)

Make sure we have some filenames set in resolve command
Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>



Patch:
diff --git a/pkg/cmd/resolve/resolve.go b/pkg/cmd/resolve/resolve.go
index a5f64a49..da06974e 100644
--- a/pkg/cmd/resolve/resolve.go
+++ b/pkg/cmd/resolve/resolve.go
@@ -34,6 +34,9 @@ func Command(p cli.Params) *cobra.Command {
 			if err != nil {
 				return err
 			}
+			if len(filenames) == 0 {
+				return fmt.Errorf("you need to at least specify a file with -f")
+			}
 			s, err := resolveFilenames(cs, filenames)
 			fmt.Println(s)
 			return err


Test patch:
diff --git a/pkg/cmd/resolve/resolve_test.go b/pkg/cmd/resolve/resolve_test.go
index 569e1d9b..ba0f3e68 100644
--- a/pkg/cmd/resolve/resolve_test.go
+++ b/pkg/cmd/resolve/resolve_test.go
@@ -1,11 +1,13 @@
 package resolve
 
 import (
+	"bytes"
 	"fmt"
 	"strings"
 	"testing"
 
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/cli"
+	tparams "github.com/openshift-pipelines/pipelines-as-code/pkg/test/params"
 	"go.uber.org/zap"
 	zapobserver "go.uber.org/zap/zaptest/observer"
 	"gotest.tools/v3/assert"
@@ -28,6 +30,18 @@ spec:
 			  script: "echo hello moto"
 `
 
+func TestCommandFilenameSetProperly(t *testing.T) {
+	params := tparams.FakeParams{}
+	cmd := Command(params)
+	e := bytes.NewBufferString("")
+	o := bytes.NewBufferString("")
+	cmd.SetErr(e)
+	cmd.SetOut(o)
+	cmd.SetArgs([]string{""})
+	err := cmd.Execute()
+	assert.ErrorContains(t, err, "you need to at least specify a file")
+}
+
 func TestResolveFilenames(t *testing.T) {
 	observer, _ := zapobserver.New(zap.InfoLevel)
 	fakelogger := zap.New(observer).Sugar()
Repository: bytecodealliance/wasmtime
Pull request #6072 (2023-03-20 22:01:46)

cranelift: rewrite `iabs(ineg(x))` and `iabs(iabs(x))`
```
;; iabs(ineg(x)) == iabs(x).
;; iabs(iabs(x)) == x.
```


Patch:
diff --git a/cranelift/codegen/src/opts/algebraic.isle b/cranelift/codegen/src/opts/algebraic.isle
index cce5ebe6c..6bc049249 100644
--- a/cranelift/codegen/src/opts/algebraic.isle
+++ b/cranelift/codegen/src/opts/algebraic.isle
@@ -39,6 +39,14 @@
 (rule (simplify (imul ty (ineg ty x) (ineg ty y)))
       (subsume (imul ty x y)))
 
+;; iabs(ineg(x)) == iabs(x).
+(rule (simplify (iabs ty (ineg ty x)))
+      (iabs ty x))
+
+;; iabs(iabs(x)) == iabs(x).
+(rule (simplify (iabs ty inner @ (iabs ty x)))
+      (subsume inner))
+
 ;; x-x == 0.
 (rule (simplify (isub (fits_in_64 (ty_int ty)) x x)) (subsume (iconst ty (imm64 0))))
 


Test patch:
diff --git a/cranelift/filetests/filetests/egraph/algebraic.clif b/cranelift/filetests/filetests/egraph/algebraic.clif
index c29d67abe..f157ac178 100644
--- a/cranelift/filetests/filetests/egraph/algebraic.clif
+++ b/cranelift/filetests/filetests/egraph/algebraic.clif
@@ -242,6 +242,23 @@ block0(v0: i32, v1: i32):
     ; check: return v5
 }
 
+function %iabs_ineg(i32) -> i32 {
+block0(v0: i32):
+    v1 = ineg v0
+    v2 = iabs v1
+    return v2
+    ; check: v3 = iabs v0
+    ; check: return v3
+}
+
+function %iabs_iabs(i32) -> i32 {
+block0(v0: i32):
+    v1 = iabs v0
+    v2 = iabs v1
+    return v2
+    ; check: return v1
+}
+
 function %isub_self(i32) -> i32 {
 block0(v0: i32):
     v1 = isub v0, v0
Repository: onflow/flow-cli
Pull request #1179 (2023-09-03 17:05:49)

fix regression with sending transactions in flow cli 1.4.0

In commit 70c208d23 line 128 was changed to not remove the filepath argument, this pr fixes that. 


Patch:
diff --git a/internal/transactions/send.go b/internal/transactions/send.go
index 61522a78..dea1f7d9 100644
--- a/internal/transactions/send.go
+++ b/internal/transactions/send.go
@@ -125,7 +125,7 @@ func SendTransaction(code []byte, args []string, location string, flow flowkit.S
 	if sendFlags.ArgsJSON != "" {
 		transactionArgs, err = arguments.ParseJSON(sendFlags.ArgsJSON)
 	} else {
-		transactionArgs, err = arguments.ParseWithoutType(args, code, location)
+		transactionArgs, err = arguments.ParseWithoutType(args[1:], code, location)
 	}
 	if err != nil {
 		return nil, fmt.Errorf("error parsing transaction arguments: %w", err)


Test patch:
diff --git a/internal/transactions/transactions_test.go b/internal/transactions/transactions_test.go
index 5d41f0e4..ad9e799c 100644
--- a/internal/transactions/transactions_test.go
+++ b/internal/transactions/transactions_test.go
@@ -141,7 +141,7 @@ func Test_Send(t *testing.T) {
 	t.Run("Success", func(t *testing.T) {
 		const gas = uint64(1000)
 		flags.GasLimit = gas
-		inArgs := []string{tests.TransactionArgString.Filename}
+		inArgs := []string{tests.TransactionArgString.Filename, "test"}
 
 		srv.SendTransaction.Run(func(args mock.Arguments) {
 			roles := args.Get(1).(transactions.AccountRoles)
Repository: rust-analyzer/rust-analyzer
Pull request #8613 (2021-04-21 15:58:43)

minor: Add failing local items test
This is currently broken due to the way ItemTree stores inner items. This test serves as a reminder until this gets fixed.

bors r+


Patch:
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index 542f190a11..ba027c44a6 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -410,6 +410,20 @@ impl DefMap {
         }
     }
 
+    pub fn dump_block_scopes(&self, db: &dyn DefDatabase) -> String {
+        let mut buf = String::new();
+        let mut arc;
+        let mut current_map = self;
+        while let Some(block) = &current_map.block {
+            format_to!(buf, "{:?} in {:?}\n", block.block, block.parent);
+            arc = block.parent.def_map(db);
+            current_map = &*arc;
+        }
+
+        format_to!(buf, "crate scope\n");
+        buf
+    }
+
     fn shrink_to_fit(&mut self) {
         // Exhaustive match to require handling new fields.
         let Self {


Test patch:
diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs
index 63f5fe88db..3e8f16306b 100644
--- a/crates/hir_def/src/body/tests.rs
+++ b/crates/hir_def/src/body/tests.rs
@@ -40,6 +40,14 @@ fn block_def_map_at(ra_fixture: &str) -> String {
     module.def_map(&db).dump(&db)
 }
 
+fn check_block_scopes_at(ra_fixture: &str, expect: Expect) {
+    let (db, position) = crate::test_db::TestDB::with_position(ra_fixture);
+
+    let module = db.module_at_position(position);
+    let actual = module.def_map(&db).dump_block_scopes(&db);
+    expect.assert_eq(&actual);
+}
+
 fn check_at(ra_fixture: &str, expect: Expect) {
     let actual = block_def_map_at(ra_fixture);
     expect.assert_eq(&actual);
diff --git a/crates/hir_def/src/body/tests/block.rs b/crates/hir_def/src/body/tests/block.rs
index 3b6ba4cdec..bc3d0f1387 100644
--- a/crates/hir_def/src/body/tests/block.rs
+++ b/crates/hir_def/src/body/tests/block.rs
@@ -133,6 +133,30 @@ struct Struct {}
     );
 }
 
+#[test]
+fn nested_module_scoping() {
+    check_block_scopes_at(
+        r#"
+fn f() {
+    mod module {
+        struct Struct {}
+        fn f() {
+            use self::Struct;
+            $0
+        }
+    }
+}
+    "#,
+        expect![[r#"
+            BlockId(1) in ModuleId { krate: CrateId(0), block: Some(BlockId(0)), local_id: Idx::<ModuleData>(0) }
+            BlockId(0) in ModuleId { krate: CrateId(0), block: None, local_id: Idx::<ModuleData>(0) }
+            crate scope
+        "#]],
+    );
+    // FIXME: The module nesting here is wrong!
+    // The first block map should be located in module #1 (`mod module`), not #0 (BlockId(0) root module)
+}
+
 #[test]
 fn legacy_macro_items() {
     // Checks that legacy-scoped `macro_rules!` from parent namespaces are resolved and expanded
Repository: rust-analyzer/rust-analyzer
Pull request #8276 (2021-03-31 19:46:13)

Fix block inner item defined in macro
Fixes  #8229

r? @jonas-schievink 


Patch:
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 8d38628111..124dcc8666 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -174,6 +174,12 @@ impl Ctx {
         let forced_vis = self.forced_visibility.take();
 
         let mut block_stack = Vec::new();
+
+        // if container itself is block, add it to the stack
+        if let Some(block) = ast::BlockExpr::cast(container.clone()) {
+            block_stack.push(self.source_ast_id_map.ast_id(&block));
+        }
+
         for event in container.preorder().skip(1) {
             match event {
                 WalkEvent::Enter(node) => {


Test patch:
diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs
index 3eb01dbd0f..86e3d8b86e 100644
--- a/crates/hir_ty/src/tests/macros.rs
+++ b/crates/hir_ty/src/tests/macros.rs
@@ -372,6 +372,32 @@ fn recursive_inner_item_macro_rules() {
     );
 }
 
+#[test]
+fn infer_macro_defining_block_with_items() {
+    check_infer(
+        r#"
+        macro_rules! foo {
+            () => {{
+                fn bar() -> usize { 0 }
+                bar()
+            }};
+        }
+        fn main() {
+            let _a = foo!();
+        }
+    "#,
+        expect![[r#"
+            !15..18 '{0}': usize
+            !16..17 '0': usize
+            !0..24 '{fnbar...bar()}': usize
+            !18..21 'bar': fn bar() -> usize
+            !18..23 'bar()': usize
+            98..122 '{     ...!(); }': ()
+            108..110 '_a': usize
+        "#]],
+    );
+}
+
 #[test]
 fn infer_type_value_macro_having_same_name() {
     check_infer(
Repository: rust-analyzer/rust-analyzer
Pull request #8887 (2021-05-19 19:06:50)

fix: fix derive collection after unresolved attribute fallback
Fixes https://github.com/rust-analyzer/rust-analyzer/pull/8882#issuecomment-844379170

bors r+


Patch:
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 221a5a5567..54e9c8d20e 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -367,6 +367,8 @@ impl DefCollector<'_> {
     /// This improves UX when proc macros are turned off or don't work, and replicates the behavior
     /// before we supported proc. attribute macros.
     fn reseed_with_unresolved_attributes(&mut self) -> ReachedFixedPoint {
+        cov_mark::hit!(unresolved_attribute_fallback);
+
         let mut added_items = false;
         let unexpanded_macros = std::mem::replace(&mut self.unexpanded_macros, Vec::new());
         for directive in &unexpanded_macros {
@@ -391,7 +393,9 @@ impl DefCollector<'_> {
                 added_items = true;
             }
         }
-        self.unexpanded_macros = unexpanded_macros;
+
+        // The collection above might add new unresolved macros (eg. derives), so merge the lists.
+        self.unexpanded_macros.extend(unexpanded_macros);
 
         if added_items {
             // Continue name resolution with the new data.


Test patch:
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs
index c37f915ab4..b34ba885d8 100644
--- a/crates/hir_def/src/nameres/tests/macros.rs
+++ b/crates/hir_def/src/nameres/tests/macros.rs
@@ -685,6 +685,27 @@ pub trait Clone {}
     );
 }
 
+#[test]
+fn builtin_derive_with_unresolved_attributes_fall_back() {
+    // Tests that we still resolve derives after ignoring an unresolved attribute.
+    cov_mark::check!(unresolved_attribute_fallback);
+    let map = compute_crate_def_map(
+        r#"
+        //- /main.rs crate:main deps:core
+        use core::Clone;
+
+        #[derive(Clone)]
+        #[unresolved]
+        struct Foo;
+
+        //- /core.rs crate:core
+        #[rustc_builtin_macro]
+        pub macro Clone {}
+        "#,
+    );
+    assert_eq!(map.modules[map.root].scope.impls().len(), 1);
+}
+
 #[test]
 fn macro_expansion_overflow() {
     cov_mark::check!(macro_expansion_overflow);
@@ -842,7 +863,6 @@ fn collects_derive_helpers() {
 fn resolve_macro_def() {
     check(
         r#"
-//- /lib.rs
 pub macro structs($($i:ident),*) {
     $(struct $i { field: u32 } )*
 }
Repository: rust-analyzer/rust-analyzer
Pull request #8888 (2021-05-19 20:09:46)

fix: fix unresolved attribute fallback again
`ModItem`s are per-file, so we have to track the file if we store them in the crate-level `DefCollector`.

Fixes the remaining issue in https://github.com/rust-analyzer/rust-analyzer/pull/8882#issuecomment-844379170

bors r+


Patch:
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index be645a25d0..02ceb8d505 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -246,7 +246,7 @@ struct DefCollector<'a> {
     proc_macros: Vec<(Name, ProcMacroExpander)>,
     exports_proc_macros: bool,
     from_glob_import: PerNsGlobImports,
-    ignore_attrs_on: FxHashSet<ModItem>,
+    ignore_attrs_on: FxHashSet<InFile<ModItem>>,
 }
 
 impl DefCollector<'_> {
@@ -372,9 +372,9 @@ impl DefCollector<'_> {
         let mut added_items = false;
         let unexpanded_macros = std::mem::replace(&mut self.unexpanded_macros, Vec::new());
         for directive in &unexpanded_macros {
-            if let MacroDirectiveKind::Attr { mod_item, .. } = &directive.kind {
+            if let MacroDirectiveKind::Attr { ast_id, mod_item, .. } = &directive.kind {
                 // Make sure to only add such items once.
-                if !self.ignore_attrs_on.insert(*mod_item) {
+                if !self.ignore_attrs_on.insert(ast_id.ast_id.with_value(*mod_item)) {
                     continue;
                 }
 
@@ -1463,7 +1463,7 @@ impl ModCollector<'_, '_> {
 
         // We failed to resolve an attribute on this item earlier, and are falling back to treating
         // the item as-is.
-        if self.def_collector.ignore_attrs_on.contains(&mod_item) {
+        if self.def_collector.ignore_attrs_on.contains(&InFile::new(self.file_id, mod_item)) {
             return Ok(());
         }
 


Test patch:
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs
index b34ba885d8..6eb5f97be1 100644
--- a/crates/hir_def/src/nameres/tests/macros.rs
+++ b/crates/hir_def/src/nameres/tests/macros.rs
@@ -706,6 +706,35 @@ fn builtin_derive_with_unresolved_attributes_fall_back() {
     assert_eq!(map.modules[map.root].scope.impls().len(), 1);
 }
 
+#[test]
+fn unresolved_attributes_fall_back_track_per_file_moditems() {
+    // Tests that we track per-file ModItems when ignoring an unresolved attribute.
+    // Just tracking the `ModItem` leads to `Foo` getting ignored.
+
+    check(
+        r#"
+        //- /main.rs crate:main
+
+        mod submod;
+
+        #[unresolved]
+        struct Foo;
+
+        //- /submod.rs
+        #[unresolved]
+        struct Bar;
+        "#,
+        expect![[r#"
+            crate
+            Foo: t v
+            submod: t
+
+            crate::submod
+            Bar: t v
+        "#]],
+    );
+}
+
 #[test]
 fn macro_expansion_overflow() {
     cov_mark::check!(macro_expansion_overflow);
Repository: rust-analyzer/rust-analyzer
Pull request #8983 (2021-05-25 09:21:27)

Fix type mismatch caused by macros
MacroStmts should be completely transparent, but it prevented
coercion. (I should maybe give `infer_expr` and `infer_expr_inner`
better names.)


Patch:
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index eab8fac910..79a7321060 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -805,7 +805,7 @@ impl<'a> InferenceContext<'a> {
                     None => self.table.new_float_var(),
                 },
             },
-            Expr::MacroStmts { tail } => self.infer_expr(*tail, expected),
+            Expr::MacroStmts { tail } => self.infer_expr_inner(*tail, expected),
         };
         // use a new type variable if we got unknown here
         let ty = self.insert_type_vars_shallow(ty);


Test patch:
diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs
index bb568ea372..7e9fc8735b 100644
--- a/crates/hir_ty/src/tests/coercion.rs
+++ b/crates/hir_ty/src/tests/coercion.rs
@@ -912,3 +912,47 @@ fn test() -> i32 {
         "#,
     )
 }
+
+#[test]
+fn panic_macro() {
+    check_infer_with_mismatches(
+        r#"
+mod panic {
+    #[macro_export]
+    pub macro panic_2015 {
+        () => (
+            $crate::panicking::panic("explicit panic")
+        ),
+    }
+}
+
+mod panicking {
+    pub fn panic() -> ! { loop {} }
+}
+
+#[rustc_builtin_macro = "core_panic"]
+macro_rules! panic {
+    // Expands to either `$crate::panic::panic_2015` or `$crate::panic::panic_2021`
+    // depending on the edition of the caller.
+    ($($arg:tt)*) => {
+        /* compiler built-in */
+    };
+}
+
+fn main() {
+    panic!("internal error: entered unreachable code")
+}
+        "#,
+        expect![[r#"
+            190..201 '{ loop {} }': !
+            192..199 'loop {}': !
+            197..199 '{}': ()
+            !0..24 '$crate...:panic': fn panic() -> !
+            !0..42 '$crate...anic")': !
+            !0..42 '$crate...anic")': !
+            !0..70 '$crate...code")': !
+            !25..41 '"expli...panic"': &str
+            470..528 '{     ...de") }': ()
+        "#]],
+    );
+}
Repository: rust-analyzer/rust-analyzer
Pull request #8989 (2021-05-25 13:02:17)

fix: Fix type inference not working for new Try trait
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8907
bors r+


Patch:
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index db3c937ff5..edb65622f1 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -580,7 +580,10 @@ impl<'a> InferenceContext<'a> {
     fn resolve_ops_try_ok(&self) -> Option<TypeAliasId> {
         let path = path![core::ops::Try];
         let trait_ = self.resolver.resolve_known_trait(self.db.upcast(), &path)?;
-        self.db.trait_data(trait_).associated_type_by_name(&name![Ok])
+        let trait_data = self.db.trait_data(trait_);
+        trait_data
+            .associated_type_by_name(&name![Ok])
+            .or_else(|| trait_data.associated_type_by_name(&name![Output]))
     }
 
     fn resolve_ops_neg_output(&self) -> Option<TypeAliasId> {


Test patch:
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs
index a5a2df54cb..71905baeb1 100644
--- a/crates/hir_ty/src/tests/traits.rs
+++ b/crates/hir_ty/src/tests/traits.rs
@@ -160,6 +160,43 @@ mod result {
     );
 }
 
+#[test]
+fn infer_tryv2() {
+    check_types(
+        r#"
+//- /main.rs crate:main deps:core
+fn test() {
+    let r: Result<i32, u64> = Result::Ok(1);
+    let v = r?;
+    v;
+} //^ i32
+
+//- /core.rs crate:core
+#[prelude_import] use ops::*;
+mod ops {
+    trait Try {
+        type Output;
+        type Residual;
+    }
+}
+
+#[prelude_import] use result::*;
+mod result {
+    enum Infallible {}
+    enum Result<O, E> {
+        Ok(O),
+        Err(E)
+    }
+
+    impl<O, E> crate::ops::Try for Result<O, E> {
+        type Output = O;
+        type Error = Result<Infallible, E>;
+    }
+}
+"#,
+    );
+}
+
 #[test]
 fn infer_for_loop() {
     check_types(