-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Suggest adding Result return type for associated method in E0277. #128084
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 rust-lang#125997
Hello, I resubmitted this PR. You agreed to merge it before. |
As a follow-up, do you mind fixing span manipulation and indentation of the suggestion? @bors r+ rollup |
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Aug 18, 2024
Suggest adding Result return type for associated method in E0277. Recommit rust-lang#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 rust-lang#125997 r? `@cjgillot`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 18, 2024
Rollup of 3 pull requests Successful merges: - rust-lang#127679 (Stabilize `raw_ref_op` (RFC 2582)) - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#129187 (bootstrap: fix clean's remove_dir_all implementation) r? `@ghost` `@rustbot` modify labels: rollup
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Aug 18, 2024
Suggest adding Result return type for associated method in E0277. Recommit rust-lang#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 rust-lang#125997 r? ``@cjgillot``
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 18, 2024
Rollup of 4 pull requests Successful merges: - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#129187 (bootstrap: fix clean's remove_dir_all implementation) - rust-lang#129208 (Fix order of normalization and recursion in const folding.) - rust-lang#129228 (crashes: more tests) r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 18, 2024
Suggest adding Result return type for associated method in E0277. Recommit rust-lang#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 rust-lang#125997 r? ```@cjgillot```
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 18, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#125854 (Move ZST ABI handling to `rustc_target`) - rust-lang#127623 (fix: fs::remove_dir_all: treat internal ENOENT as success) - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#128902 (doc: std::env::var: Returns None for names with '=' or NUL byte) - rust-lang#129187 (bootstrap: fix clean's remove_dir_all implementation) - rust-lang#129235 (Check that `#[may_dangle]` is properly applied) - rust-lang#129245 (Typo) r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 18, 2024
Suggest adding Result return type for associated method in E0277. Recommit rust-lang#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 rust-lang#125997 r? ````@cjgillot````
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 19, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#128902 (doc: std::env::var: Returns None for names with '=' or NUL byte) - rust-lang#129187 (bootstrap: fix clean's remove_dir_all implementation) - rust-lang#129194 (Fix bootstrap test `detect_src_and_out` on Windows) - rust-lang#129231 (improve submodule updates) - rust-lang#129235 (Check that `#[may_dangle]` is properly applied) - rust-lang#129245 (Typo) r? `@ghost` `@rustbot` modify labels: rollup
OK, thank you! |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 19, 2024
Rollup of 7 pull requests Successful merges: - rust-lang#127679 (Stabilize `raw_ref_op` (RFC 2582)) - rust-lang#128084 (Suggest adding Result return type for associated method in E0277.) - rust-lang#128628 (When deduplicating unreachable blocks, erase the source information.) - rust-lang#128902 (doc: std::env::var: Returns None for names with '=' or NUL byte) - rust-lang#129048 (Update `crosstool-ng` for loongarch64) - rust-lang#129116 (Include a copy of `compiler-rt` source in the `download-ci-llvm` tarball) - rust-lang#129208 (Fix order of normalization and recursion in const folding.) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 19, 2024
Rollup merge of rust-lang#128084 - surechen:fix_125997_v1, r=cjgillot Suggest adding Result return type for associated method in E0277. Recommit rust-lang#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 rust-lang#125997 r? `@cjgillot`
surechen
added a commit
to surechen/rust
that referenced
this pull request
Aug 22, 2024
… by rust-lang#126187 According to: rust-lang#128084 (comment) https://github.com/rust-lang/rust/pull/126187/files#r1634897691 I try to add a span field to `Block` which doesn't include brace '{' and '}', because I need to add a suggestion at the end of function's body, and this can help me find the right place. But this will make `Block` larger. I don't want to break the original span field in `Block`, I'm worried that it will cause a lot of code failures and I think it may be more intuitive for span to include braces.
surechen
added a commit
to surechen/rust
that referenced
this pull request
Aug 22, 2024
… by rust-lang#126187 According to: rust-lang#128084 (comment) https://github.com/rust-lang/rust/pull/126187/files#r1634897691 I try to add a span field to `Block` which doesn't include brace '{' and '}', because I need to add a suggestion at the end of function's body, and this can help me find the right place. But this will make `Block` larger. I don't want to break the original span field in `Block`, I'm worried that it will cause a lot of code failures and I think it may be more intuitive for span to include braces.
surechen
added a commit
to surechen/rust
that referenced
this pull request
Aug 23, 2024
… by rust-lang#126187 According to: rust-lang#128084 (comment) https://github.com/rust-lang/rust/pull/126187/files#r1634897691 I try to add a span field to `Block` which doesn't include brace '{' and '}', because I need to add a suggestion at the end of function's body, and this can help me find the right place. But this will make `Block` larger. I don't want to break the original span field in `Block`, I'm worried that it will cause a lot of code failures and I think it may be more intuitive for span to include braces.
surechen
added a commit
to surechen/rust
that referenced
this pull request
Aug 23, 2024
surechen
added a commit
to surechen/rust
that referenced
this pull request
Aug 25, 2024
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 25, 2024
Fixing span manipulation and indentation of the suggestion introduced by rust-lang#126187 According to comments: rust-lang#128084 (comment) https://github.com/rust-lang/rust/pull/126187/files#r1634897691
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 25, 2024
Fixing span manipulation and indentation of the suggestion introduced by rust-lang#126187 According to comments: rust-lang#128084 (comment) https://github.com/rust-lang/rust/pull/126187/files#r1634897691
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 26, 2024
Rollup merge of rust-lang#129405 - surechen:fix_span_x, r=cjgillot Fixing span manipulation and indentation of the suggestion introduced by rust-lang#126187 According to comments: rust-lang#128084 (comment) https://github.com/rust-lang/rust/pull/126187/files#r1634897691
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recommit #126515 because I messed up during rebase,
Suggest adding Result return type for associated method in E0277.
For following:
Suggest:
For #125997
r? @cjgillot