-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix diagnostics for coroutines with () as input. #130820
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@bors r+ rollup |
…mpiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130820 (Fix diagnostics for coroutines with () as input.) - rust-lang#130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation) - rust-lang#130845 (Utf8Chunks: add link to Utf8Chunk) - rust-lang#130860 (Fix directives for lint-non-snake-case-crate) - rust-lang#130861 (Use `mem::offset_of!` for `sockaddr_un.sun_path`) - rust-lang#130865 (Use `&raw` in the standard library) - rust-lang#130868 (Update FIXME comment in s390x_unknown_linux_*.rs) r? `@ghost` `@rustbot` modify labels: rollup
…mpiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#130820 (Fix diagnostics for coroutines with () as input.) - rust-lang#130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation) - rust-lang#130845 (Utf8Chunks: add link to Utf8Chunk) - rust-lang#130860 (Fix directives for lint-non-snake-case-crate) - rust-lang#130868 (Update FIXME comment in s390x_unknown_linux_*.rs) r? `@ghost` `@rustbot` modify labels: rollup
…mpiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#129687 (Implement RFC3137 trim-paths sysroot changes - take 2) - rust-lang#130820 (Fix diagnostics for coroutines with () as input.) - rust-lang#130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation) - rust-lang#130845 (Utf8Chunks: add link to Utf8Chunk) - rust-lang#130868 (Update FIXME comment in s390x_unknown_linux_*.rs) - rust-lang#130873 (rustc_target: Add powerpc64 atomic-related features) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#129687 (Implement RFC3137 trim-paths sysroot changes - take 2) - rust-lang#130820 (Fix diagnostics for coroutines with () as input.) - rust-lang#130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation) - rust-lang#130845 (Utf8Chunks: add link to Utf8Chunk) - rust-lang#130868 (Update FIXME comment in s390x_unknown_linux_*.rs) - rust-lang#130873 (rustc_target: Add powerpc64 atomic-related features) r? `@ghost` `@rustbot` modify labels: rollup
…mpiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#129687 (Implement RFC3137 trim-paths sysroot changes - take 2) - rust-lang#130517 (Add the library workspace to the suggested rust-analyzer config) - rust-lang#130820 (Fix diagnostics for coroutines with () as input.) - rust-lang#130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation) - rust-lang#130845 (Utf8Chunks: add link to Utf8Chunk) - rust-lang#130850 (Pass Module Analysis Manager to Standard Instrumentations) - rust-lang#130868 (Update FIXME comment in s390x_unknown_linux_*.rs) - rust-lang#130873 (rustc_target: Add powerpc64 atomic-related features) - rust-lang#130879 (Pass correct HirId to late_bound_vars in diagnostic code) - rust-lang#130880 (add missing FIXME(const-hack)) r? `@ghost` `@rustbot` modify labels: rollup
…mpiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
…mpiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
…llaumeGomez Rollup of 11 pull requests Successful merges: - rust-lang#130279 (Document subtleties of `ManuallyDrop`) - rust-lang#130517 (Add the library workspace to the suggested rust-analyzer config) - rust-lang#130820 (Fix diagnostics for coroutines with () as input.) - rust-lang#130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation) - rust-lang#130845 (Utf8Chunks: add link to Utf8Chunk) - rust-lang#130850 (Pass Module Analysis Manager to Standard Instrumentations) - rust-lang#130861 (Use `mem::offset_of!` for `sockaddr_un.sun_path`) - rust-lang#130862 (rustdoc: do not animate :target when user prefers reduced motion) - rust-lang#130868 (Update FIXME comment in s390x_unknown_linux_*.rs) - rust-lang#130879 (Pass correct HirId to late_bound_vars in diagnostic code) - rust-lang#130880 (add missing FIXME(const-hack)) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130820 - 91khr:fix-coroutine-unit-arg, r=compiler-errors Fix diagnostics for coroutines with () as input. This may be a more real-life example to trigger the diagnostic: ```rust #![features(try_blocks, coroutine_trait, coroutines)] use std::ops::Coroutine; struct Request; struct Response; fn get_args() -> Result<String, String> { todo!() } fn build_request(_arg: String) -> Request { todo!() } fn work() -> impl Coroutine<Option<Response>, Yield = Request> { #[coroutine] |_| { let r: Result<(), String> = try { let req = get_args()?; yield build_request(req) }; if let Err(msg) = r { eprintln!("Error: {msg}"); } } } ```
This may be a more real-life example to trigger the diagnostic: