rust/compiler
Trevor Gross d21b6f2715
Rollup merge of #128084 - surechen:fix_125997_v1, r=cjgillot
Suggest adding Result return type for associated method in E0277.

Recommit #126515 because I messed up during rebase,

Suggest adding Result return type for associated method in E0277.

For following:

```rust
struct A;
impl A {
    fn test4(&self) {
        let mut _file = File::create("foo.txt")?;
        //~^ ERROR the `?` operator can only be used in a method
    }
```

Suggest:

```rust
impl A {
    fn test4(&self) -> Result<(), Box<dyn std::error::Error>> {
        let mut _file = File::create("foo.txt")?;
        //~^ ERROR the `?` operator can only be used in a method

    Ok(())
    }
}
```

For #125997

r? `@cjgillot`
2024-08-18 23:41:46 -05:00
..
2024-08-11 04:16:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-13 13:40:05 -07:00
2024-08-18 19:46:53 +02:00
2024-08-14 14:18:17 -04:00
2024-08-10 12:07:17 +02:00