From 626c37ef8dbf198c329ce568418e777d12bab77a Mon Sep 17 00:00:00 2001 From: YoungHa Kim Date: Wed, 22 Nov 2023 00:11:59 +0900 Subject: [PATCH] =?UTF-8?q?#[feature(type=5Falias=5Fimpl=5Ftrait)]=20?= =?UTF-8?q?=EC=9D=B4=EA=B1=B0=20=EC=95=88=20=EC=93=B0=EB=A9=B4=20=EB=82=98?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=EC=97=90=EB=9F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust1_74/b01_opaque_types01/README.md | 38 +++++++++++++++++++++++++ rust1_74/b01_opaque_types01/src/main.rs | 2 ++ 2 files changed, 40 insertions(+) diff --git a/rust1_74/b01_opaque_types01/README.md b/rust1_74/b01_opaque_types01/README.md index 4c26443..37e7b3b 100644 --- a/rust1_74/b01_opaque_types01/README.md +++ b/rust1_74/b01_opaque_types01/README.md @@ -2,6 +2,44 @@ https://github.com/rust-lang/rust/issues/63063 +``` +$ cargo r + Compiling b01_opaque_types01 v0.1.0 (/Users/globalyoung/Documents/test/test/rust/rust_release/rust1_74/b01_opaque_types01) +warning: type alias `Foo` is never used + --> src/main.rs:4:6 + | +4 | type Foo = impl MyTrait; + | ^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: fields `a`, `b`, and `c` are never read + --> src/main.rs:7:5 + | +6 | struct MyStruct { + | -------- fields in this struct +7 | a: A, + | ^ +8 | b: B, + | ^ +9 | c: C, + | ^ + +warning: function `foo` is never used + --> src/main.rs:13:4 + | +13 | fn foo(t: T) -> Foo { + | ^^^ + +warning: `b01_opaque_types01` (bin "b01_opaque_types01") generated 3 warnings + Finished dev [unoptimized + debuginfo] target(s) in 0.19s + Running `target/debug/b01_opaque_types01` +Hello, world! +``` + + +- ```#![feature(type_alias_impl_trait)]``` 이거 안 쓰면 나오는 에러 + ``` `impl Trait` in type aliases is unstable --> src/main.rs:2:15 diff --git a/rust1_74/b01_opaque_types01/src/main.rs b/rust1_74/b01_opaque_types01/src/main.rs index 950d768..054a2cd 100644 --- a/rust1_74/b01_opaque_types01/src/main.rs +++ b/rust1_74/b01_opaque_types01/src/main.rs @@ -1,4 +1,6 @@ +#![feature(type_alias_impl_trait)] trait MyTrait {} + type Foo = impl MyTrait; struct MyStruct {