diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-19 16:06:43 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-20 21:10:38 +0000 |
| commit | 60956837cfbf22bd8edd80f57a856e141f7deb8c (patch) | |
| tree | 4cc50671566d7fb411d8e933348d6785d6bc55cc /compiler/rustc_error_codes/src | |
| parent | 96027d945b9d8cae622a2fa4e70d8040be2964f3 (diff) | |
| download | rust-60956837cfbf22bd8edd80f57a856e141f7deb8c.tar.gz rust-60956837cfbf22bd8edd80f57a856e141f7deb8c.zip | |
s/Generator/Coroutine/
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0626.md | 10 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0790.md | 16 |
2 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0626.md b/compiler/rustc_error_codes/src/error_codes/E0626.md index cc6e03d1ca7..e64dec79972 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0626.md +++ b/compiler/rustc_error_codes/src/error_codes/E0626.md @@ -5,7 +5,7 @@ Erroneous code example: ```compile_fail,E0626 # #![feature(generators, generator_trait, pin)] -# use std::ops::Generator; +# use std::ops::Coroutine; # use std::pin::Pin; let mut b = || { let a = &String::new(); // <-- This borrow... @@ -24,7 +24,7 @@ the integer by value: ``` # #![feature(generators, generator_trait, pin)] -# use std::ops::Generator; +# use std::ops::Coroutine; # use std::pin::Pin; let mut b = || { let a = 3; @@ -42,7 +42,7 @@ This error also frequently arises with iteration: ```compile_fail,E0626 # #![feature(generators, generator_trait, pin)] -# use std::ops::Generator; +# use std::ops::Coroutine; # use std::pin::Pin; let mut b = || { let v = vec![1,2,3]; @@ -58,7 +58,7 @@ Such cases can sometimes be resolved by iterating "by value" (or using ``` # #![feature(generators, generator_trait, pin)] -# use std::ops::Generator; +# use std::ops::Coroutine; # use std::pin::Pin; let mut b = || { let v = vec![1,2,3]; @@ -73,7 +73,7 @@ If taking ownership is not an option, using indices can work too: ``` # #![feature(generators, generator_trait, pin)] -# use std::ops::Generator; +# use std::ops::Coroutine; # use std::pin::Pin; let mut b = || { let v = vec![1,2,3]; diff --git a/compiler/rustc_error_codes/src/error_codes/E0790.md b/compiler/rustc_error_codes/src/error_codes/E0790.md index 2aee9dfbdbd..b52543c48d8 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0790.md +++ b/compiler/rustc_error_codes/src/error_codes/E0790.md @@ -4,24 +4,24 @@ method. Erroneous code example: ```compile_fail,E0790 -trait Generator { +trait Coroutine { fn create() -> u32; } struct Impl; -impl Generator for Impl { +impl Coroutine for Impl { fn create() -> u32 { 1 } } struct AnotherImpl; -impl Generator for AnotherImpl { +impl Coroutine for AnotherImpl { fn create() -> u32 { 2 } } -let cont: u32 = Generator::create(); -// error, impossible to choose one of Generator trait implementation +let cont: u32 = Coroutine::create(); +// error, impossible to choose one of Coroutine trait implementation // Should it be Impl or AnotherImpl, maybe something else? ``` @@ -30,18 +30,18 @@ information to the compiler. In this case, the solution is to use a concrete type: ``` -trait Generator { +trait Coroutine { fn create() -> u32; } struct AnotherImpl; -impl Generator for AnotherImpl { +impl Coroutine for AnotherImpl { fn create() -> u32 { 2 } } let gen1 = AnotherImpl::create(); // if there are multiple methods with same name (different traits) -let gen2 = <AnotherImpl as Generator>::create(); +let gen2 = <AnotherImpl as Coroutine>::create(); ``` |
