Skip to content
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

impl trait in bindings (feature: impl-trait-existential-types) #53542

Merged
merged 5 commits into from
Sep 25, 2018

Conversation

alexreg
Copy link
Contributor

@alexreg alexreg commented Aug 20, 2018

This PR enables impl Trait syntax (opaque types) to be used in bindings, e.g.

  • let foo: impl Clone = 1;
  • static foo: impl Clone = 2;
  • const foo: impl Clone = 3;

This is part of RFC 2071 (tracking issue), but exists behind the separate feature gate impl_trait_in_bindings.

CC @cramertj @oli-obk @eddyb @Centril @varkor

@alexreg alexreg changed the title [WIP] impl trait in bindings [WIP] impl trait in bindings (feature: impl-trait-existential-types) Aug 20, 2018
@alexreg
Copy link
Contributor Author

alexreg commented Aug 20, 2018

Seems to be blocked on #53469 at the moment.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:45:39] ......i.............................................................................................
[00:45:42] ............ii.iii..................................................................................
[00:45:45] ....................................................................................................
[00:45:47] ....................................................................................................
[00:45:49] ......................................................................................F.............
[00:45:54] ....................................................................................................
[00:45:57] i...................................................................i...............................
[00:45:57] i...................................................................i...............................
[00:46:00] .......................................................F............................................
[00:46:06] ............................................i.......................................................
[00:46:08] ....................................................................................................
[00:46:12] ....................................................................................................
[00:46:15] ....................................................................................................
[00:46:15] ....................................................................................................
[00:46:18] ....................................................................................................
[00:46:21] ....................................................................................................
[00:46:24] .......F............................................................................................
[00:46:31] ....................................................................................................
[00:46:33] .....................................i..............................................................
[00:46:37] .......................................................................................i.i..ii......
[00:46:37] .......................................................................................i.i..ii......
[00:46:40] ....................................F...............................................................
[00:46:46] ....................................................................................................
[00:46:49] ....................................................................................................
[00:46:52] ....................................................................................................
[00:46:55] ....................................................................................................
[00:46:55] ....................................................................................................
[00:46:58] ..............i.....................................................................................
[00:47:01] ....................................................................................................
[00:47:04] ....................................................................................................
[00:47:08] ...............................................i................................................FF..
[00:47:12] ....................................................................................................
[00:47:14] ....................................................................................................
[00:47:17] .................F........................................................................i.........
[00:47:18] failures:
[00:47:18] 
[00:47:18] ---- [ui] ui/existential_types/no_inferrable_concrete_type.rs stdout ----
[00:47:18] diff of stderr:
[00:47:18] diff of stderr:
[00:47:18] 
[00:47:18] - error[E0391]: cycle detected when normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: Foo }`
[00:47:18] + error[E0283]: type annotations required: cannot resolve `_: std::marker::Copy`
[00:47:18] 2   --> $DIR/no_inferrable_concrete_type.rs:16:1
[00:47:18] 3    |
[00:47:18] 4 LL | existential type Foo: Copy; //~ cycle detected
[00:47:18] 5    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:47:18] 6    |
[00:47:18] 6    |
[00:47:18] -    = note: ...which again requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: Foo }`, completing the cycle
[00:47:18] +    = note: the return type of a function must have a statically known size
[00:47:18] - error: aborting due to previous error
[00:47:18] + error: defining existential type use differs from previous
[00:47:18] +   --> $DIR/no_inferrable_concrete_type.rs:21:1
[00:47:18] +    |
[00:47:18] +    |
[00:47:18] + LL | / fn main() {
[00:47:18] + LL | |     let _: Foo = std::mem::transmute(0u8);
[00:47:18] + LL | | }
[00:47:18] +    |
[00:47:18] + note: previous use here
[00:47:18] +   --> $DIR/no_inferrable_concrete_type.rs:19:1
[00:47:18] +    |
[00:47:18] +    |
[00:47:18] + LL | fn bar(x: Foo) -> Foo { x }
[00:47:18] 10 
[00:47:18] - For more information about this error, try `rustc --explain E0391`.
[00:47:18] + error: aborting due to 2 previous errors
[00:47:18] + 
[00:47:18] + 
[00:47:18] + For more information about this error, try `rustc --explain E0283`.
[00:47:18] 12 
[00:47:18] 
[00:47:18] 
[00:47:18] The actual stderr differed from the expected stderr.
[00:47:18] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/existential_types/no_inferrable_concrete_type/no_inferrable_concrete_type.stderr
[00:47:18] To update references, rerun the tests and pass the `--bless` flag
[00:47:18] To only update this specific test, also pass `--test-args existential_types/no_inferrable_concrete_type.rs`
[00:47:18] error: 1 errors occurred comparing output.
[00:47:18] status: exit code: 1
[00:47:18] status: exit code: 1
[00:47:18] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/existential_types/no_inferrable_concrete_type/a" "-Crpath" "-O" "-Z9,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"fn bar(x: Foo) -> Foo { x }","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error: defining existential type use differs from previous\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:21:1\n   |\nLL | / fn main() {\nLL | |     let _: Foo = std::mem::transmute(0u8);\nLL | | }\n   | |_^\n   |\nnote: previous use here\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:19:1\n   |\nLL | fn bar(x: Foo) -> Foo { x }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:47:18] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:47:18] {"message":"For more information about this error, try `rustc --explain E0283`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0283`.\n"}
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] thread '[ui] ui/existential_types/no_inferrable_concrete_type.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:47:18] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:47:18] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:47:18] 
[00:47:18] ---- [ui] ui/impl-trait/where-allowed.rs stdout ----
[00:47:18] diff of stderr:
[00:47:18] 
[00:47:18] 16    |                                                 |       nested `impl Trait` here
[00:47:18] 17    |                                                 outer `impl Trait`
[00:47:18] 18 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 20   --> $DIR/where-allowed.rs:28:40
[00:47:18] 21    |
[00:47:18] 22 LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
[00:47:18] 23    |                                        ^^^^^^^^^^
[00:47:18] 24 
[00:47:18] 24 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 26   --> $DIR/where-allowed.rs:32:42
[00:47:18] 27    |
[00:47:18] 28 LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
[00:47:18] 29    |                                          ^^^^^^^^^^
[00:47:18] 30 
[00:47:18] 30 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 32   --> $DIR/where-allowed.rs:36:38
[00:47:18] 33    |
[00:47:18] 34 LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
[00:47:18] 35    |                                      ^^^^^^^^^^
[00:47:18] 36 
[00:47:18] 36 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowturn() -> &'static dyn Fn(impl Debug) { panic!() }
[00:47:18] 59    |                                                       ^^^^^^^^^^
[00:47:18] 60 
[00:47:18] 60 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 62   --> $DIR/where-allowed.rs:56:57
[00:47:18] 63    |
[00:47:18] 64 LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
[00:47:18] 65    |                                                         ^^^^^^^^^^
[00:47:18] 66 
[00:47:18] 66 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 68   --> $DIR/where-allowed.rs:60:51
[00:47:18] 69    |
[00:47:18] 70 LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
[00:47:18] 71    |                                                   ^^^^^^^^^^
[00:47:18] 72 
[00:47:18] 72 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 74   --> $DIR/where-allowed.rs:65:53
[00:47:18] 75    |
[00:47:18] 76 LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
[00:47:18] 77    |                                                     ^^^^^[00:47:18] 119    |                           ^^^^^^^^^^
[00:47:18] 120 
[00:47:18] 120 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 122   --> $DIR/where-allowed.rs:108:25
[00:47:18] 123    |
[00:47:18] 124 LL |     InBraceVariant { x: impl Debug },
[00:47:18] 125    |                         ^^^^^^^^^^
[00:47:18] 126 
[00:47:18] 126 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 128   --> $DIR/where-allowed.rs:110:20
[00:47:18] 129    |
[00:47:18] 130 LL |     InTupleVariant(impl Debug),
[00:47:18] 131    |                    ^^^^^^^^^^
[00:47:18] 132 
[00:47:18] 132 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 134   --> $DIR/where-allowed.rs:121:23
[00:47:18] 135    |
[00:47:18] 136 LL |     fn in_return() -> impl Debug;
[00:47:18] 137    |                       ^^^^^^^^^^
[00:47:18] 138 
[00:47:18] 138 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 140   --> $DIR/where-allowed.rs:132:1impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 164   --> $DIR/where-allowed.rs:167:23
[00:47:18] 165    |
[00:47:18] 166 LL | type InTypeAlias<R> = impl Debug;
[00:47:18] 167    |                       ^^^^^^^^^^
[00:47:18] 168 
[00:47:18] 168 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 170   --> $DIR/where-allowed.rs:170:39
[00:47:18] 171    |
[00:47:18] 172 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
[00:47:18] 173    |                                       ^^^^^^^^^^
[00:47:18] 174 
[00:47:18] 174 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 176   --> $DIR/where-allowed.rs:174:16
[00:47:18] 177    |
[00:47:18] 178 LL | impl PartialEq<impl Debug> for () {
[00:47:18] 179    |                ^^^^^^^^^^
[00:47:18] 180 
[00:47:18] 180 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 182   --> $DIR/where-allowed.rs:179:24
[00:47:18] 183    |
[00:47:18] 184 LL | impl PartialEq<()> for impl Debug {
[00:47:18] 185    |                        ^^^^^^^^^^
[00:47:18] 186 
[00:47:18] 186 
[00:47:18] - erroit` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 236   --> $DIR/where-allowed.rs:232:46
[00:47:18] 237    |
[00:47:18] 238 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
[00:47:18] 239    |                                              ^^^^^^^^^
[00:47:18] 240 
[00:47:18] - error: aborting due to 39 previous errors
[00:47:18] + error: aborting due to 38 previous errors
[00:47:18] + error: aborting due to 38 previous errors
[00:47:18] 242 
[00:47:18] 243 Some errors occurred: E0562, E0666.
[00:47:18] 244 For more information about an error, try `rustc --explain E0562`.
[00:47:18] 
[00:47:18] 
[00:47:18] The actual stderr differed from the expected stderr.
[00:47:18] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/where-allowed/where-allowed.stderr
[00:47:18] To update references, rerun the tests and pass the `--bless` flag
[00:47:18] To only update this specific test, also pass `--test-args impl-trait/where-allowed.rs`
[00:47:18] error: 1 errors occurred comparing output.
[00:47:18] status: exit code: 1
[00:47:18] status: exit code: 1
[00:47:18] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/where-allowed.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/where-allowed/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/where-allowed/auxiliary" "-A" "unused"
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] ------------------------------------------
[00:47:18] stderr:
[00:47:18] stderr:
[00:47:18] ------------------------------------------
[00:47:18] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2268,"byte_end":2287,"line_start":60,"line_end":60,"column_start":43,"column_end":62,"is_primary":false,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":43,"highlight_end":62}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2276,"byte_end":2286,"line_start":60,"line_end":60,"column_start":51,"column_end":61,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":51,"highlight_end":61}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:60:51\n   |\nLL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }\n   |                                           --------^^^^^^^^^^-\n   |                                                            outer `impl Trait`\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":869,"byte_end":879,"line_start":28,"line_end":28,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:28:40\n   |\nLL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }\n   |                                        ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1040,"byte_end":1050,"line_start":32,"line_end":32,"column_start":42,"column_end":52,"is_primary":true,"text":[{"text":"fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }","highlight_start":42,"highlight_end":52}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:32:42\n   |\nLL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }\n   |                                          ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1206,"byte_end":1216,"line_start":36,"line_end":36,"column_start":38,"column_end":48,"is_primary":true,"text":[{"text":"fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }","highlight_start":38,"highlight_end":48}],"label":null,"suggested_replace-> fn() -> impl Debug { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:40:40\n   |\nLL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }\n   |                                        ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1550,"byte_end":1560,"line_start":44   }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1913,"byte_end":1923,"line_start":52,"line_end":52,"column_start":55,"column_end":65,"is_primary":true,"text":[{"text":"fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }","highlight_start":55,"highlight_end":65}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:52:55\n   |\nLL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }\n   |                                                       ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\nr i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2276,"byte_end":2286,"line_start":60,"line_end":60,"column_start":51,"column_end":61,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":51,"highlight_end":61}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:60:51\n   |\nLL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }\n   |                                                   ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: iinherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2924,"byte_end":2934,"line_start":74,"line_end":74,"column_start":59,"column_end":69,"is_primary":true,"text":[{"text":"fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }","highlight_start":59,"highlight_end":69}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:74:59\n   |\nLL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }\n   |                                                           ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":3089,"byte_end":3099,"line_start":78,"line_end":78,"column_start":38,"column_end":48,"is_primary":true,"text":[{"text":"fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }","highlight_start":38,"highlight_end":48}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return typn":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:82:40\n   |\nLL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }\n   |                                        ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":3668,"byte_end":3678,"line_start":95,"line_end":95,"column_start":32,"column_end":42,"is_primary":true,"text":[{"text":"struct InBraceStructField { x: impl Debug }","highlight_start":32,"hiuct InAdtInBraceStructField { x: Vec<impl Debug> }","highlight_start":41,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:99:41\n   |\nLL | struct InAdtInBraceStructField { x: Vec<impl Debug> }\n   |                                         ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":3969,"byte_end":3979,"line_start":103,"line_end":103,"column_start":27,"column_end":37,"is_primary":true,"text":[{"text":"struct InTupleStructField(impl Debug);","highlight_start":27,"highlight_end":37}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:103:27\n   |\nLL | struct InTupleStructField(impl Debug);\n   |                           ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4124,"byte_end":4134,"line_start":108,"line_end":108,"column_start":25,"column_end":35,"is_primary":true,"text":[{"text":"    InBraceVariant { x: impl Debug },","highlight_start":25,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:108:25\n   |\nLL |     InBraceVariant { x: impl Debug },\n   |                         ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"d\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4502,"byte_end":4512,"line_start":121,"line_end":121,"column_start":23,"column_end":33,"is_primary":true,"text":[{"text":"    fn in_return() -> impl Debug;","highlight_start":23,"highlight_end":33}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:121:23\n   |\nLL |     fn in_return() -> impl Debug;\n   |                       ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4814,"byte_end":4824,"line_start":132,"line_end":132,"column_start":16,"column_end":26,"is_primary":true,"text":[{"text":"    type Out = impl Debug;","highlight_start":16,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:132:16\n   |\nLL |     type Out = impl Debug;\n   |                ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rus  }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5349,"byte_end":5359,"line_start":151,"line_end":151,"column_start":33,"column_end":43,"is_primary":true,"text":[{"text":"    fn in_foreign_parameters(_: impl Debug);","highlight_start":33,"highlight_end":43}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:151:33\n   |\nLL |     fn in_foreign_parameters(_: impl Debug);\n   |                                 ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\ a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5898,"byte_end":5908,"line_start":170,"line_end":170,"column_start":39,"column_end":49,"is_primary":true,"text":[{"text":"type InReturnInTypeAlias<R> = fn() -> impl Debug;","highlight_start":39,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:170:39\n   |\nLL | type InReturnInTypeAlias<R> = fn() -> impl Debug;\n   |                                       ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6215,"byte_end":6225,"line_start":179,"line_end":179,"column_start":24,"column_end":34,"is_primary":true,"text":[{"text":"impl PartialEq<()> for impl Debug {","highlight_start":24,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:179:24\n   |\nLL | impl PartialEq<()> for impl Debug {\n   |                        ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //     on and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6737,"byte_end":6747,"line_start":196,"line_end":196,"column_start":11,"column_end":21,"is_primary":true,"text":[{"text":"    where impl Debug: Debug","highlight_start":11,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:196:11\n   |\nLL |     where impl Debug: Debug\n   |           ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6925,"byte_end":6935,"line_start":203,"line_end":203,"column_start":15,"column_end":25,"is_primary":true,"text":[{"text":"    where Vec<impl Debug>: Debug","highlight_start":15,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:203:15\n   |\nLL |     where Vec<impl Debug>: Debug\n   |               ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // errl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":7300,"byte_end":7310,"line_start":217,"line_end":217,"column_start":17,"column_end":27,"is_primary":true,"text":[{"text":"    where T: Fn(impl Debug)","highlight_start":17,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:217:17\n   |\nLL |     where T: Fn(impl Debug)\n   |                 ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":7481,"byte_end":7491,"line_start":224,"line_end":224,"column_start":22,"column_end":32,"is_primary":true,"text":[{"text":"    where T: Fn() -> impl Debug","highlight_start":22,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:224:22\n   |\nLL |     where T: Fn() -> impl Debug\n   |                      ^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```cccurred: E0562, E0666.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0562, E0666.\n"}
[00:47:18] {"message":"For more information about an error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0562`.\n"}
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] thread '[ui] ui/impl-trait/where-allowed.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:47:18] 
[00:47:18] 
[00:47:18] ---- [ui] ui/issues/issue-47715.rs stdout ----
[00:47:18] diff of stderr:
[00:47:18] 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 3    |
[00:47:18] 3    |
[00:47:18] 4 LL | struct Container<T: Iterable<Item = impl Foo>> {
[00:47:18] 5    |                                     ^^^^^^^^
[00:47:18] 6 
[00:47:18] 6 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:18] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:18] 9    |
[00:47:18] 9    |
[00:47:18] 10 LL | enum Enum<T: Iterable<Item = impl Foo>> {
[00:47:18] 11    |                              ^^^^^^^^
[00:47:18] 12 
[00:47:18] 12 
[00:47:18] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/issues/issue-47715.rs:19:37\n   |\nLL | struct Container<T: Iterable<Item = impl Foo>> {\n   |                                     ^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-47715.rs","byte_start":667,"byte_end":675,"line_start":24,"line_end":24,"column_start":30,"column_end":38,"is_primary":true,"text":[{"text":"enum Enum<T: Iterable<Item = impl Foo>> {","highlight_start":30,"highlem = impl Foo> + Copy> {","highlight_start":32,"highlight_end":40}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/issues/issue-47715.rs:29:32\n   |\nLL | union Union<T: Iterable<Item = impl Foo> + Copy> {\n   |                                ^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-47715.rs","byte_start":866,"byte_end":874,"line_start":34,"line_end":34,"column_start":30,"column_end":-------------------------------------
[00:47:18] ------------------------------------------
[00:47:18] stderr:
[00:47:18] ------------------------------------------
[00:47:18] ------------------------------------------
[00:47:18] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":585,"byte_end":606,"line_start":14,"line_end":14,"column_start":46,"column_end":67,"is_primary":false,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":46,"highlight_end":67}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":595,"byte_end":605,"line_start":14,"line_end":14,"column_start":56,"column_end":66,"is_primary":true,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":56,"highlight_end":66}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:14:56\n   |\nLL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }\n   |                                              ----------^^^^^^^^^^-\n   |                                              |         |\n   |                                              |         nested `impl Trait` here\n   |                                              outer `impl Trait`\n\n"}
[00:47:18] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":691,"byte_end":712,"line_start":17,"line_end":17,"column_start":32,"column_end":53,"is_primary":false,"text":[{"text":"fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}","highlight_start":32,"highlight_end":53}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":701,"byte_end":711,"line_start":17,"line_end":17,"column_start":42,"column_end":52,"is_primary":true,"text":[{"text":"fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}","highlight_start":42,"highlight_end":52}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:17:42\n   |\nLL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}\n   |                                ----------^^^^^^^^^^-\n   |                                |         |\n   |                                |         nested `impl Trait` here\n   |                                outer `impl Trait`\n\n"}
[00:47:18] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":821,"byte_end":842,"line_start":21,"line_end":21,"column_start":27,"column_end}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":691,"byte_end":712,"line_start":17,"line_end":17,"column_start":32,"column_end":53,"is_primary":true,"text":[{"text":"fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}","highlight_start":32,"highlight_end":53}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/nested_impl_trait.rs:17:32\n   |\nLL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}\n   |                                ^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:47:18] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":1176,"byte_end":1190,"line_start":34,"line_end":34,"column_start":42,"column_end":56,"is_primary":true,"text":[{"text":"fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {","highlight_start":42,"highlight_end":56}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/nested_impl_trait.rs:34:42\n   |\nLL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {\n   |                                          ^^^^^^^^^^^^^^\n\n"}
[00:47:18] {"message":"aborting due to 6 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 6 previous errors\n\n"}
[00:47:18] {"message":"Some errors occurred: E0562, E0666.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0562, E0666.\n"}
[00:47:18] {"message":"For more information about an error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0562`.\n"}
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] thread '[ui] ui/nested_impl_trait.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:47:18] 
[00:47:18] 
[00:47:18] ---- [ui] ui/traits/trait-item-privacy.rs stdout ----
[00:47:18] diff of stderr:
[00:47:18] 
[00:47:18] 170 LL |         A = u8, //~ ERROR associated type `A` is private
[00:47:18] 172 
[00:47:18] - error: aborting due to 17 previous errors
[00:47:18] - error: aborting due to 17 previous errors
[00:47:18] + error[E0277]: the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time
[00:47:18] +   --> $DIR/trait-item-privacy.rs:136:12
[00:47:18] +    |
[00:47:18] + LL |       let _: assoc_ty::B<
[00:47:18] +    |  ____________^
[00:47:18] + LL | |         B = u8, // OK
[00:47:18] + LL | |     >;
[00:47:18] +    | |_____^ doesn't have a size known at compile-time
[00:47:18] +    |
[00:47:18] +    = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`
[00:47:18] +    = note: the return type of a function must have a statically known size
[00:47:18] + 
[00:47:18] + 
[00:47:18] + error[E0277]: the size for values of type `dyn assoc_ty::C<C=u8, B=u8, A=u8>` cannot be known at compilation time
[00:47:18] +   --> $DIR/trait-item-privacy.rs:139:12
[00:47:18] +    |
[00:47:18] + LL |       let _: C<
[00:47:18] +    |  ____________^
[00:47:18] + LL | |         A = u8, //~ ERROR associated type `A` is private
[00:47:18] + LL | |         B = u8, // OK
[00:47:18] + LL | |         C = u8, // OK
[00:47:18] + LL | |     >;
L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/auxiliary" "-A" "unused"
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] ------------------------------------------
[00:47:18] stderr:
[00:47:18] stderr:
[00:47:18] ------------------------------------------
[00:47:18] {"message":"no method named `a` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"method `a` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":1449,"byte_end":1450,"line_start":77,"line_end":77,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":"    S.a(); //~ ERROR no method named `a` found for type `S` in the current scope","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `a`, perhaps you need to implement it:\ncandidate #1: `method::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `a` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:77:7\n   |\nLL | struct S;\n   | --------- method `a` not found for this\n...\nLL |     S.a(); //~ ERROR no method named `a` found for type `S` in the current scope\n   |       ^\n   |\n   = help: items from traits can only be used if the trait is implemented and in scope\n   = note: the following trait defines an item `a`, perhaps you need to implement it:\n           candidate #1: `method::A`\n\n"}
[00:47:18] {"message":"no method named `b` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"method `b` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/t"explanation":"\nA private item was used outside of its scope.\n\nErroneous code example:\n\n```compile_fail,E0624\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // error: method `method` is private\n```\n\nTwo possibilities are available to solve this issue:\n\n1. Only use the item in the scope it has been defined:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n\n    pub fn call_method(foo: &Foo) { // We create a public function.\n        foo.method(); // Which calls the item.\n    }\n}\n\nlet foo = inner::Foo;\ninner::call_method(&foo); // And since the function is public, we can call the\n                          // method through it.\n```\n\n2. Make the item public:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        pub fn method(&self) {} // It's now public.\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // Ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":1736,"byte_end":1737,"line_start":82,"line_end":82,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":"    c.a(); //~ ERROR method `a` is private","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0624]: method `a` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:82:7\n   |\nLL |     c.a(); //~ ERROR method `a` is private\n   |       ^\n\n"}
[00:47:18] {"message":"no function or associated item named `an_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":506,"line_start":13,"line_end":13,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use method::B;\n\n","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no function or associated item named `b` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:90:5\n   |\nLL | struct S;\n   | --------- function or associated item `b` not found for this\n...\nLL |     S::b(&S);\n   |     ^^^^ function or associated item not found in `S`\n   |\n   = help: items from traits can only be used if the trait is in scope\nhelp: the following trait is implemented but not in scope, perhaps add a `use` for it:\n   |\nLL | use method::B;\n   |\n\n"}
[00:47:18] {"message":"method `a` is private","code":{"code":"E0624","explanation":"\nA private item was used outside of its scope.\n\nErroneous code example:\n\n```compile_fail,E0624\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // error: method `method` is private\n```\n\nTwo possibilities are uth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"associated item `A` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2522,"byte_end":2526,"line_start":107,"line_end":107,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope","highlight_start":5,"highlight_end":9}],"label":"associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `A`, perhaps you need to implement it:\ncandidate #1: `assoc_const::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no associated item named `A` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:107:5\n   |\nLL | struct S;\n   | --------- associated item `A` not found for this\n...\nLL |     S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope\n   |     ^^^^ associated item not found i   pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n\n    pub fn call_method(foo: &Foo) { // We create a public function.\n        foo.method(); // Which calls the item.\n    }\n}\n\nlet foo = inner::Foo;\ninner::call_method(&foo); // And since the function is public, we can call the\n                          // method through it.\n```\n\n2. Make the item public:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        pub fn method(&self) {} // It's now public.\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // Ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2802,"byte_end":2806,"line_start":111,"line_end":111,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::A; //~ ERROR associated constant `A` is private","highlight_start":5,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0624]: associated constant `A` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:111:5\n   |\nLL |     C::A; //~ ERROR associated constant `A` is private\n   |     ^^^^\n\n"}
[00:47:18] {"message":"the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n tem-privacy.rs:35:9\n   |\nLL |         const A: u8 = 0;\n   |         ^^^^^^^^^^^^^^^^\n\n"}
[00:47:18] {"message":"the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error heright_start":9,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:114:5\n   |\nLL |     C::B; // ERROR the trait `assoc_const::C` cannot be made into an object\n   |     ^^^^ the trait `assoc_const::B` is not implemented for `dyn assoc_const::C`\n   |\nnote: required by `assoc_const::B::B`\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:39:9\n   |\nLL |         const B: u8 = 0;\n   |         ^^^^^^^^^^^^^^^^\n\n"}
[00:47:18] {"message":"the trait `assoc_const::C` cannot be made into an object","code":{"code":"E0038","explanation":"\nTrait objects like `Box<Trait>` can only be constructed when certain\nrequirements are satisfied by the trait in question.\n\nTrait objects are a form of dynamic dispatch and use a dynamically sized type\nfor the inner type. So, for a given trait `Trait`, when `Trait` is treated as a\ntype, as in `Box<Trait>`, the inner type is 'unsized'. In such cases the boxed\npointer is a 'fat pointer' that contains an extra pointer to a table of methods\n(among other things) for dynamic dispatch. This design mandates some\nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the following:\n\n```\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nimpl Trait for String {\n    fn foo(&self) -> Self {\n        \"hi\".to_owned()\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) -> Self {\n        1\n    }\n}\n```\n\n(Note that `&self` and `&mut self` are okay, it's additional `Self` types which\ncause this problem.)\n\nIn such a case, the compiler cannot predict the return type of `foo()` in a\nsituation like the following:\n\n```compile_fail\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nfn call_foo(x: Box<Trait>) {\n    let y = x.foo(); // What type is y?\n    // ...\n}\n```\n\nIf only some methods aren't object-safe, you can add a `where Self: Sized` bound\non them to mark them as explicitly unavailable to trait objects. The\nfunctionality will still be available to all other implementers, including\n`Box<Trait>` which is itself sized (assuming you `impl Trait for Box<Trait>`).\n\n```\ntrait Trait {\n    fn foo(&self) -> Self where Self: Sized;\n    // more functions\n}\n```\n\nNow, `foo()` can no longer be called on a trait object, but you will now be\nallowed to make a trait object, and that will be able to call any object-safe\nmethods. With such a bound, one can still call `foo()` on types implementing\nthat trait that aren't behind trait objects.\n\n### Method has generic type parameters\n\nAs mentioned before, trait objects contain pointers to method tables. So, if we\nhave:\n\n```\ntrait Trait {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\re methods\n}\n```\n\nIf this is not an option, consider replacing the type parameter with another\ntrait object (e.g. if `T: OtherTrait`, use `on: Box<OtherTrait>`). If the number\nof types you intend to feed to this method is limited, consider manually listing\nout the methods of different types.\n\n### Method has no receiver\n\nMethods that do not take a `self` parameter can't be called since there won't be\na way to get a pointer to the method table for them.\n\n```\ntrait Foo {\n    fn foo() -> u8;\n}\n```\n\nThis could be called as `<Foo as Foo>::foo()`, which would not be able to pick\nan implementation.\n\nAdding a `Self: Sized` bound to these methods will generally make this compile.\n\n```\ntrait Foo {\n    fn foo() -> u8 where Self: Sized;\n}\n```\n\n### The trait cannot contain associated constants\n\nJust like static functions, associated constants aren't stored on the method\ntable. If the trait or any subtrait contain an associated constant, they cannot\nbe made into an object.\n\n```compile_fail,E0038\ntrait Foo {\n    const X: i32;\n}\n\nimpl Foo {}\n```\n\nA simple workaround is to use a helper method instead:\n\n```\ntrait Foo {\n    fn x(&self) -> i32;\n}\n```\n\n### The trait cannot use `Self` as a type parameter in the supertrait listing\n\nThis is similar to the second sub-error, but subtler. It happens in situations\nlike the following:\n\n```compile_fail\ntrait Super<A> {}\n\ntrait Trait: Super<Self> {\n}\n\nstruct Foo;\n\nimpl Super<Foo> for Foo{}\n\nimpl Trait for Foo {}\n```\n\nHere, the supertrait might have methods as follows:\n\n```\ntrait Super<A> {\n    fn get_a(&self) -> A; // note that this is object safe!\n}\n```\n\nIf the trait `Foo` was deriving from something like `Super<String>` or\n`Super<T>` (where `Foo` itself is `Foo<T>`), this is okay, because given a type\n`get_a()` will definitely return an object of that type.\n\nHowever, if it derives from `Super<Self>`, even though `Super` is object safe,\nthe method `get_a()` would return an object of unknown type when called on the\nfunction. `Self` type parameters let us make object safe traits no longer safe,\nso they are forbidden when specifying supertraits.\n\nThere's no easy fix for this, generally code will need to be refactored so that\nyou no longer need to derive from `Super<Self>`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2802,"byte_end":2806,"line_start":111,"line_end":111,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::A; //~ ERROR associated constant `A` is private","highlight_start":5,"highlight_end":9}],"label":"the trait `assoc_const::C` cannot be made into an object","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait cannot contain associated consts like `C`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the trait cannot contain associated consts like `B`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the trait cannot contain associated consts like `A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `assoc_const::C` cannot be made into an object\n  --> /checkout/srype","highlight_start":12,"highlight_end":16}],"label":"ambiguous associated type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<S as Trait>::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:127:12\n   |\nLL |     let _: S::A; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::A`\n\n"}
[00:47:18] {"message":"ambiguous associated type","code":{"code":"E0223","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0223\ntrait MyTrait {type X; }\n\nfn main() {\n    let foo: MyTrait::X;\n}\n```\n\nThe problem here is that we're attempting to take the type of X from MyTrait.\nUnfortunately, the type of X is not defined, because it's only made concrete in\nimplementations of the trait. A working version of this code might look like:\n\n```\ntrait MyTrait {type X; }\nstruct MyStruct;\n\nimpl MyTrait for MyStruct {\n    type X = u32;\n}\n\nfn main() {\n    let foo: <MyStruct as MyTrait>::X;\n}\n```\n\nThis syntax specifies that we want the X type from MyTrait, as made concrete in\nMyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct\nmight implement two different traits with identically-named associated types.\nThis syntax allows disambiguation between the two.\n"},"level":"error","spans":[{"file_name":"/checkoutraits/trait-item-privacy.rs:131:12\n   |\nLL |     let _: T::A; //~ ERROR associated type `A` is private\n   |            ^^^^\n\n"}
[00:47:18] {"message":"associated type `A` is private","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3933,"byte_end":3939,"line_start":140,"line_end":140,"column_start":9,"column_end":15,"is_primary":true,"text":[{"text":"        A = u8, //~ ERROR associated type `A` is private","highlight_start":9,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: associated type `A` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:140:9\n   |\nLL |         A = u8, //~ ERROR associated type `A` is private\n   |         ^^^^^^\n\n"}
[00:47:18] {"message":"the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Ext/ui/traits/trait-item-privacy.rs","byte_start":3869,"byte_end":3909,"line_start":136,"line_end":138,"column_start":12,"column_end":6,"is_primary":true,"text":[{"text":"    let _: assoc_ty::B<","highlight_start":12,"highlight_end":24},{"text":"        B = u8, // OK","highlight_start":1,"highlight_end":22},{"text":"    >;","highlight_start":1,"highlight_end":6}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:136:12\n   |\nLL |       let _: assoc_ty::B<\n   |  ____________^\nLL | |         B = u8, // OK\nLL | |     >;\n   | |_____^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type>`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `dyn assoc_ty::C<C=u8, B=u8, A=u8>` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:139:12\n   |\nLL |       let _: C<\n   |  ____________^\nLL | |         A = u8, //~ ERROR associated type `A` is private\nLL | |         B = u8, // OK\nLL | |         C = u8, // OK\nLL | |     >;\n   | |_____^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::C<C=u8, B=u8, A=u8>`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:18] {"message":"aborting due to 19 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 19 previous errors\n\n"}
[00:47:18] {"message":"Some errors occurred: E0038, E0223, E0277, E0599, E0624.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0038, E0223, E0277, E0599, E0624.\n"}
[00:47:18] {"message":"For more information about an e
[00:47:18] +   --> $DIR/trait-object-macro-matcher.rs:19:8
[00:47:18] +    |
[00:47:18] + LL |     m!('static + Send);
[00:47:18] +    |
[00:47:18] +    |
[00:47:18] +    = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Send + 'static)`
[00:47:18] +    = note: the return type of a function must have a statically known size
[00:47:18] + 
[00:47:18] + 
[00:47:18] 7 error[E0038]: the trait `std::marker::Copy` cannot be made into an object
[00:47:18] 9    |
[00:47:18] 
[00:47:18] 12    |
[00:47:18] 12    |
[00:47:18] 13    = note: the trait cannot require that `Self : Sized`
[00:47:18] - error: aborting due to 2 previous errors
[00:47:18] + error: aborting due to 4 previous errors
[00:47:18] 16 
[00:47:18] - Some errors occurred: E0038, E0224.
[00:47:18] - Some errors occurred: E0038, E0224.
[00:47:18] + Some errors occurred: E0038, E0224, E0277.
[00:47:18] 18 For more information about an error, try `rustc --explain E0038`.
[00:47:18] 19 
[00:47:18] 
[00:47:18] 
[00:47:18] The actual stderr differed from the expected stderr.
[00:47:18] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/trait-object-macro-matcher.stderr
[00:47:18] To update references, rerun the tests and pass the `--bless` flag
[00:47:18] To only update this specific test, also pass `--test-args traits/trait-object-macro-matche0:8\n   |\nLL |     m!('static +); //~ ERROR at least one non-builtin trait is required for an object type\n   |        ^^^^^^^^^\n\n"}
[00:47:18] {"message":"the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":581,"byte_end":602,"line_start":18,"line_end":18,"column_start":8,"column_end":29,"is_primary":true,"text":[{"text":"    m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object","highlight_start":8,"highlight_end":29}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:18:8\n   |\nLL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object\n   |        ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:18] {"message":"the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nf:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":682,"byte_end":696,"line_start":19,"line_end":19,"column_start":8,"column_end":22,"is_primary":true,"text":[{"text":"    m!('static + Send);","highlight_start":8,"highlight_end":22}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Send + 'static)`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:19:8\n   |\nLL |     m!('static + Send);\n   |        ^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Send + 'static)`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:18] {"message":"the trait `std::marker::Copy` cannot be made into an object","code":{"code":"E0038","explanation":"\nTrait objects like `Box<Trait>` can only be constructed when certain\nrequirements are satisfied by the trait in question.\n\nTrait objects are a form of dynamic dispatch and use a dynamically sized type\nfor the inner type. So, for a given trait `Trait`, when `Trait` is treated as a\ntype, as in `Box<Trait>`, the inner type is 'unsized'. In such cases the boxed\npointer is a 'fat pointer' that contains an extra pointer to a table of methods\n(among other things) for dynamic dispatch. This design mandates some\nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of types.\n\nFor example, with:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T);\n    // more methods\n}\n\nimpl Trait for String {\n    fn foo<T>(&self, on: T) {\n        // implemenger safe,\nso they are forbidden when specifying supertraits.\n\nThere's no easy fix for this, generally code will need to be refactored so that\nyou no longer need to derive from `Super<Self>`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":581,"byte_end":602,"line_start":18,"line_end":18,"column_start":8,"column_end":29,"is_primary":true,"text":[{"text":"    m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object","highlight_start":8,"highlight_end":29}],"label":"the trait `std::marker::Copy` cannot be made into an object","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait cannot require that `Self : Sized`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `std::marker::Copy` cannot be made into an object\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:18:8\n   |\nLL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object\n   |        ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object\n   |\n   = note: the trait cannot require that `Self : Sized`\n\n"}
[00:47:18] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:47:18] {"message":"Some errors occurred: E0038, E0224, E0277.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0038, E0224, E0277.\n"}
[00:47:18]emented for `Y`
[00:47:18] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:18] +    = help: consider adding a `where Y: std::marker::Sized` bound
[00:47:18] +    = note: the return type of a function must have a statically known size
[00:47:18] + 
[00:47:18] + error[E0277]: the size for values of type `Y` cannot be known at compilation time
[00:47:18] 3    |
[00:47:18] 3    |
[00:47:18] 4 LL |     let y: Y;
[00:47:18] 
[00:47:18] 33    = note: only the last element of a tuple may have a dynamically sized type
[00:47:18] 35 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:47:18] +   --> $DIR/unsized6.rs:25:12
[00:47:18] +    |
[00:47:18] +    |
[00:47:18] + LL |     let y: X;
[00:47:18] +    |            ^ doesn't have a size known at compile-time
[00:47:18] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:47:18] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:18] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:18] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:47:18] +    = note: the return type of a function must have a statically known size
[00:47:18] + 
[00:47:18] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:47:18] 37    |
[00:47:18] 37    |
[00:47:18] 38 LL |     let y: X;
[00:47:18] 
[00:47:18] 56    = note: only the last element of a r adding a `where X: std::marker::Sized` bound
[00:47:18] +    = note: the return type of a function must have a statically known size
[00:47:18] + 
[00:47:18] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:47:18] 96    |
[00:47:18] 96    |
[00:47:18] 97 LL |     let y: X = *x1;
[00:47:18] 151    = note: all local variables must have a statically known size
[00:47:18] 152    = help: unsized locals are gated as an unstable feature
[00:47:18] 153 
[00:47:18] - error: aborting due to 13 previous errors
---
[00:47:18] 
[00:47:18] 
[00:47:18] The actual stderr differed from the expected stderr.
[00:47:18] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsized6/unsized6.stderr
[00:47:18] To update references, rerun the tests and pass the `--bless` flag
[00:47:18] To only update this specific test, also pass `--test-args unsized6.rs`
[00:47:18] error: 1 errors occurred comparing output.
[00:47:18] status: exit code: 1
[00:47:18] status: exit code: 1
[00:47:18] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unsized6.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsized6/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsized6/auxiliary" "-A" "unused"
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] ------------------------------------------
[00:47:18] stderr:
[00:47:18] stderr:
[00:47:18] ------------------------------------------
[00:47:18] {"message":"the size for values of type `W` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":584,"byte_end":585,"line_start":16,"line_end":16,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let _: W; // <-- this is OK, no bindings created, no initializer.","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `W`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn ain() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":729,"byte_end":730,"line_start":19,"line_end":19,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: Y;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Y`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Y: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Y` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:19:12\n   |\nLL |     let y: Y;\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Y`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/secon the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":726,"byte_end":727,"line_start":19,"line_end":19,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y: Y;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Y`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sizeimplements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":654,"byte_end":673,"line_start":17,"line_end":17,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let _: (isize, (X, isize));","highlight_start":12,"highlight_end":31}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"only the last element of a tuple may have a dynamically sized type","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:17:12\n   |\nLL |     let _: (isize, (X, isize));\n   |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\r: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":786,"byte_end":805,"line_start":21,"line_end":21,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let y: (isize, (Z, usize));","highlight_start":12,"highlight_end":31}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Z`","code":null,"level":"help","spans":[],"children":[uld fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":900,"byte_end":901,"line_start":25,"line_end":25,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: X;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:25:12\n   |\nLL |     let y: X;\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:18] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn may-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:25:9\n   |\nLL |     let y: X;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:18] {"message":"the size for values of type `Y` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(ompile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":957,"byte_end":976,"line_start":27,"line_end":27,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let y: (isize, (Y, isize));","highlight_start":12,"highlight_end":31}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Y`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Y: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"only the last element of a tuple may have a dynamically sized type","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Y` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:27:12\n   |\nLL |     let y: (isize, (Y, isize));\n   |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Y`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where Y: std::marker::Sized` bound\n   = note: only the last element of a tuple may have a dynamically sized type\n\n"}
[00:47:18] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1090,"byte_end":1091,"line_start":32,"line_end":32,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/bthe Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1087,"byte_end":1088,"line_start":32,"line_end":32,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:32:9\n   |\nLL |     let y: X = *x1;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit            //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1150,"byte_end":1151,"line_start":34,"line_end":34,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y = *x2;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1211,"byte_end":1212,"line_start":36,"line_end":36,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":"    let (y, z) = (*x3, 4);","highlight_start":10,"highlight_end":11}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:36:10\n   |\nLL |    xt, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1344,"byte_end":1345,"line_start":40,"line_end":40,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"childrthe method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1341,"byte_end":1342,"line_start":40,"line_end":40,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:40:9\n   |\nLL |     let y: X = *x1;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:18] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in }],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:42:9\n   |\nLL |     let y = *x2;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:18] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpectedtd::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1465,"byte_end":1466,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":"    let (y, z) = (*x3, 4);","highlight_start":10,"highlight_end":11}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:44:10\n   |\nLL |     let (y, z) = (*x3, 4);\n   |          ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:18] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1546,"byte_end":1547,"line_start":48,"line_end":48,"column_start":18,"column_end":19,"is_primary":true,"text":[{"tex"}
[00:47:18] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter th:null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:50:22\n   |\nLL | fn g2<X: ?Sized + T>(x: X) {}\n   |                      ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:18] {"message":"aborting due to 18 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 18 previous errors\n\n"}
[00:47:18] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:47:18] ------------------------------------------
[00:47:18] 
[00:47:18] thread '[ui] ui/unsized6.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:47:18] 
---
151200 ./src/tools/clang
149120 ./src/llvm-emscripten/test
148688 ./obj/build/bootstrap/debug/incremental
134256 ./obj/build/bootstrap/debug/incremental/bootstrap-1v3ifugz4t07z
134252 ./obj/build/bootstrap/debug/incremental/bootstrap-1v3ifugz4t07z/s-f41k22in89-8bg0r5-1iplbejydu42a
128740 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release
127204 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu
127200 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release
124436 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexreg
Copy link
Contributor Author

alexreg commented Aug 21, 2018

@oli-obk @eddyb Eek, I broke something with the existing RPIT resolution. Any ideas how?

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:44:58] ......i.............................................................................................
[00:45:02] ............ii.iii..................................................................................
[00:45:04] ....................................................................................................
[00:45:06] ....................................................................................................
[00:45:09] ......................................................................................F.............
[00:45:13] ....................................................................................................
[00:45:16] i...................................................................i...............................
[00:45:16] i...................................................................i...............................
[00:45:19] .......................................................F............................................
[00:45:24] ............................................i.......................................................
[00:45:27] ....................................................................................................
[00:45:31] ....................................................................................................
[00:45:33] ....................................................................................................
[00:45:33] ....................................................................................................
[00:45:36] ....................................................................................................
[00:45:39] ....................................................................................................
[00:45:42] .......F............................................................................................
[00:45:49] ....................................................................................................
[00:45:51] .....................................i..............................................................
[00:45:54] .......................................................................................i.i..ii......
[00:45:54] .......................................................................................i.i..ii......
[00:45:58] ....................................F...............................................................
[00:46:04] ....................................................................................................
[00:46:06] ....................................................................................................
[00:46:09] ....................................................................................................
[00:46:12] ....................................................................................................
[00:46:12] ....................................................................................................
[00:46:15] ..............i.....................................................................................
[00:46:18] ....................................................................................................
[00:46:21] ....................................................................................................
[00:46:25] ...............................................i................................................FF..
[00:46:28] ....................................................................................................
:34] +   --> $DIR/no_inferrable_concrete_type.rs:21:1
[00:46:34] +    |
[00:46:34] + LL | / fn main() {
[00:46:34] + LL | |     let _: Foo = std::mem::transmute(0u8);
[00:46:34] + LL | | }
[00:46:34] +    |
[00:46:34] + note: previous use here
[00:46:34] +   --> $DIR/no_inferrable_concrete_type.rs:19:1
[00:46:34] +    |
[00:46:34] +    |
[00:46:34] + LL | fn bar(x: Foo) -> Foo { x }
[00:46:34] 10 
[00:46:34] - For more information about this error, try `rustc --explain E0391`.
[00:46:34] + error: aborting due to 2 previous errors
[00:46:34] + 
[00:46:34] + 
[00:46:34] + For more information about this error, try `rustc --explain E0283`.
[00:46:34] 12 
[00:46:34] 
[00:46:34] 
[00:46:34] The actual stderr differed from the expected stderr.
[00:46:34] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/existential_types/no_inferrable_concrete_type/no_inferrable_concrete_type.stderr
[00:46:34] To update references, rerun the tests and pass the `--bless` flag
[00:46:34] To only update this specific test, also pass `--test-args existential_types/no_inferrable_concrete_type.rs`
[00:46:34] error: 1 errors occurred comparing output.
[00:46:34] status: exit code: 1
[00:46:34] status: exit code: 1
[00:46:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/existential_types/no_inferrable_concrete_type/a" "-Crpath" "-O" "-Zbyte_end":725,"line_start":16,"line_end":16,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"existential type Foo: Copy; //~ cycle detected","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0283]: type annotations required: cannot resolve `_: std::marker::Copy`\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:16:1\n   |\nLL | existential type Foo: Copy; //~ cycle detected\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: the return type of a function must have a statically known size\n\n"}
[00:46:34] {"message":"defining existential type use differs from previous","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs","byte_start":816,"byte_end":872,"line_start":21,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":12},{"text":"    let _: Foo = std::mem::transmute(0u8);","highlight_start":1,"highlight_end":43},{"text":"}","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"previous use here","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs","byte_start":787,"byte_end":814,"line_start":19,"line_end":1                                 outer `impl Trait`
[00:46:34] 18 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 20   --> $DIR/where-allowed.rs:28:40
[00:46:34] 21    |
[00:46:34] 22 LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
[00:46:34] 23    |                                        ^^^^^^^^^^
[00:46:34] 24 
[00:46:34] 24 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 26   --> $DIR/where-allowed.rs:32:42
[00:46:34] 27    |
[00:46:34] 28 LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
[00:46:34] 29    |                                          ^^^^^^^^^^
[00:46:34] 30 
[00:46:34] 30 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 32   --> $DIR/where-allowed.rs:36:38
[00:46:34] 33    |
[00:46:34] 34 LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
[00:46:34] 35    |                                      ^^^^^^^^^^
[00:46:34] 36 
[00:46:34] 36 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allow46:34] 210 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 212   --> $DIR/where-allowed.rs:210:24
[00:46:34] 213    |
[00:46:34] 214 LL |     where T: PartialEq<impl Debug>
[00:46:34] 215    |                        ^^^^^^^^^^
[00:46:34] 216 
[00:46:34] 216 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 218   --> $DIR/where-allowed.rs:217:17
[00:46:34] 219    |
[00:46:34] 220 LL |     where T: Fn(impl Debug)
[00:46:34] 221    |                 ^^^^^^^^^^
[00:46:34] 222 
[00:46:34] 222 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 224   --> $DIR/where-allowed.rs:224:22
[00:46:34] 225    |
[00:46:34] 226 LL |     where T: Fn() -> impl Debug
[00:46:34] 227    |                      ^^^^^^^^^^
[00:46:34] 228 
[00:46:34] 228 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] -   --> $DIR/where-allowed.rs:230:29
[00:46:34] -    |
[00:46:34] - LL |     let _in_local_variable: impl Fn() = || {};
[00:46:34] - 
[00:46:34] - 
[00:46:34] - error[E0562]: `impl Tra                      outer `impl Trait`\n\n"}
[00:46:34] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":869,"byte_end":879,"line_start":28,"line_end":28,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/wot allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:32:42\n   |\nLL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }\n   |                                          ^^^^^^^^^^\n\n"}
[00:46:34] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1206,"byte_end":1216,"line_start":36,"line_end":36,"column_start":38,"column_end":48,"is_primary":true,"text":[{"text":"fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }","highlight_start":38,"highlight_end":48}],"label":null,"suggested_replaceinherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2924,"byte_end":2934,"line_start":74,"line_end":74,"column_start":59,"column_end":69,"is_primary":true,"text":[{"text":"fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }","highlight_start":59,"highlight_end":69}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:74:59\n   |\nLL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debu-allowed.rs","byte_start":4124,"byte_end":4134,"line_start":108,"line_end":108,"column_start":25,"column_end":35,"is_primary":true,"text":[{"text":"    InBraceVariant { x: impl Debug },","highlight_start":25,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:108:25\n   |\nLL |     InBraceVariant { x: impl Debug },\n   |                         ^^^^^^^^^^\n\n"}
[00:46:34] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6215,"byte_end":6225,"line_start":179,"line_end":179,"column_start":24,"column_end":34,"is_primary":true,"text":[{"text":"impl PartialEq<()> for impl Debug {","highlight_start":24,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:179:24\n   |\nLL | impl PartialEq<()> for impl Debug {\n   |                        ^^^^^^^^^^\n\n"}
[00:46:34] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //     or: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":7121,"byte_end":7131,"line_start":210,"line_end":210,"column_start":24,"column_end":34,"is_primary":true,"text":[{"text":"    where T: PartialEq<impl Debug>","highlight_start":24,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:210:24\n   |\nLL |     where T: PartialEq<impl Debug>\n   |                        ^^^^^^^^^^\n\n"}
[00:46:34] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impccurred: E0562, E0666.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0562, E0666.\n"}
[00:46:34] {"message":"For more information about an error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0562`.\n"}
[00:46:34] ------------------------------------------
[00:46:34] 
[00:46:34] thread '[ui] ui/impl-trait/where-allowed.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:46:34] 
[00:46:34] 
[00:46:34] ---- [ui] ui/issues/issue-47715.rs stdout ----
[00:46:34] diff of stderr:
[00:46:34] 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 3    |
[00:46:34] 3    |
[00:46:34] 4 LL | struct Container<T: Iterable<Item = impl Foo>> {
[00:46:34] 5    |                                     ^^^^^^^^
[00:46:34] 6 
[00:46:34] 6 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 9    |
[00:46:34] 9    |
[00:46:34] 10 LL | enum Enum<T: Iterable<Item = impl Foo>> {
[00:46:34] 11    |                              ^^^^^^^^
[00:46:34] 12 
[00:46:34] 12 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return 4-unknown-linux-gnu/test/ui/issues/issue-47715/auxiliary" "-A" "unused"
[00:46:34] ------------------------------------------
[00:46:34] 
[00:46:34] ------------------------------------------
[00:46:34] stderr:
[00:46:34] stderr:
[00:46:34] ------------------------------------------
[00:46:34] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-47715.rs","byte_start":569,"byte_end":577,"line_start":19,"line_end":19,"column_start":37,"column_end":45,"is_primary":true,"text":[{"text":"struct Container<T: Iterable<Item = impl Foo>> {","highlight_start":37,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/issues/issue-47715.rs:19:37\n   |\nLL | struct Container<T: Iterable<Item = impl F of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/issues/issue-47715.rs:34:30\n   |\nLL | type Type<T: Iterable<Item = impl Foo>> = T;\n   |                              ^^^^^^^^\n\n"}
[00:46:34] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:46:34] {"message":"For more information about this error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0562`.\n"}
[00:46:34] ------------------------------------------
[00:46:34] 
[00:46:34] thread '[ui] ui/issues/issue-47715.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:46:34] 
[00:46:34] 
[00:46:34] ---- [ui] ui/nested_impl_trait.rs stdout ----
[00:46:34] diff of stderr:
[00:46:34] 
[00:46:34] 34    |                                  |         nested `impl Trait` here
[00:46:34] 35    |                                  outer `impl Trait`
[00:46:34] 36 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:34] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:34] 39    |
[00:46:34] 39    |
[00:46:34] 40 LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
[00:46:34] 41    |                                ^^^^^^^^^^^^^^^^^^^^^
[00:46:34] 42 
[00:46:34] 42 
[00:46:34] - error[E0562]: `impl Trait` not allowed outside of funct:"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":585,"byte_end":606,"line_start":14,"line_end":14,"column_start":46,"column_end":67,"is_primary":false,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":46,"highlight_end":67}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":595,"byte_end":605,"line_start":14,"line_end":14,"column_start":56,"column_end":66,"is_primary":true,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":56,"highlight_end":66}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:14:56\n   |\nLL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }\n   |                                              ----------^^^^^^^^^^-\n   |                                              |         |\n   |                                              |         nested `impl Trait` here\n   |                                              outer `impl Trait`\n\n"}
[00:46:34] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":691,"byte_end":712,"line_start":17,"line_end":17,"column_start":32,"column_end":53,"is_pull,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":506,"line_start":13,"line_end":13,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use method::B;\n\n","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `b` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:78:7\n   |\nLL | struct S;\n   | --------- method `b` not found for this\n...\nLL |     S.b(); //~ ERROR no method named `b` found for type `S` in the current scope\n   |       ^\n   |\n   = help: items from traits can only be used if the trait is in scope\nhelp: the following trait is implemented but not in scope, perhaps add a `use` for it:\n   |\nLL | use method::B;\n   |\n\n"}
[00:46:34] {"message":"method `a` is private","code":{"code":"E0624","explanation":"\nA private item was used outside of its scope.\n\nErroneous code example:\n\n```compile_fail,E0624\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // error: method `method` is private\n```\n\ns the item.\n    }\n}\n\nlet foo = inner::Foo;\ninner::call_method(&foo); // And since the function is public, we can call the\n                          // method through it.\n```\n\n2. Make the item public:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        pub fn method(&self) {} // It's now public.\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // Ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2194,"byte_end":2198,"line_start":94,"line_end":94,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::a(&S); //~ ERROR method `a` is private","highlight_start":5,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0624]: method `a` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:94:5\n   |\nLL |     C::a(&S); //~ ERROR method `a` is private\n   |     ^^^^\n\n"}
[00:46:34] {"message":"no associated item named `A` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct Sen't behind trait objects.\n\n### Method has generic type parameters\n\nAs mentioned before, trait objects contain pointers to method tables. So, if we\nhave:\n\n```\ntrait Trait {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of type,"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:127:12\n   |\nLL |     let _: S::A; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::A`\n\n"}
[00:46:34] {"message":"ambiguous associated type","code":{"code":"E0223","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0223\ntrait MyTrait {type X; }\n\nfn main() {\n    let foo: MyTrait::X;\n}\n```\n\nThe problem here is that we're attempting to take the type of X from MyTrait.\nUnfortunately, the type of X is not defined, because it's only made concrete in\nimplementations of the trait. A working version of this code might look like:\n\n```\ntrait MyTrait {type X; }\nstruct MyStruct;\n\nimpl MyTrait for MyStruct {\n    type X = u32;\n}\n\nfn main() {\n    let foo: <MyStruct as MyTrait>::X;\n}\n```\n\nThis syntax specifies that we want the X type from MyTrait, as made concrete in\nMyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct\nmight implement two different traits with identically-named associated types.\nThis syntax allows disambiguation between the two.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3538,"byte_end":3542,"line_start":128,"line_end":128,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: S::B; //~ ERROR ambiguous associated type","highlight_start":12,"highlight_end":16}],"label":"ambiguo\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3869,"byte_end":3909,"line_start":136,"line_end":138,"column_start":12,"column_end":6,"is_primary":true,"text":[{"text":"    let _: assoc_ty::B<","highlight_start":12,"highlight_end":24},{"text":"        B = u8, // OK","highlight_start":1,"highich\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:evel":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:18:8\n   |\nLL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object\n   |        ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:46:34] {"message":"the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Examplenthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of types.\n\nFor example, with:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T);\n    // more methods\n}\n\nimpl Trait for String {\n    fn foo<T>(&self, on: T) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo<T>(&self, on: T) {\n        // implementation 2\n    }\n}\n\n// 8 more implementations\n```\n\nNow, if we have the following code:\n\n```compile_fail,E0038\n# trait Trait { fn foo<T>(&self, on: T); }\n# impl Trait for String { fn foo<T>
[00:46:34] 
[00:46:34] ---- [ui] ui/unsized6.rs stdout ----
[00:46:34] diff of stderr:
[00:46:34] 
[00:46:34] 
[00:46:34] + error[E0277]: the size for values of type `W` cannot be known at compilation time
[00:46:34] +   --> $DIR/unsized6.rs:16:12
[00:46:34] +    |
[00:46:34] + LL |     let _: W; // <-- this is OK, no bindings created, no initializer.
[00:46:34] +    |            ^ doesn't have a size known at compile-time
[00:46:34] +    = help: the trait `std::marker::Sized` is not implemented for `W`
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = help: consider adding a `where W: std::marker::Sized` bound
[00:46:34] +    = note: the return type of a function must have a statically known size
[00:46:34] + 
[00:46:34] 1 error[E0277]: the size for values of type `Y` cannot be known at compilation time
[00:46:34] +   --> $DIR/unsized6.rs:19:12
[00:46:34] +    |
[00:46:34] + LL |     let y: Y;
[00:46:34] +    |            ^ doesn't have a size known at compile-time
[00:46:34] +    = help: the trait `std::marker::Sized` is not implemented for `Y`
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = help: consider adding a `where Y: std::marker::Sized` bound
[00:46:34] +    = note: the r't have a size known at compile-time
[00:46:34] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:46:34] +    = note: the return type of a function must have a statically known size
[00:46:34] + 
[00:46:34] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:46:34] 60    |
[00:46:34] 60    |
[00:46:34] 61 LL |     let y: X = *x1;
[00:46:34] 92    = help: unsized locals are gated as an unstable feature
[00:46:34] 93 
[00:46:34] 94 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:46:34] +   --> $DIR/unsized6.rs:40:12
[00:46:34] +   --> $DIR/unsized6.rs:40:12
[00:46:34] +    |
[00:46:34] + LL |     let y: X = *x1;
[00:46:34] +    |            ^ doesn't have a size known at compile-time
[00:46:34] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:34] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:46:34] +    = note: the return type of a function must have a statically known size
[00:46:34] + 
[00:46:34] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:46:34] 95   --> $DIR/unsized6.rs:40:9
  = note: only the last element of a tuple may have a dynamically sized type\n\n"}
[00:46:34] {"message":"the size for values of type `Z` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the d"/checkout/src/test/ui/unsized6.rs","byte_start":900,"byte_end":901,"line_start":25,"line_end":25,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: X;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:25:12\n   |\nLL |     let y: X;\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: the return type of a function must have a statically known size\n\n"}
[00:46:34] {"message":"the size fer\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":897,"byte_end":898,"line_start":25,"line_end":25,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y: X;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a staticll it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1150,"byte_end":1151,"line_start":34,"line_end":34,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y = *x2;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1344,"byte_end":1345,"line_start":40,"line_end":40,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-sfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requireme we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@oli-obk
Copy link
Contributor

oli-obk commented Aug 21, 2018

I broke something with the existing RPIT resolution. Any ideas how?

I don't see anything in the errors. All I see is some diagnostic message changes. Can you bless those and give me some more info?

@XAMPPRocky XAMPPRocky added S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 21, 2018
@alexreg
Copy link
Contributor Author

alexreg commented Aug 21, 2018

@oli-obk You're right. I was too cursory in looking at those. Are the changes a bad thing necessarily? I'm not sure how I even caused them. Anyway, do please elaborate on how I can give you more info.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:44:47] ......i.............................................................................................
[00:44:50] ............ii.iii..................................................................................
[00:44:52] ....................................................................................................
[00:44:54] ....................................................................................................
[00:44:57] ......................................................................................F.............
[00:45:01] ....................................................................................................
[00:45:04] i...................................................................i...............................
[00:45:04] i...................................................................i...............................
[00:45:07] .......................................................F............................................
[00:45:12] ............................................i.......................................................
[00:45:15] ....................................................................................................
[00:45:18] ....................................................................................................
[00:45:20] ....................................................................................................
[00:45:20] ....................................................................................................
[00:45:23] ....................................................................................................
[00:45:26] ....................................................................................................
[00:45:29] .......F............................................................................................
[00:45:35] ....................................................................................................
[00:45:38] .....................................i..............................................................
[00:45:41] .......................................................................................i.i..ii......
[00:45:41] .......................................................................................i.i..ii......
[00:45:44] ....................................F...............................................................
[00:45:50] ....................................................................................................
[00:45:53] ....................................................................................................
[00:45:55] ....................................................................................................
[00:45:58] ....................................................................................................
[00:45:58] ....................................................................................................
[00:46:02] ..............i.....................................................................................
[00:46:05] ....................................................................................................
[00:46:07] ....................................................................................................
[00:46:11] ...............................................i................................................FF..
[00:46:14] ....................................................................................................
[00:46:17] ....................................................................................................
[00:46:19] .................F........................................................................i.........
9,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"fn bar(x: Foo) -> Foo { x }","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error: defining existential type use differs from previous\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:21:1\n   |\nLL | / fn main() {\nLL | |     let _: Foo = std::mem::transmute(0u8);\nLL | | }\n   | |_^\n   |\nnote: previous use here\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:19:1\n   |\nLL | fn bar(x: Foo) -> Foo { x }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:46:20] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:46:20] {"message":"For more information about this error, try `rustc --explain E0283`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0283`.\n"}
[00:46:20] ------------------------------------------
[00:46:20] 
[00:46:20] thread '[ui] ui/existential_types/no_inferrable_concrete_type.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:46:20] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:46:20] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:46:20] 
[00:46:20] ---- [ui] ui/impl-trait/where-allowed.rs stdout ----
[00:46:20] diff of stderr:
[00:46:20] 
[00:46:20] 16    |                                                 |       nested `impl Trait` here
[00:46:20] 78 
[00:46:20] 78 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 80   --> $DIR/where-allowed.rs:69:57
[00:46:20] 81    |
[00:46:20] 82 LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
[00:46:20] 83    |                                                         ^^^^^^^^^^
[00:46:20] 84 
[00:46:20] 84 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 86   --> $DIR/where-allowed.rs:74:59
[00:46:20] 87    |
[00:46:20] 88 LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
[00:46:20] 89    |                                                           ^^^^^^^^^^
[00:46:20] 90 
[00:46:20] 90 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 92   --> $DIR/where-allowed.rs:78:38
[00:46:20] 93    |
[00:46:20] 94 LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
[00:46:20] 95    |                                      ^^^^^^^^^^
[00:46:20] 96 
[00:46:20] 96 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0[00:46:20] 119    |                           ^^^^^^^^^^
[00:46:20] 120 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 122   --> $DIR/where-allowed.rs:108:25
[00:46:20] 123    |
[00:46:20] 124 LL |     InBraceVariant { x: impl Debug },
[00:46:20] 125    |                         ^^^^^^^^^^
[00:46:20] 126 
[00:46:20] 126 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 128   --> $DIR/where-allowed.rs:110:20
[00:46:20] 129    |
[00:46:20] 130 LL |     InTupleVariant(impl Debug),
[00:46:20] 131    |                    ^^^^^^^^^^
[00:46:20] 132 
[00:46:20] 132 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 134   --> $DIR/where-allowed.rs:121:23
[00:46:20] 135    |
[00:46:20] 136 LL |     fn in_return() -> impl Debug;
[00:46:20] 137    |                       ^^^^^^^^^^
[00:46:20] 138 
[00:46:20] 138 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 140   --> $DIR/where-allowed.rs:132:16
[00:46:20] 141    |
[00:46:20] 142 LL |     type Out = impl Debug;
[00:46:20] 143    |                ^^^^^^^^^^
[00:46:20] 144 
[00:46:20] 144 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 146   --> $DIR/where-allowed.rs:138:34
[00:46:20] 147    |
[00:46:20] 148 LL |     fn in_trait_impl_return() -> impl Debug { () }
[00:46:20] 149    |                                  ^^^^^^^^^^
[00:46:20] 150 
[00:46:20] 150 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 152   --> $DIR/where-allowed.rs:151:33
[00:46:20] 153    |
[00:46:20] 154 LL |     fn in_foreign_parameters(_: impl Debug);
[00:46:20] 155    |                                 ^^^^^^^^^^
[00:46:20] 156 
[00:46:20] 156 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 158   --> $DIR/where-allowed.rs:154:31
[00:46:20] 159    |
[00:46:20] 160 LL |     fn in_foreign_return() -> impl Debug;
[00:46:20] 161    |                               ^^^^^^^^^^
[00:46:20] 162 
[00:46:20] 162 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `46:20] 210 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 212   --> $DIR/where-allowed.rs:210:24
[00:46:20] 213    |
[00:46:20] 214 LL |     where T: PartialEq<impl Debug>
[00:46:20] 215    |                        ^^^^^^^^^^
[00:46:20] 216 
[00:46:20] 216 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 218   --> $DIR/where-allowed.rs:217:17
[00:46:20] 219    |
[00:46:20] 220 LL |     where T: Fn(impl Debug)
[00:46:20] 221    |                 ^^^^^^^^^^
[00:46:20] 222 
[00:46:20] 222 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 224   --> $DIR/where-allowed.rs:224:22
[00:46:20] 225    |
[00:46:20] 226 LL |     where T: Fn() -> impl Debug
[00:46:20] 227    |                      ^^^^^^^^^^
[00:46:20] 228 
[00:46:20] 228 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] -   --> $DIR/where-allowed.rs:230:29
[00:46:20] -    |
[00:46:20] - LL |     let _in_local_variable: impl Fn() = || {};
[00:46:20] - 
[00:46:20] - 
[00:46:20] - error[E0562]: `impl Tra     |       |\n   |                                           |       nested `impl Trait` here\n   |                                           outer `impl Trait`\n\n"}
[00:46:20] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2682,"byte_end":2701,"line_start":69,"line_end":69,"column_start":49,"column_end":68,"is_primary":false,"text":[{"text":"fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }","highlight_start":49,"highlight_end":68}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2690,"byte_end":2700,"line_start":69,"line_end":69,"column_start":57,"column_end":67,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }","highlight_start":57,"highlight_end":67}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:69:57\n   |\nLL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }\n   |                                                 --------^^^^^^^^^^-\n   |                                                 |       |\n   |                                                 |       nested `impl Trait` here\n   |                           ment":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:36:38\n   |\nLL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }\n   |                                      ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1374,"byte_end":1384,"line_start":40,"line_end":40,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_fn_return_in_return() ,"line_end":44,"column_start":49,"column_end":59,"is_primary":true,"text":[{"text":"fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }","highlight_start":49,"highlight_end":59}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:44:49\n   |\nLL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }\n   |                                                 ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1730,"byte_end":1740,"line_start":48,"line_end":48,"column_start":51,"column_end":61,"is_primary":true,"text":[{"text":"fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }","highlight_start":51,"highlight_end":61}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:48:51\n   |\nLL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }\n   |                                                   ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n r i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2276,"byte_end":2286,"line_start":60,"line_end":60,"column_start":51,"column_end":61,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":51,"highlight_end":61}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:60:51\n   |\nLL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }\n   |                                                   ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: ig { panic!() }\n   |                                                           ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":3089,"byte_end":3099,"line_start":78,"line_end":78,"column_start":38,"column_end":48,"is_primary":true,"text":[{"text":"fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }","highlight_start":38,"highlight_end":48}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:78:38\n   |\nLL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }\n   |                                      ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":3265,"byte_end":3275,"line_start":82,"line_end":82,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansioghlight_end":42}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:95:32\n   |\nLL | struct InBraceStructField { x: impl Debug }\n   |                                ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":3825,"byte_end":3835,"line_start":99,"line_end":99,"column_start":41,"column_end":51,"is_primary":true,"text":[{"text":"str-allowed.rs","byte_start":4124,"byte_end":4134,"line_start":108,"line_end":108,"column_start":25,"column_end":35,"is_primary":true,"text":[{"text":"    InBraceVariant { x: impl Debug },","highlight_start":25,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:108:25\n   |\nLL |     InBraceVariant { x: impl Debug },\n   |                         ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"t-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5019,"byte_end":5029,"line_start":138,"line_end":138,"column_start":34,"column_end":44,"is_primary":true,"text":[{"text":"    fn in_trait_impl_return() -> impl Debug { () }","highlight_start":34,"highlight_end":44}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:138:34\n   |\nLL |     fn in_trait_impl_return() -> impl Debug { () }\n   |                                  ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n  n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5486,"byte_end":5496,"line_start":154,"line_end":154,"column_start":31,"column_end":41,"is_primary":true,"text":[{"text":"    fn in_foreign_return() -> impl Debug;","highlight_start":31,"highlight_end":41}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:154:31\n   |\nLL |     fn in_foreign_return() -> impl Debug;\n   |                               ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: us a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5898,"byte_end":5908,"line_start":170,"line_end":170,"column_start":39,"column_end":49,"is_primary":true,"text":[{"text":"type InReturnInTypeAlias<R> = fn() -> impl Debug;","highlight_start":39,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:170:39\n   |\nLL | type InReturnInTypeAlias<R> = fn() -> impl Debug;\n   |                                       ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6045,"byte_end":6055,"line_start":174,"line_end":174,"column_start":16,"column_end":26,"is_primary":true,"text":[{"text":"impl PartialEq<impl Debug> for () {","highlight_start":16,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:174:16\n   |\nLL | impl PartialEq<impl Debug> for () {\n   |                ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\pes\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6562,"byte_end":6572,"line_start":190,"line_end":190,"column_start":24,"column_end":34,"is_primary":true,"text":[{"text":"impl InInherentImplAdt<impl Debug> {","highlight_start":24,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:190:24\n   |\nLL | impl InInherentImplAdt<impl Debug> {\n   |                        ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of functil Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":7300,"byte_end":7310,"line_start":217,"line_end":217,"column_start":17,"column_end":27,"is_primary":true,"text":[{"text":"    where T: Fn(impl Debug)","highlight_start":17,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:217:17\n   |\nLL |     where T: Fn(impl Debug)\n   |                 ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":7481,"byte_end":7491,"line_start":224,"line_end":224,"column_start":22,"column_end":32,"is_primary":true,"text":[{"text":"    where T: Fn() -> impl Debug","highlight_start":22,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:224:22\n   |\nLL |     where T: Fn() -> impl Debug\n   |                      ^^^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```cccurred: E0562, E0666.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0562, E0666.\n"}
[00:46:20] {"message":"For more information about an error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0562`.\n"}
[00:46:20] ------------------------------------------
[00:46:20] 
[00:46:20] thread '[ui] ui/impl-trait/where-allowed.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:46:20] 
[00:46:20] 
[00:46:20] ---- [ui] ui/issues/issue-47715.rs stdout ----
[00:46:20] diff of stderr:
[00:46:20] 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 3    |
[00:46:20] 3    |
[00:46:20] 4 LL | struct Container<T: Iterable<Item = impl Foo>> {
[00:46:20] 5    |                                     ^^^^^^^^
[00:46:20] 6 
[00:46:20] 6 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 9    |
[00:46:20] 9    |
[00:46:20] 10 LL | enum Enum<T: Iterable<Item = impl Foo>> {
[00:46:20] 11    |                              ^^^^^^^^
[00:46:20] 12 
[00:46:20] 12 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/issues/issue-47715.rs:19:37\n   |\nLL | struct Container<T: Iterable<Item = impl Foo>> {\n   |                                     ^^^^^^^^\n\n"}
[00:46:20] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-47715.rs","byte_start":667,"byte_end":675,"line_start":24,"line_end":24,"column_start":30,"column_end":38,"is_primary":true,"text":[{"text":"enum Enum<T: Iterable<Item = impl Foo>> {","highlight_start":30,"highled_impl_trait.rs:17:32
[00:46:20] 39    |
[00:46:20] 40 LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
[00:46:20] 41    |                                ^^^^^^^^^^^^^^^^^^^^^
[00:46:20] 42 
[00:46:20] 42 
[00:46:20] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:46:20] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:46:20] 45    |
[00:46:20] 45    |
[00:46:20] 46 LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {
[00:46:20] 
[00:46:20] The actual stderr differed from the expected stderr.
[00:46:20] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/nested_impl_trait.stderr
[00:46:20] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/nested_impl_trait.stderr
[00:46:20] To update references, rerun the tests and pass the `--bless` flag
[00:46:20] To only update this specific test, also pass `--test-args nested_impl_trait.rs`
[00:46:20] error: 1 errors occurred comparing output.
[00:46:20] status: exit code: 1
[00:46:20] status: exit code: 1
[00:46:20] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nested_impl_trait.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/auxiliary" "-A" "unused"
[00:46:20] -----n"}
[00:46:20] -----n"}
[00:46:20] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":691,"byte_end":712,"line_start":17,"line_end":17,"column_start":32,"column_end":53,"is_primary":false,"text":[{"text":"fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}","highlight_start":32,"highlight_end":53}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":701,"byte_end":711,"line_start":17,"line_end":17,"column_start":42,"column_end":52,"is_primary":true,"text":[{"text":"fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}","highlight_start":42,"highlight_end":52}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:17:42\n   |\nLL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}\n   |                                ----------^^^^^^^^^^-\n   |                                |         |\n   |                                |         nested `impl Trait` here\n   |                                outer `impl Trait`\n\n"}
[00:46:20] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":821,"byte_end":842,"line_start":21,"line_end":21,"column_start":27,"column_end":48,"is_primary":false,"text":[{"text":"fn bad_in_arg_position(_: impl Into<impl Debug>) { }","highlight_start":27,"highlight_end":48}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":831,"byte_end":841,"line_start":21,"line_end":21,"column_start":37,"column_end":47,"is_primary":true,"text":[{"text":"fn bad_in_arg_position(_: impl Into<impl Debug>) { }","highlight_start":37,"highlight_end":47}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:21:37\n   |\nLL | fn bad_in_arg_position(_: impl Into<impl Debug>) { }\n   |                           ----------^^^^^^^^^^-\n   |                           |         |\n   |                           |         nested `impl Trait` here\n   |                           outer `impl Trait`\n\n"}
[00:46:20] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":947,"byte_end":968,"line_start":26,"line_end":26,"column_start":34,"column_end":55,"is_primary":false,"text":[{"text":"    fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":34,"highlight_end":55}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","b    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":1176,"byte_end":1190,"line_start":34,"line_end":34,"column_start":42,"column_end":56,"is_primary":true,"text":[{"text":"fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {","highlight_start":42,"highlight_end":56}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/nested_impl_trait.rs:34:42\n   |\nLL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {\n   |                                          ^^^^^^^^^^^^^^\n\n"}
[00:46:20] {"message":"aborting due to 6 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 6 previous errors\n\n"}
[00:46:20] {"message":"Some errors occurred: E0562, E0666.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0562, E0666.\n"}
[00:46:20] {"message":"For more information about an error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0562`.\n"}
[00:46:20] ------------------------------------------
[00:46:20] 
[00:46:20] 
[00:46:20] thread '[ui] ui/nested_i"code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `a`, perhaps you need to implement it:\ncandidate #1: `method::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `a` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:77:7\n   |\nLL | struct S;\n   | --------- method `a` not found for this\n...\nLL |     S.a(); //~ ERROR no method named `a` found for type `S` in the current scope\n   |       ^\n   |\n   = help: items from traits can only be used if the trait is implemented and in scope\n   = note: the following trait defines an item `a`, perhaps you need to implement it:\n           candidate #1: `method::A`\n\n"}
[00:46:20] {"message":"no method named `b` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"method `b` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":1530,"byte_end":1531,"line_start":78,"line_end":78,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":"    S.b(); //~ ERROR no method named `b` found for type `S` in the current scope","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":506,"line_start":13,"line_end":13,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use method::B;\n\n","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `b` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:78:7\n   |\nLL | struct S;\n   | --------- method `b` not found for this\n...\nLL |     S.b(); //~ ERROR no method named `b` found for type `S` in the current scope\n   |       ^\n   |\n   = help: items from traits can only be used if the trait is in scope\nhelp: the following trait is implemented but not in scope, perhaps add a `use` for it:\n   |\nLL | use method::B;\n   |\n\n"}
[00:46:20] {"message":"method `a` is private","code":{"code":"E0624",` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"function or associated item `a` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":1910,"byte_end":1914,"line_start":88,"line_end":88,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::a(&S);","highlight_start":5,"highlight_end":9}],"label":"function or associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `a`, perhaps you need to implement it:\ncandidate #1: `method::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no function or associated item named `a` found for type `S` in the current scope\n  --> /cheavailable to solve this issue:\n\n1. Only use the item in the scope it has been defined:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n\n    pub fn call_method(foo: &Foo) { // We create a public function.\n        foo.method(); // Which calls the item.\n    }\n}\n\nlet foo = inner::Foo;\ninner::call_method(&foo); // And since the function is public, we can call the\n                          // method through it.\n```\n\n2. Make the item public:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        pub fn method(&self) {} // It's now public.\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // Ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2194,"byte_end":2198,"line_start":94,"line_end":94,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::a(&S); //~ ERROR method `a` is private","highlight_start":5,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0624]: method `a` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:94:5\n   |\nLL |     C::a(&S); //~ ERROR method `a` is private\n   |     ^^^^\n\n"}
[00:46:20] {"message":"no associated item named `A` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"associated item `A` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2522,"byte_end":2526,"line_start":107,"line_end":107,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope","highlight_start":5,"highlight_end":9}],"label":"associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `A`, perhaps you need to implement it:\ncandidate #1: `assoc_const::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no associated item named `A` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:107:5\n   |\nLL | struct S;\n   | --------- associated item `A` not found for this\n...\nLL |     S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope\n   |     ^^^^ associated item not found in `S`\n   |\n   = help: items from traits can only be used if the trait is implemented and in scope\n   = note: the following trait defines an item `A`, perhaps you need to implement it:\n           candidate #1: `assoc_const::A`\n\n"}
[00:46:20] {"message":"no associated item named `B` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"associated item `B` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2611,"byte_end":2615,"line_start":108,"line_end":108,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope","highlight_start":5,"highlight_end":9}],"label":"associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children"   pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n\n    pub fn call_method(foo: &Foo) { // We create a public function.\n        foo.method(); // Which calls the item.\n    }\n}\n\nlet foo = inner::Foo;\ninner::call_method(&foo); // And since the function is public, we can call the\n                          // method through it.\n```\n\n2. Make the item public:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        pub fn method(&self) {} // It's now public.\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // Ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2802,"byte_end":2806,"line_start":111,"line_end":111,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::A; //~ ERROR associated constant `A` is private","highlight_start":5,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0624]: associated constant `A` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:111:5\n   |\nLL |     C::A; //~ ERROR associated constant `A` is private\n   |     ^^^^\n\n"}
[00:46:20] {"message":"the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n tem-privacy.rs:35:9\n   |\nLL |         const A: u8 = 0;\n   |         ^^^^^^^^^^^^^^^^\n\n"}
[00:46:20] {"message":"the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error hertype, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the following:\n\n```\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nimpl Trait for String {\n    fn foo(&self) -> Self {\n        \"hi\".to_owned()\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) -> Self {\n        1\n    }\n}\n```\n\n(Note that `&self` and `&mut self` are okay, it's additional `Self` types which\ncause this problem.)\n\nIn such a case, the compiler cannot predict the return type of `foo()` in a\nsituation like the following:\n\n```compile_fail\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nfn call_foo(x: Box<Trait>) {\n    let y = x.foo(); // What type is y?\n    // ...\n}\n```\n\nIf only some methods aren't object-safe, you can add a `where Self: Sized` bound\non them to mark them as explicitly unavailable to trait objects. The\nfunctionality will still be available to all other implementers, including\n`Box<Trait>` which is itself sized (assuming you `impl Trait for Box<Trait>`).\n\n```\ntrait Trait {\n    fn foo(&self) -> Self where Self: Siis object safe!\n}\n```\n\nIf the trait `Foo` was deriving from something like `Super<String>` or\n`Super<T>` (where `Foo` itself is `Foo<T>`), this is okay, because given a type\n`get_a()` will definitely return an object of that type.\n\nHowever, if it derives from `Super<Self>`, even though `Super` is object safe,\nthe method `get_a()` would return an object of unknown type when called on the\nfunction. `Self` type parameters let us make object safe traits no longer safe,\nso they are forbidden when specifying supertraits.\n\nThere's no easy fix for this, generally code will need to be refactored so that\nyou no longer need to derive from `Super<Self>`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2802,"byte_end":2806,"line_start":111,"line_end":111,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::A; //~ ERROR associated constant `A` is private","highlight_start":5,"highlight_end":9}],"label":"the trait `assoc_const::C` cannot be made into an object","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait cannot contain associated consts like `C`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the trait cannot contain associated consts like `B`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the trait cannot contain associated consts like `A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `assoc_const::C` cannot be made into an object\n  --> /checkout/srype","highlight_start":12,"highlight_end":16}],"label":"ambiguous associated type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<S as Trait>::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:127:12\n   |\nLL |     let _: S::A; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::A`\n\n"}
[00:46:20] {"message":"ambiguous associated type","code":{"code":"E0223","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0223\ntrait MyTrait {type X; }\n\nfn main() {\n    let foo: MyTrait::X;\n}\n```\n\nThe problem here is that we're attempting to take the type of X from MyTrait.\nUnfortunately, the type of X is not defined, because it's only made concrete in\nimplementations of the trait. A working version of this code might look like:\n\n```\ntrait MyTrait {type X; }\nstruct MyStruct;\n\nimpl MyTrait for MyStruct {\n    type X = u32;\n}\n\nfn main() {\n    let foo: <MyStruct as MyTrait>::X;\n}\n```\n\nThis syntax specifies that we want the X type from MyTrait, as made concrete in\nMyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct\nmight implement two different traits with identically-named associated types.\nThis syntax allows disambiguation between the two.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3538,"byte_end":3542,"line_start":128,"line_end":128,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: S::B; //~ ERROR ambiguous associated type","highlight_start":12,"highlight_end":16}],"label":"ambiguous associated type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<S as Trait>::B`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:128:12\n   |\nLL |     let _: S::B; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::B`\n\n"}
[00:46:20] {"message":"ambiguous associated type","code":{"code":"E0223","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0223\ntrait MyTrait {type X; }\n\nfn main() {\n    let foo: MyTrait::X;\n}\n```\n\nThe problem here is that we're attempting to take the type of X from MyTrait.\nUnfortunately, the type of X is not defined, because it's only made concrete in\nimplementations of the trait. A working version of this code might look like:\n\n```\ntrait MyTrait {type X; }\nstruct MyStruct;\n\nimpl MyTrait for MyStruct {\n    type X = u32;\n}\n\nfn main() {\n    let foo: <MyStruct as MyTrait>::X;\n}\n```\n\nThis syntax specifies that we want the X type from MyTrait, as made concrete in\nMyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct\nmight implement two different traits with identically-named associated types.\nThis syntax allows disambiguation between the two.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3591,"byte_end":3595,"line_start":129,"line_end":129,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: S::C; //~ ERROR ambiguous associated type","highlight_start":12,"highlight_end":16}],"label":"ambiguous associated type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<S as Trait>::C`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:129:12\n   |\nLL |     let _: S::C; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::C`\n\n"}
[00:46:20] {"message":"associated type `A` is private","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3730,"byte_end":3734,"line_start":131,"line_end":131,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: T::A; //~ ERROR associated type `A` is private","highlight_start":12,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: associated type `A` is private\n  --> /checkout/src/test/ui/t/ui/traits/trait-item-privacy.rs","byte_start":3869,"byte_end":3909,"line_start":136,"line_end":138,"column_start":12,"column_end":6,"is_primary":true,"text":[{"text":"    let _: assoc_ty::B<","highlight_start":12,"highlight_end":24},{"text":"        B = u8, // OK","highlight_start":1,"highlight_end":22},{"text":"    >;","highlight_start":1,"highlight_end":6}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:136:12\n   |\nLL |       let _: assoc_ty::B<\n   |  ____________^\nLL | |         B = u8, // OK\nLL | |     >;\n   | |_____^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return typerror, try `rustc --explain E0038`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0038`.\n"}
[00:46:20] ------------------------------------------
[00:46:20] 
[00:46:20] thread '[ui] ui/traits/trait-item-privacy.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:46:20] 
[00:46:20] 
[00:46:20] ---- [ui] ui/traits/trait-object-macro-matcher.rs stdout ----
[00:46:20] diff of stderr:
[00:46:20] 
[00:46:20] 4 LL |     m!('static +); //~ ERROR at least one non-builtin trait is required for an object type
[00:46:20] 6 
[00:46:20] 6 
[00:46:20] + error[E0277]: the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time
[00:46:20] +   --> $DIR/trait-object-macro-matcher.rs:18:8
[00:46:20] +    |
[00:46:20] + LL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object
[00:46:20] +    |
[00:46:20] +    |
[00:46:20] +    = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`
[00:46:20] +    = note: the return type of a function must have a statically known size
[00:46:20] + 
[00:46:20] + 
[00:46:20] + error[E0277]: the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time
r.rs`
[00:46:20] error: 1 errors occurred comparing output.
[00:46:20] status: exit code: 1
[00:46:20] status: exit code: 1
[00:46:20] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-object-macro-matcher.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/auxiliary" "-A" "unused"
[00:46:20] ------------------------------------------
[00:46:20] 
[00:46:20] ------------------------------------------
[00:46:20] stderr:
[00:46:20] stderr:
[00:46:20] ------------------------------------------
[00:46:20] {"message":"at least one non-builtin trait is required for an object type","code":{"code":"E0224","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":706,"byte_end":715,"line_start":20,"line_end":20,"column_start":8,"column_end":17,"is_primary":true,"text":[{"text":"    m!('static +); //~ ERROR at least one non-builtin trait is required for an object type","highlight_start":8,"highlight_end":17}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0224]: at least one non-builtin trait is required for an object type\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:20:8\n   |\nLL |     m!('static +); //~ ERROR at least one non-builtin trait is required for an object type\n   |        ^^^^^^^^^\n\n"}
[00:46:20] {"message":"the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // whicn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of types.\n\nFor example, with:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T);\n    // more methods\n}\n\nimpl Trait for String {\n    fn foo<T>(&self, on: T) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo<T>(&self, on: T) {\n        // implementation 2\n    }\n}\n\n// 8 more implementations\n```\n\nNow, if we have the following code:\n\n```compile_fail,E0038\n# trait Trait { fn foo<T>(&self, on: T); }\n# impl Trait for String { fn foo<T>(&self, on: T) {} }\n# impl Trait for u8 { fn foo<T>(&self, on: T) {} }\n# impl Trait for bool { fn foo<T>(&self, on: T) {} }\n# // etc.\nfn call_foo(thing: Box<Trait>) {\n    thing.foo(true); // this could be any one of the 8 types above\n    thing.foo(1);\n    thing.foo(\"hello\");\n}\n```\n\nWe don't just need to create a table of all implementations of all methods of\n`Trait`, we need to create such a table, for each different type fed to\n`foo()`. In this case this turns out to be (10 types implementing `Trait`)*(3\ntypes being fed to `foo()`) = 30 implementations!\n\nWith real world traits these numbers can grow drastically.\n\nTo fix this, it is suggested to use a `where Self: Sized` bound similar to the\nfix for the sub-error above if you do not intend to call the method with type\nparameters:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T) where Self: Sized;\n    // more methods\n}\n```\n\nIf this is not an option, consider replacing the type parameter with another\ntrait object (e.g. if `T: OtherTrait`, use `on: Box<OtherTrait>`). If the number\nof types you intend to feed to this method is limited, consider manually listing\nout the methods of different types.\n\n### Method has no receiver\n\nMethods that do not take a `self` parameter can't be called since there won't be\na way to get a pointer to the method table for them.\nnger safe,\nso they are forbidden when specifying supertraits.\n\nThere's no easy fix for this, generally code will need to be refactored so that\nyou no longer need to derive from `Super<Self>`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":581,"byte_end":602,"line_start":18,"line_end":18,"column_start":8,"column_end":29,"is_primary":true,"text":[{"text":"    m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object","highlight_start":8,"highlight_end":29}],"label":"the trait `std::marker::Copy` cannot be made into an object","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait cannot require that `Self : Sized`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `std::marker::Copy` cannot be made into an object\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:18:8\n   |\nLL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object\n   |        ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object\n   |\n   = note: the trait cannot require that `Self : Sized`\n\n"}
[00:46:20] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:46:20] {"message":"Some errors occurred: E0038, E0224, E0277.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0038, E0224, E0277.\n"}
[00:46:20]tuple may have a dynamically sized type
[00:46:20] 58 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:46:20] +   --> $DIR/unsized6.rs:32:12
[00:46:20] +    |
[00:46:20] +    |
[00:46:20] + LL |     let y: X = *x1;
[00:46:20] +    |            ^ doesn't have a size known at compile-time
[00:46:20] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:46:20] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:20] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:20] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:46:20] +    = note: the return type of a function must have a statically known size
[00:46:20] + 
[00:46:20] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:46:20] 60    |
[00:46:20] 60    |
[00:46:20] 61 LL |     let y: X = *x1;
[00:46:20] 92    = help: unsized locals are gated as an unstable feature
[00:46:20] 93 
[00:46:20] 94 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:46:20] +   --> $DIR/unsized6.rs:40:12
[00:46:20] +   --> $DIR/unsized6.rs:40:12
[00:46:20] +    |
[00:46:20] + LL |     let y: X = *x1;
[00:46:20] +    |            ^ doesn't have a size known at compile-time
[00:46:20] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:46:20] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:20] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:46:20] +    = help: consideain() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":729,"byte_end":730,"line_start":19,"line_end":19,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: Y;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Y`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Y: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Y` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:19:12\n   |\nLL |     let y: Y;\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Y`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Y: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Y` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:19:9\n   |\nLL |     let y: Y;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Y`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where Y: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:46:20] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    on/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Z: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"only the last element of a tuple may have a dynamically sized type","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Z` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:21:12\n   |\nLL |     let y: (isize, (Z, usize));\n   |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Z`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where Z: std::marker::Sized` bound\n   = note: only the last element of a tuple may have a dynamically sized type\n\n"}
[00:46:20] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn'd":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:25:9\n   |\nLL |     let y: X;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:46:20] {"message":"the size for values of type `Y` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\nooks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":957,"byte_end":976,"line_start":27,"line_end":27,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let y: (isize, (Y, isize));","highlight_start":12,"highlight_end":31}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Y`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Y: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"only the last element of a tuple may have a dynamically sized type","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Y` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:27:12\n   |\nLL |     let y: (isize, (Y, isize));\n   |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Y`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where Y: std::marker::Sized` bound\n   = note: only the last element of a tuple may have a dynamically sized type\n\n"}
[00:46:20] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i3``\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that wilang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:34:9\n   |\nLL |     let y = *x2;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:46:20] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32  let (y, z) = (*x3, 4);\n   |          ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:46:20] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic contea generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1404,"byte_end":1405,"line_start":42,"line_end":42,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y = *x2;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1465,"byte_end":1466,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":"    let (y, z) = (*x3, 4);","highlight_start":10,"highlight_end":11}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":t":"fn g1<X: ?Sized>(x: X) {}","highlight_start":18,"highlight_end":19}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:48:18\n   |\nLL | fn g1<X: ?Sized>(x: X) {}\n   |                  ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\nrete_type.rs
[00:46:20]     [ui] ui/issues/issue-47715.rs
[00:46:20]     [ui] ui/nested_impl_trait.rs
[00:46:20]     [ui] ui/traits/trait-item-privacy.rs
[00:46:20]     [ui] ui/traits/trait-object-macro-matcher.rs
[00:46:20]     [ui] ui/traits/trait-object-macro-matcher.rs
[00:46:20]     [ui] ui/unsized6.rs
[00:46:20] 
[00:46:20] test result: FAILED. 4124 passed; 7 failed; 20 ignored; 0 measured; 0 filtered out
[00:46:20] 
[00:46:20] 
[00:46:20] 
[00:46:20] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:46:20] 
[00:46:20] 
[00:46:20] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:46:20] Build completed unsuccessfully in 0:02:58
[00:46:20] Build completed unsuccessfully in 0:02:58
[00:46:20] Makefile:58: recipe for target 'check' failed
[00:46:20] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:23d99fe4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@@ -1224,7 +1254,7 @@ impl<'a> LoweringContext<'a> {
t.span,
E0562,
"`impl Trait` not allowed outside of function \
and inherent method return types"
and inherent method return types or bindings"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this caused the changes ;)

@bors
Copy link
Contributor

bors commented Aug 23, 2018

☔ The latest upstream changes (presumably #53384) made this pull request unmergeable. Please resolve the merge conflicts.

@alexreg
Copy link
Contributor Author

alexreg commented Aug 30, 2018

@oli-obk @eddyb Feedback would be greatly appreciated at this point. I get this error now:

error: internal compiler error: broken MIR in DefId(0/0:4 ~ foo[317d]::main[0]) (UserAssertTy(Canonical { variables: [], value: impl std::cmp::PartialEq<i32> }, _1)): bad type assert (Canonical { variables: [], value: impl std::cmp::PartialEq<i32> } = i32): NoSolution
 --> foo.rs:8:9
  |
8 |     let x: impl PartialEq<i32> = 123_i32;
  |         ^

thread 'main' panicked at 'no errors encountered even though `delay_span_bug` issued', librustc_errors/lib.rs:322:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

The test file is simply:

fn main() {
    let x: impl PartialEq<i32> = 123_i32;
}

Note that if instead of the following line in code:

let c_ty = self.fcx.inh.infcx.canonicalize_response(&o_ty);

I do this:

let c_ty = self.fcx.inh.infcx.canonicalize_response(&revealed_ty);

then things work, although x has a transparent type!

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:46:30] .......i............................................................................................
[00:46:34] .............ii.iii.................................................................................
[00:46:36] ....................................................................................................
[00:46:38] ....................................................................................................
[00:46:41] ..................................................................................F.................
[00:46:45] ................................................................................................i...
[00:46:48] ...............................................................i....................................
[00:46:48] ...............................................................i....................................
[00:46:51] .....................................................F..............................................
[00:46:57] ...............................................i....................................................
[00:46:59] ....................................................................................................
[00:47:03] ....................................................................................................
[00:47:05] ....................................................................................................
[00:47:05] ....................................................................................................
[00:47:08] ....................................................................................................
[00:47:11] ....................................................................................................
[00:47:15] ..........F.........................................................................................
[00:47:21] ....................................................................................................
[00:47:23] .......................................i............................................................
[00:47:26] .........................................................................................i.i..ii....
[00:47:26] .........................................................................................i.i..ii....
[00:47:30] ......................................F.............................................................
[00:47:36] ....................................................................................................
[00:47:39] ....................................................................................................
[00:47:41] ....................................................................................................
[00:47:44] ....................................................................................................
[00:47:44] ....................................................................................................
[00:47:47] .............................i......................................................................
[00:47:51] ....................................................................................................
[00:47:54] ....................................................................................................
[00:47:57] ................................................................i...................................
[00:48:00] .............FF.....................................................................................
[00:48:04] ....................................................................................................
[00:48:06] ..........................................F.........................................................
d outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 44   --> $DIR/where-allowed.rs:44:49
[00:48:08] 45    |
[00:48:08] 46 LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
[00:48:08] 47    |                                                 ^^^^^^^^^^
[00:48:08] 48 
[00:48:08] 48 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 50   --> $DIR/where-allowed.rs:48:51
[00:48:08] 51    |
[00:48:08] 52 LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
[00:48:08] 53    |                                                   ^^^^^^^^^^
[00:48:08] 54 
[00:48:08] 54 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 56   --> $DIR/where-allowed.rs:52:55
[00:48:08] 57    |
[00:48:08] 58 LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
[00:48:08] 59    |                                                       ^^^^^^^^^^
[00:48:08] 60 
[00:48:08] 60 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method returnon and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 170   --> $DIR/where-allowed.rs:170:39
[00:48:08] 171    |
[00:48:08] 172 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
[00:48:08] 173    |                                       ^^^^^^^^^^
[00:48:08] 174 
[00:48:08] 174 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 176   --> $DIR/where-allowed.rs:174:16
[00:48:08] 177    |
[00:48:08] 178 LL | impl PartialEq<impl Debug> for () {
[00:48:08] 179    |                ^^^^^^^^^^
[00:48:08] 180 
[00:48:08] 180 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 182   --> $DIR/where-allowed.rs:179:24
[00:48:08] 183    |
[00:48:08] 184 LL | impl PartialEq<()> for impl Debug {
[00:48:08] 185    |                        ^^^^^^^^^^
[00:48:08] 186 
[00:48:08] 186 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 188   --> $DIR/where-allowed.rs:184:6
[00:48:08] 189    |
[00:48:08] 190 LL | impl impl Debug {
[00:48:08] 191    |      ^^^^^^^^^^
[00:48:08] 191    |      ^^^^^^^^^^
[00  ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1374,"byte_end":1384,"line_start":40,"line_end":40,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:40:40\n   |\nLL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }\n   |                                        ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1550,"byte_end":1560,"line_start":44,"line_end":44,"column_start":49,"column_end":59,"is_primary":true,"text":[{"text":"fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }","highlight_start":49,"highlight_end":59}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of \nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2690,"byte_end":2700,"line_start":69,"line_end":69,"column_start":57,"column_end":67,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }","highlight_start":57,"highlight_end":67}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:69:57\n   |\nLL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }\n   |                                                         ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `imhod return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:103:27\n   |\nLL | struct InTupleStructField(impl Debug);\n   |                           ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4124,"byte_end":4134,"line_start":108,"line_end":108,"column_start":25,"column_end":35,"is_primary":true,"text":[{"text":"    InBraceVariant { x: impl Debug },","highlight_start":25,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5901,"byte_end":5911,"line_start":170,"line_end":170,"column_start":39,"column_end":49,"is_primary":true,"text":[{"text":"type InReturnInTypeAlias<R> = fn() -> impl Debug;","highlight_start":39,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:170:39\n   |\nLL | type InReturnInTypeAlias<R> = fn() -> impl Debug;\n   |                                       ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6048,"byte_end":6058,"line_start":174,"line_end":174,"column_start":16,"column_end":26,"is_primary":true,"text":[{"text":"impl PartialEq<impl Debug> for () {","highlight_start":16,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:174:16\n   |\nLL | impl PartialEq<impl Debug> for () {\n   |                ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6218,"byte_end":6228,"line_start":179,"line_end":179,"column_start":24,"column_end":34,"is_primary":true,"text":[{"text":"impl PartialEq<()> for impl Debug {","highlight_start":24,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:179:24\n   |\nLL | impl PartialEq<()> for impl Debug {\n   |                        ^^^^^^^^^^\n\n"}
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC ------------------------------------------
[00:48:08] thread '[ui] ui/impl-trait/where-allowed.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3196:9
[00:48:08] 
[00:48:08] ---- [ui] ui/issues/issue-47715.rs stdout ----
[00:48:08] diff of stderr:
[00:48:08] diff of stderr:
[00:48:08] 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 3    |
[00:48:08] 3    |
[00:48:08] 4 LL | struct Container<T: Iterable<Item = impl Foo>> {
[00:48:08] 5    |                                     ^^^^^^^^
[00:48:08] 6 
[00:48:08] 6 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 9    |
[00:48:08] 9    |
[00:48:08] 10 LL | enum Enum<T: Iterable<Item = impl Foo>> {
[00:48:08] 11    |                              ^^^^^^^^
[00:48:08] 12 
[00:48:08] 12 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 15    |
[00:48:08] 15    |
[00:48:08] 16 LL | union Union<T: Iterable<Item = impl Foo> + Copy> {
[00:48:08] 17    |                                ^^^^^^^^
[00:48:08] 18 
[00:48:08] 18 
[00:48:08] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:48:08] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:48:08] 21    |
[00:48:08] 21    |
[00:48:08] 22 LL | type Type<T: Iterable<Item = impl Foo>> = T;
[00:48:08] 
[00:48:08] The actual stderr differed from the expected stderr.
[00:48:08] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/issue-47715.stderr
[00:48:08] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/issue-47715.stderr
[00:48:08] To update references, rerun the tests and pass the `--bless` flag
[00:48:08] To only update this specific test, also pass `--test-args issues/issue-47715.rs`
[00:48:08] error: 1 errors occurred comparing output.
[00:48:08] status: exit code: 1
[00:48:08] status: exit code: 1
[00:48:08] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-47715.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/auxiliary" "-A" "unused"
[00:48:08] ------------------------------------------
[00:48:08] 
[00:48:08] ------------------------------------------
[00:48:08] stderr:
[00:48:08] stderr:
[00:48:08] ------------------------------------------
[00:48:08] {"message":"`impl Trait` not allowed outside of function and inherente_start":585,"byte_end":606,"line_start":14,"line_end":14,"column_start":46,"column_end":67,"is_primary":false,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":46,"highlight_end":67}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":595,"byte_end":605,"line_start":14,"line_end":14,"column_start":56,"column_end":66,"is_primary":true,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":56,"highlight_end":66}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:14:56\n   |\nLL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }\n   |                                              ----------^^^^^^^^^^-\n   |                                              |         |\n   |                                              |         nested `impl Trait` here\n   |                                              outer `impl Trait`\n\n"}
[00:48:08] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":691,"byte_end":712,"line_start":17,"line_end":17,"column_start":32,"column_end":53,"is_primary":false,"text":[{"text":"fn bad_in_fn_syntax(x: fn() -> impl Into<impl De[00:48:08] +    = note: the return type of a function must have a statically known size
[00:48:08] + error: aborting due to 19 previous errors
[00:48:08] 174 
[00:48:08] 175 Some errors occurred: E0038, E0223, E0277, E0599, E0624.
[00:48:08] 176 For more information about an error, try `rustc --explain E0038`.
[00:48:08] 176 For more information about an error, try `rustc --explain E0038`.
[00:48:08] 
[00:48:08] 
[00:48:08] The actual stderr differed from the expected stderr.
[00:48:08] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/trait-item-privacy.stderr
[00:48:08] To update references, rerun the tests and pass the `--bless` flag
[00:48:08] To only update this specific test, also pass `--test-args traits/trait-item-privacy.rs`
[00:48:08] error: 1 errors occurred comparing output.
[00:48:08] status: exit code: 1
[00:48:08] status: exit code: 1
[00:48:08] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-item-privacy.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/auxiliary" "-A" "unused"
[00:48:08] ------------------------------------------
[00:48:08] 
[00:48:08] ------------------------------------------
[00:48:08] stderr:
[00:48:08] stderr:
[00:48:08] ------------------------------------------
[00:48:08] {"message":"no method named `a` und for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2522,"byte_end":2526,"line_start":107,"line_end":107,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope","highlight_start":5,"highlight_end":9}],"label":"associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `A`, perhaps you need to implement it:\ncandidate #1: `assoc_const::A`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no associated item named `A` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:107:5\n   |\nLL | struct S;\n   | --------- associated item `A` not found for this\n...\nLL |     S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope\n   |     ^^^^ associated item not found in `S`\n   |\n   = help: items from traits can only be used if the trait is implemented and in scope\n   = note: the following trait defines an item `A`, perhaps you need to implement it:\n           candidate #1: `assoc_const::A`\n\n"}
[00:48:08] {"message":"no associated item named `B` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"associated item `B` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2611,"byte_end":2615,"line_start":108,"line_end":108,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope","highlight_start":5,"highlight_end":9}],"label":"associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":506,"line_start":13,"line_end":13,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"struct S;","highlight_stnst::C` cannot be made into an object\n   |     ^^^^ the trait `assoc_const::B` is not implemented for `dyn assoc_const::C`\n   |\nnote: required by `assoc_const::B::B`\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:39:9\n   |\nLL |         const B: u8 = 0;\n   |         ^^^^^^^^^^^^^^^^\n\n"}
[00:48:08] {"message":"the trait `assoc_const::C` cannot be made into an object","code":{"code":"E0038","explanation":"\nTrait objects like `Box<Trait>` can only be constructed when certain\nrequirements are satisfied by the trait in question.\n\nTrait objects are a form of dynamic dispatch and use a dynamically sized type\nfor the inner type. So, for a given trait `Trait`, when `Trait` is treated as a\ntype, as in `Box<Trait>`, the inner type is 'unsized'. In such cases the boxed\npointer is a 'fat pointer' that contains an extra pointer to a table of methods\n(among other things) for dynamic dispatch. This design mandates some\nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\checkout/src/test/ui/traits/trait-item-privacy.rs:127:12\n   |\nLL |     let _: S::A; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::A`\n\n"}
[00:48:08] {"message":"ambiguous associated type","code":{"code":"E0223","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0223\ntrait MyTrait {type X; }\n\nfn main() {\n    let foo: MyTrait::X;\n}\n```\n\nThe problem here is that we're attempting to take the type of X from MyTrait.\nUnfortunately, the type of X is not defined, because it's only made concrete in\nimplementations of the trait. A working version of this code might look like:\n\n```\ntrait MyTrait {type X; }\nstruct MyStruct;\n\nimpl MyTrait for MyStruct {\n    type X = u32;\n}\n\nfn main() {\n    let foo: <MyStruct as MyTrait>::X;\n}\n```\n\nThis syntax specifies that we want the X type from MyTrait, as made concrete in\nMyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct\nmight implement two different traits with identically-named associated types.\nThis syntax allows disambiguation between the two.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3538,"byte_end":3542,"line_start":128,"line_end":128,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: S::B; //~ ERROR ambiguous associated type","highlight_start":12,"highlight_end":16}],"label":"ambiguous associated type","suggested_replacement":null,"suggestion_applicability":nulject-macro-matcher.rs:18:8
[00:48:08] +    |
[00:48:08] + LL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object
[00:48:08] +    |
[00:48:08] +    |
[00:48:08] +    = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`
[00:48:08] +    = note: the return type of a function must have a statically known size
[00:48:08] + 
[00:48:08] + 
[00:48:08] + error[E0277]: the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time
[00:48:08] +   --> $DIR/trait-object-macro-matcher.rs:19:8
[00:48:08] +    |
[00:48:08] + LL |     m!('static + Send);
[00:48:08] +    |
[00:48:08] +    |
[00:48:08] +    = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Send + 'static)`
[00:48:08] +    = note: the return type of a function must have a statically known size
[00:48:08] + 
[00:48:08] + 
[00:48:08] 7 error[E0038]: the trait `std::marker::Copy` cannot be made into an object
[00:48:08] 9    |
[00:48:08] 
[00:48:08] 12    |
[00:48:08] 12    |
[00:48:08] 13    = note: the trait cannot require that `Self : Sized`
[00:48:08] - error: aborting due to 2 previous errors
[00:48:08] + error: aborting due to 4 previous errors
[00:48:08] 16 
[00:48:08] - Some errors occurred: E0038, E0224.
[00:48:08] - Some errors occurred: E0038, E0224.
[00:48:08] + Some errors occurred: E0038, E0224, E0277.
[00:48:08] 18 For more information about an error, try `rustc --explain E0038`.
[00:48:08] 19 
[00:48:08] 
[00:48:08] 
[00:48:08] The actual stderr differed from the expected stderr.
[00:48:08] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/trait-object-macro-matcher.stderr
[00:48:08] To update references, rerun the tests and pass the `--bless` flag
[00:48:08] To only update this specific test, also pass `--test-args traits/trait-object-macro-matcher.rs`
[00:48:08] error: 1 errors occurred comparing output.
[00:48:08] status: exit code: 1
[00:48:08] status: exit code: 1
[00:48:08] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-object-macro-matcher.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/auxiliary" "-A" "unused"
[00:48:08] ------------------------------------------
[00:48:08] 
[00:48:08] ------------------------------------------
[00:48:08] stderr:
[00:48:08] stderr:
nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the following:\n\n```\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nimpl Trait for String {\n    fn foo(&self) -> Self {\n        \"hi\".to_owned()\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) -> Self {\n        1\n    }\n}\n```\n\n(Note that `&self` and `&mut self` are okay, it's additional `Self` types which\ncause this problem.)\n\nIn such a case, the compiler cannot predict the return type of `foo()` in a\nsituation like the following:\n\n```compile_fail\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nfn call_foo(x: Box<Trait>) {\n    let y = x.foo(); // What type is y?\n    // ...\n}\n```\n\nIf only some methods aren't obj8] + LL |     let y: X;
[00:48:08] +    |            ^ doesn't have a size known at compile-time
[00:48:08] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:48:08] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:48:08] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:48:08] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:48:08] +    = note: the return type of a function must have a statically known size
[00:48:08] + 
[00:48:08] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:48:08] 37    |
[00:48:08] 37    |
[00:48:08] 38 LL |     let y: X;
[00:48:08] 
[00:48:08] 56    = note: only the last element of a tuple may have a dynamically sized type
[00:48:08] 58 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:48:08] +   --> $DIR/unsized6.rs:32:12
[00:48:08] +    |
[00:48:08] +    |
[00:48:08] + LL |     let y: X = *x1;
[00:48:08] +    |            ^ doesn't have a size known at compile-time
[00:48:08] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:48:08] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:48:08] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:48:08] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:48:08] +    = note: the return type of a function must have a statically known size
[00:48:08] + 
[00:48:08] + error[E0277]: the size for values of type `X` cannot the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":726,"byte_end":727,"line_start":19,"line_end":19,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y: Y;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Y`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where Y: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `Y` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:19:9\n   |\nLL |     let y: Y;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `Y`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where Y: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:48:08] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implementzed-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:25:12\n   |\nLL |     let y: X;\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: the return type of a function must have a statically known size\n\n"}
[00:48:08] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfk/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:48:08] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implementrust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:40:9\n   |\nLL |     let y: X = *x1;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:48:08] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an ots the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1615,"byte_end":1616,"line_start":50,"line_end":50,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"fn g2<X: ?Sized + T>(x: X) {}","highlight_start":22,"highlight_end":23}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:50:22\n   |\nLL | fn g2<X: ?Sized + T>(x: X) {}\n   |                      ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable 

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@oli-obk
Copy link
Contributor

oli-obk commented Aug 30, 2018

I think the error you were getting was related to the initializer value of x. Applying your fix seems correct. (Though add some tests ensuring that let y: i32 = x; doesn't work)

@oli-obk
Copy link
Contributor

oli-obk commented Aug 30, 2018

also: your rebase has gone very wrong

@alexreg
Copy link
Contributor Author

alexreg commented Sep 3, 2018

@oli-obk @eddyb Been wrangling with this over the weekend, and no look fixing the transparency of the binding's type. Latest code is pushed. Could you provide some direction please? The more explicit, the better!

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:45:29] .........i.......i..................................................................................
[00:45:32] .......................ii.iii.......................................................................
[00:45:35] ....................................................................................................
[00:45:37] ....................................................................................................
[00:45:39] ............................................................................................F.......
[00:45:44] ....................................................................................................
[00:45:47] .........i..................................................................i.......................
[00:45:47] .........i..................................................................i.......................
[00:45:50] ................................................................F...................................
[00:45:55] ............................................................i.......................................
[00:45:58] ....................................................................................................
[00:46:01] ....................................................................................................
[00:46:04] ....................................................................................................
[00:46:04] ....................................................................................................
[00:46:07] ....................................................................................................
[00:46:10] ....................................................................................................
[00:46:13] .......................F............................................................................
[00:46:19] ....................................................................................................
[00:46:22] .....................................................i..............................................
[00:46:25] ....................................................................................................
[00:46:25] ....................................................................................................
[00:46:28] ...i.i..ii..........................................F...............................................
[00:46:34] ...........i........................................................................................
[00:46:37] ....................................................................................................
[00:46:40] ....................................................................................................
[00:46:43] ....................................................................................................
[00:46:43] ....................................................................................................
[00:46:46] ...........................................i........................................................
[00:46:49] ....................................................................................................
[00:46:52] ....................................................................................................
[00:46:56] ..............................................................................i.....................
[00:46:59] ...........................FF.......................................................................
[00:47:02] ....................................................................................................
[00:47:05] ........................................................F...........................................
ete_type/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] ------------------------------------------
[00:47:07] stderr:
[00:47:07] stderr:
[00:47:07] ------------------------------------------
[00:47:07] {"message":"cycle detected when processing `Foo`","code":{"code":"E0391","explanation":"\nThis error indicates that some types or traits depend on each other\nand therefore cannot be constructed.\n\nThe following example contains a circular dependency between two traits:\n\n```compile_fail,E0391\ntrait FirstTrait : SecondTrait {\n\n}\n\ntrait SecondTrait : FirstTrait {\n\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs","byte_start":698,"byte_end":725,"line_start":16,"line_end":16,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"existential type Foo: Copy; //~ cycle detected","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"...which requires processing `bar`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs","byte_start":809,"byte_end":814,"line_start":19,"line_end":19,"column_start":23,"column_end":28,"is_primary":true,"text":[{"text":"fn bar(x: Foo) -> Foo { x }","highlight_start":23,"highlight_end":28}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which again requires processing `Foo`, completing the cycle","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0391]: cycle detected when processing `Foo`\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:16:1\n   |\nLL | existential type Foo: Copy; //~ cycle detected\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\nnote: ...which requires processing `bar`...\n  --> /checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs:19:23\n   |\nLL | fn bar(x: Foo) -> Foo { x }\n   |                       ^^^^^\n   = note: ...which again requires processing `Foo`, completing the cycle\n\n"}
[00:47:07] {"message":"defining existential type use differs from previous","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs","byte_start":816,"byte_end":872,"line_start":21,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":12},{"text":"    let _: Foo = std::mem::transmute(0u8);","highlight_start":1,"highlight_end":43},{"text":"}","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"previous use here","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/existential_types/no_inferrable_concrete_type.rs","byte_start":787,"byte_end":814,"line_start":19,"line_end":19,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"fn bar(x: Foo) -> Foo { x }","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":null,"suggestion_applicab`impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 20   --> $DIR/where-allowed.rs:28:40
[00:47:07] 21    |
[00:47:07] 22 LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
[00:47:07] 23    |                                        ^^^^^^^^^^
[00:47:07] 24 
[00:47:07] 24 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 26   --> $DIR/where-allowed.rs:32:42
[00:47:07] 27    |
[00:47:07] 28 LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
[00:47:07] 29    |                                          ^^^^^^^^^^
[00:47:07] 30 
[00:47:07] 30 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 32   --> $DIR/where-allowed.rs:36:38
[00:47:07] 33    |
[00:47:07] 34 LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
[00:47:07] 35    |                                      ^^^^^^^^^^
[00:47:07] 36 
[00:47:07] 36 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 38   --> $DIR/where-allowed.rs:40:40
[00:47:07] 39    |
[00:47:07] 40 LL | fn in_fn_return_in_return() -> fn() -> impl Dnd inherent method return types or bindings
[00:47:07] 80   --> $DIR/where-allowed.rs:69:57
[00:47:07] 81    |
[00:47:07] 82 LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
[00:47:07] 83    |                                                         ^^^^^^^^^^
[00:47:07] 84 
[00:47:07] 84 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 86   --> $DIR/where-allowed.rs:74:59
[00:47:07] 87    |
[00:47:07] 88 LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
[00:47:07] 89    |                                                           ^^^^^^^^^^
[00:47:07] 90 
[00:47:07] 90 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 92   --> $DIR/where-allowed.rs:78:38
[00:47:07] 93    |
[00:47:07] 94 LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
[00:47:07] 95    |                                      ^^^^^^^^^^
[00:47:07] 96 
[00:47:07] 96 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 98   --> $DIR/where-allowed.rs:82:40
[00:47:07] 99    |
[00:47:07] 100 LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
[00:47:07] 101    |                                        ^^^^^^^^^^
[00:47:07] 102 
[00:47:07] 102 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 104   --> $DIR/where-allowed.rs:95:32
[00:47:07] 105    |
[00:47:07] 106 LL | struct InBraceStructField { x: impl Debug }
[00:47:07] 107    |                                ^^^^^^^^^^
[00:47:07] 108 
[00:47:07] 108 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 110   --> $DIR/where-allowed.rs:99:41
[00:47:07] 111    |
[00:47:07] 112 LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
[00:47:07] 113    |                                         ^^^^^^^^^^
[00:47:07] 114 
[00:47:07] 114 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 116   --> $DIR/where-allowed.rs:103:27
[00:47:07] 117    |
[00:47:07] 118 LL | struct InTupleStructField(impl Debug);
[00:47:07] 119    |                           ^^^^^^^^^^
[00:47:07] 120 
[00:47:07] 120 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 122   --> $DIR/where-allowed.rs:108:25
[00:47:07] 123    |
[00:47:07] 124 LL |     InBraceVariant { x: impl Debug },
[00:47:07] 125    |                         ^^^^^^^^^^
[00:47:07] 126 
[00:47:07] 126 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 128   --> $DIR/where-allowed.rs:110:20
[00:47:07] 129    |
[00:47:07] 130 LL |     InTupleVariant(impl Debug),
[00:47:07] 131    |                    ^^^^^^^^^^
[00:47:07] 132 
[00:47:07] 132 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 134   --> $DIR/where-allowed.rs:121:23
[00:47:07] 135    |
[00:47:07] 136 LL |     fn in_return() -> impl Debug;
[00:47:07] 137    |                       ^^^^^^^^^^
[00:47:07] 138 
[00:47:07] 138 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 140   --> $DIR/where-allowed.rs:132:16
[00:47:07] 141    |
[00:47:07] 142 LL |     type Out = impl Debug;
[00:47:07] 143    |                ^^^^^^^^^^
[00:47:07] 144 
[00:47:07] 144 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 146   --> $DIR/where-allowed.rs:138:34
[00:47:07] 147    |
[00:47:07] 148 LL |     fn in_trait_impl_return() -> impl Debug { () }
[00:47:07] 149    |                                  ^^^^^^^^^^
[00:47:07] 150 
[00:47:07] 150 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 152   --> $DIR/where-allowed.rs:151:33
[00:47:07] 153    |
[00:47:07] 154 LL |     fn in_foreign_parameters(_: impl Debug);
[00:47:07] 155    |                                 ^^^^^^^^^^
[00:47:07] 156 
[00:47:07] 156 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 158   --> $DIR/where-allowed.rs:154:31
[00:47:07] 159    |
[00:47:07] 160 LL |     fn in_foreign_return() -> impl Debug;
[00:47:07] 161    |                               ^^^^^^^^^^
[00:47:07] 162 
[00:47:07] 162 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 164   --> $DIR/where-allowed.rs:167:23
[00:47:07] 165    |
[00:47:07] 166 LL | type InTypeAlias<R>    --> $DIR/where-allowed.rs:232:46
[00:47:07] 237    |
[00:47:07] 238 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
[00:47:07] 239    |                                              ^^^^^^^^^
[00:47:07] 240 
[00:47:07] - error: aborting due to 39 previous errors
[00:47:07] + error: aborting due to 38 previous errors
[00:47:07] + error: aborting due to 38 previous errors
[00:47:07] 242 
[00:47:07] 243 Some errors occurred: E0562, E0666.
[00:47:07] 244 For more information about an error, try `rustc --explain E0562`.
[00:47:07] 
[00:47:07] 
[00:47:07] The actual stderr differed from the expected stderr.
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/where-allowed/where-allowed.stderr
[00:47:07] To update references, rerun the tests and pass the `--bless` flag
[00:47:07] To only update this specific test, also pass `--test-args impl-trait/where-allowed.rs`
[00:47:07] error: 1 errors occurred comparing output.
[00:47:07] status: exit code: 1
[00:47:07] status: exit code: 1
[00:47:07] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/where-allowed.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/where-allowed/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/where-allowed/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] ------------------------------------------
[00:47:07] stderr:
[00:47:07] stderr:
[00:47:07] ------------------------------------------
[00:47:07] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2268,"byte_end":2287,"line_start":60,"line_end":60,"column_start":43,"column_end":62,"is_primary":false,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":43,"highlight_end":62}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2276,"byte_end":2286,"line_start":60,"line_end":60,"column_start":51,"column_end":61,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":51,"highlight_end":61}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:60:51\n   |\nLL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }\n   |                                           --------^^^^^^^^^^-\n   |                                           |       |\n   |                                           |       nested `impl Trait` here\n   |                                           outer `impl Trait`\n\n"}
[00:47:07] {"message":"nested `iAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":869,"byte_end":879,"line_start":28,"line_end":28,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:28:40\n   |\nLL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }\n   |                                        ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not eckout/src/test/ui/impl-trait/where-allowed.rs:36:38\n   |\nLL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }\n   |                                      ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1374,"byte_end":1384,"line_start":40,"line_end":40,"column_start":40,"column_end":50,"is_primary":true,"text":[{"text":"fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }","highlight_start":40,"highlight_end":50}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:40:40\n   |\nLL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }\n   |                                        ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":1550,"byte_end":1560,"line_start":44,"line_end":44,"column_start":49,"column_end":59,"is_primary":true,"text":[{"text":"fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }","highlight_start":49,"highlight_end":59}],"y":true,"text":[{"text":"fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }","highlight_start":51,"highlight_end":61}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:48:51\n   |\nLL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }\n   |                                                   ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/srerator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2276,"byte_end":2286,"line_start":60,"line_end":60,"column_start":51,"column_end":61,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }","highlight_start":51,"highlight_end":61}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:60:51\n   |\nLL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }\n   |                                                   ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2505,"byte_end":2515,"line_start":65,"line_end":65,"column_start":53,"column_end":63,"is_primary":true,"text":[{"text":"fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }","highlight_start":53,"highlight_end":63}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:65:53\n   |\nLL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }\n   |                                                     ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2690,"byte_end":2700,"line_start":69,"line_end":69,"column_start":57,"column_end":67,"is_primary":true,"text":[{"text":"fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }","highlight_start":57,"highlight_end":67}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:69:57\n   |\nLL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }\n   |                                                         ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":2924,"byte_end":2934,"line_start":74,"line_end":74,"column_start":59,"column_end":69,"is_primary":true,"text":[{"text":"fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }","highlight_start":59,"highlight_end":69}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:74:59\n   |\nLL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }\n   |                                                           ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bplacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:103:27\n   |\nLL | struct InTupleStructField(impl Debug);\n   |                           ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4124,"byte_end":4134,"line_start":108,"line_end":108,"column_start":25,"column_end":35,"is_primary":true,"text":[{"text":"    InBraceVariant { x: impl Debug },","highlight_start":25,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:108:25\n   |\nLL |     InBraceVariant { x: impl Debug },\n   |                         ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4250,"byte_end":4260,"line_start":110,"line_end":110,"column_start":20,"column_end":30,"is_primary":true,"text":[{"text":"    imary":true,"text":[{"text":"    fn in_return() -> impl Debug;","highlight_start":23,"highlight_end":33}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:121:23\n   |\nLL |     fn in_return() -> impl Debug;\n   |                       ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":4817,"byte_end":4827,"line_start":132,"line_end":132,/test/ui/impl-trait/where-allowed.rs","byte_start":5352,"byte_end":5362,"line_start":151,"line_end":151,"column_start":33,"column_end":43,"is_primary":true,"text":[{"text":"    fn in_foreign_parameters(_: impl Debug);","highlight_start":33,"highlight_end":43}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:151:33\n   |\nLL |     fn in_foreign_parameters(_: impl Debug);\n   |                                 ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5489,"byte_end":5499,"line_start":154,"line_end":154,"column_start":31,"column_end":41,"is_primary":true,"text":[{"text":"    fn in_foreign_return() -> impl Debug;","highlight_start":31,"highlight_end":41}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:154:31\n   |\nLL |     fn in_foreign_return() -> impl Debug;\n   |                               ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: htt22] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":5901,"byte_end":5911,"line_start":170,"line_end":170,"column_start":39,"column_end":49,"is_primary":true,"text":[{"text":"type InReturnInTypeAlias<R> = fn() -> impl Debug;","highlight_start":39,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:170:39\n   |\nLL | type InReturnInTypeAlias<R> = fn() -> impl Debug;\n   |                                       ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6364,"byte_end":6374,"line_start":184,"line_end":184,"column_start":6,"column_end":16,"is_primary":true,"text":[{"text":"impl impl Debug {","highlight_start":6,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:184:6\n   |\nLL | impl impl Debug {\n   |      ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6565,"byte_end":6575,"line_start":190,"line_end":190,"column_start":24,"column_end":34,"is_primary":true,"text":[{"text":"impl InInherentImplAdt<impl Debug> {","highlight_start":24,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:190:24\n   |\nLL | impl InInherentImplAdt<impl Debug> {\n   |                        ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6740,"byte_end":6750,"line_start":196,"line_end":196,"column_start":11,"column_end":21,"is_primary":true,"text":[{"text":"    where impl Debug: Debug","highlight_start":11,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:196:11\n   |\nLL |     where impl Debug: Debug\n   |           ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/impl-trait/where-allowed.rs","byte_start":6928,"byte_end":6938,"line_start":203,"line_end":203,"column_start":15,"column_end":25,"is_primary":true,"text":[{"text":"    where Vec<impl Debug>: Debug","highlight_start":15,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/impl-trait/where-allowed.rs:203:15\n   |\nLL |     where Vec<impl Debug>: Debug\n   |               ^^^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only  16 LL | union Union<T: Iterable<Item = impl Foo> + Copy> {
[00:47:07] 17    |                                ^^^^^^^^
[00:47:07] 18 
[00:47:07] 18 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 21    |
[00:47:07] 21    |
[00:47:07] 22 LL | type Type<T: Iterable<Item = impl Foo>> = T;
[00:47:07] 
[00:47:07] The actual stderr differed from the expected stderr.
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/issue-47715.stderr
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/issue-47715.stderr
[00:47:07] To update references, rerun the tests and pass the `--bless` flag
[00:47:07] To only update this specific test, also pass `--test-args issues/issue-47715.rs`
[00:47:07] error: 1 errors occurred comparing output.
[00:47:07] status: exit code: 1
[00:47:07] status: exit code: 1
[00:47:07] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-47715.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-47715/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] ------------------------------------------
[00:47:07] stderr:
[00:47:07] stderr:
[00:47:07] ------------------------------------------
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-47715.rs","byte_start":569,"byte_end":577,"line_start":19,"line_end":19,"column_start":37,"column_end":45,"is_primary":true,"text":[{"text":"struct Container<T: Iterable<Item = impl Foo>> {","highlight_start":37,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/tent method return types or bindings\n  --> /checkout/src/test/ui/issues/issue-47715.rs:24:30\n   |\nLL | enum Enum<T: Iterable<Item = impl Foo>> {\n   |                              ^^^^^^^^\n\n"}
[00:47:07] {"message":"`impl Trait` not allowed outside of function and inherent method return types or bindings","code":{"code":"E0562","explanation":"\nAbstract return types (written `impl Trait` for some trait `Trait`) are only\nallowed as function and inherent impl return types or binding types.\n\nErroneous code example:\n\n```compile_fail,E0562\nfn main() {\n    let count_to_ten: impl Iterator<Item=usize> = 0..10;\n    // error: `impl Trait` not allowed outside of function and inherent method\n    //        return types\n    for i in count_to_ten {\n        println!(\"{}\", i);\n    }\n}\n```\n\nMake sure `impl Trait` only appears in return-type position or as the type of a\nbinding.\n\n```\nfn count_to_n(n: usize) -> impl Iterator<Item=usize> {\n    0..n\n}\n\nfn main() {\n    for i in count_to_n(10) {  // ok!\n        println!(\"{}\", i);\n    }\n}\n```\n\nSee [RFC 1522] for more details.\n\n[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-47715.rs","byte_start":764,"byte_end":772,"line_start":29,"line_end":29,"column_start":32,"column_end":40,"is_primary":true,"text":[{"text":"union Union<T: Iterable<Item = impl Foo> + Copy> {","highlight_start":32,"highlight_end":40}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `^^^
[00:47:07] 42 
[00:47:07] - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
[00:47:07] + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings
[00:47:07] 45    |
[00:47:07] 45    |
[00:47:07] 46 LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {
[00:47:07] 
[00:47:07] The actual stderr differed from the expected stderr.
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/nested_impl_trait.stderr
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/nested_impl_trait.stderr
[00:47:07] To update references, rerun the tests and pass the `--bless` flag
[00:47:07] To only update this specific test, also pass `--test-args nested_impl_trait.rs`
[00:47:07] error: 1 errors occurred comparing output.
[00:47:07] status: exit code: 1
[00:47:07] status: exit code: 1
[00:47:07] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nested_impl_trait.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nested_impl_trait/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] ------------------------------------------
[00:47:07] stderr:
[00:47:07] stderr:
[00:47:07] ------------------------------------------
[00:47:07] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":585,"byte_end":606,"line_start":14,"line_end":14,"column_start":46,"column_end":67,"is_primary":false,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":46,"highlight_end":67}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":595,"byte_end":605,"line_start":14,"line_end":14,"column_start":56,"column_end":66,"is_primary":true,"text":[{"text":"fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":56,"highlight_end":66}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:14:56\n   |\nLL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }\n   |                                              ----------^^^^^^^^^^-\n   |                                              |         |\n   |                                              |         nested `impl Trait` here\n   |                                              outer `impl Trait`\n\n"}
[00:47:07] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start"tion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":831,"byte_end":841,"line_start":21,"line_end":21,"column_start":37,"column_end":47,"is_primary":true,"text":[{"text":"fn bad_in_arg_position(_: impl Into<impl Debug>) { }","highlight_start":37,"highlight_end":47}],"label":"nested `impl Trait` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0666]: nested `impl Trait` is not allowed\n  --> /checkout/src/test/ui/nested_impl_trait.rs:21:37\n   |\nLL | fn bad_in_arg_position(_: impl Into<impl Debug>) { }\n   |                           ----------^^^^^^^^^^-\n   |                           |         |\n   |                           |         nested `impl Trait` here\n   |                           outer `impl Trait`\n\n"}
[00:47:07] {"message":"nested `impl Trait` is not allowed","code":{"code":"E0666","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":947,"byte_end":968,"line_start":26,"line_end":26,"column_start":34,"column_end":55,"is_primary":false,"text":[{"text":"    fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_start":34,"highlight_end":55}],"label":"outer `impl Trait`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":957,"byte_end":967,"line_start":26,"line_end":26,"column_start":44,"column_end":54,"is_primary":true,"text":[{"text":"    fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }","highlight_aster/text/1522-conservative-impl-trait.md\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/nested_impl_trait.rs","byte_start":1176,"byte_end":1190,"line_start":34,"line_end":34,"column_start":42,"column_end":56,"is_primary":true,"text":[{"text":"fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {","highlight_start":42,"highlight_end":56}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0562]: `impl Trait` not allowed outside of function and inherent method return types or bindings\n  --> /checkout/src/test/ui/nested_impl_trait.rs:34:42\n   |\nLL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {\n   |                                          ^^^^^^^^^^^^^^\n\n"}
[00:47:07] {"message":"aborting due to 6 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 6 previous errors\n\n"}
[00:47:07] {"message":"Some errors occurred: E0562, E0666.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0562, E0666.\n"}
[00:47:07] {"message":"For more information about an error, try `rustc --explain E0562`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0562`.\n"}
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] thread '[ui] ui/nested_impl_trait.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3196:9
[00:47:07] 
[00:47:07] 
[00:47:07] ---- [ui] ui/traits/trait-item-privacy.rs stdout ----
[00:47:07] diff of stderr:
[00:47:07] 
[00:47:07] 170 LL |         A = u8, //~ ERROR associated type `A` is private
[00:47:07] 172 
[00:47:07] - error: aborting due to 17 previous errors
[00:47:07] - error: aborting due to 17 previous errors
[00:47:07] + error[E0277]: the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time
[00:47:07] +   --> $DIR/trait-item-privacy.rs:136:12
[00:47:07] +    |
[00:47:07] + LL |       let _: assoc_ty::B<
[00:47:07] +    |  ____________^
[00:47:07] + LL | |         B = u8, // OK
[00:47:07] + LL | |     >;
[00:47:07] +    | |_____^ doesn't have a size known at compile-time
[00:47:07] +    |
[00:47:07] +    = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`
[00:47:07] +    = note: the return type of a function must have a statically known size
[00:47:07] + 
[00:47:07] + 
[00:47:07] + error[E0277]: the size for values of type `dyn assoc_ty::C<C=u8, B=u8, A=u8>` cannot be known at compilation time
[00:47:07] +   --> $DIR/trait-item-privacy.rs:139:12
[00:47:07] +    |
[00:47:07] + LL |       let _: C<
[00:47:07] +    |  ____________^
[00:47:07] + LL | |         A = u8, //~ ERROR associated type `A` is private
[00:47:07] + LL | |         B = u8, // OK
[00:47:07] + LL | |         C = u8, // OK
[00:47:07] + LL | |     >;
[00:47:07] +    | |_____^ doesn't have a size known at compile-time
[00:47:07] +    |
[00:47:07] +    = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::C<C=u8, B=u8, A=u8>`
[00:47:07] +    = note: the return type of a function must have a statically known size
[00:47:07] + 
[00:47:07] + error: aborting due to 19 previous errors
[00:47:07] 174 
[00:47:07] 174 
[00:47:07] 175 Some errors occurred: E0038, E0223, E0277, E0599, E0624.
[00:47:07] 176 For more information about an error, try `rustc --explain E0038`.
[00:47:07] 
[00:47:07] 
[00:47:07] The actual stderr differed from the expected stderr.
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/trait-item-privacy.stderr
[00:47:07] To update references, rerun the tests and pass the `--bless` flag
[00:47:07] To only update this specific test, also pass `--test-args traits/trait-item-privacy.rs`
[00:47:07] error: 1 errors occurred comparing output.
[00:47:07] status: exit code: 1
[00:47:07] status: exit code: 1
[00:47:07] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-item-privacy.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-item-privacy/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] ------------------------------------------
[00:47:07] stderr:
[00:47:07] stderr:
[00:47:07] ------------------------------------------
[00:47:07] {"message":"no method named `a` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"method `a` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":1449,"byte_end":1450,"line_start":77,"line_end":77,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":"    S.a(); //~ ERROR no method named `a` found for type `S` in the current scope","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait defines an item `a`, perhaps you need to implement it:\ncandidate #1: `method::A`","code":null,"levelge":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":506,"line_start":13,"line_end":13,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use method::B;\n\n","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no function or associated item named `b` found for type `S` in the current scope\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:90:5\n   |\nLL | struct S;\n   | --------- function or associated item `b` not found for this\n...\nLL |     S::b(&S);\n   |     ^^^^ function or associated item not found in `S`\n   |\n   = help: items from traits can only be used if the trait is in scope\nhelp: the following trait is implemented but not in scope, perhaps add a `use` for it:\n   |\nLL | use method::B;\n   |\n\n"}
[00:47:07] {"message":"method `a` is private","code":{"code":"E0624","explanation":"\nA private item was used outside of its scope.\n\nErroneous code example:\n\n```compile_fail,E0624\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // error: method `method` is private\n```\n\nTwo possibilities are available to solve this issue:\n\n1. Only use the item in the scope it has been defined:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        fn method(&self) {}\n    }\n\n    pub fn call_method(foo: &Foo) { // We create a public function.\n        foo.method(); // Which calls the item.\n    }\n}\n\nlet foo = inner::Foo;\ninner::call_method(&foo); // And since the function is public, we can call the\n                          // method through it.\n```\n\n2. Make the item public:\n\n```\nmod inner {\n    pub struct Foo;\n\n    impl Foo {\n        pub fn method(&self) {} // It's now public.\n    }\n}\n\nlet foo = inner::Foo;\nfoo.method(); // Ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2194,"byte_end":2198,"line_start":94,"line_end":94,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::a(&S); //~ ERROR method `a` is private","highlight_start":5,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0624]: method `a` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:94:5\n   |\nLL |     C::a(&S); //~ ERROR method `a` is private\n   |     ^^^^\n\n"}
[00:47:07] {"message":"no associated item named `A` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"ldidate #1: `assoc_const::A`\n\n"}
[00:47:07] {"message":"no associated item named `B` found for type `S` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":506,"byte_end":515,"line_start":13,"line_end":13,"column_start":1,"column_end":10,"is_primary":false,"text":[{"text":"struct S;","highlight_start":1,"highlight_end":10}],"label":"associated item `B` not found for this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2611,"byte_end":2615,"line_start":108,"line_end":108,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope","highlight_start":5,"highlight_end":9}],"label":"associated item not found in `S`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is in scope","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the following trait is implemented but not in scope, perhaps add a `use` for it:","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-it trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":2802,"byte_end":2806,"line_start":111,"line_end":111,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::A; //~ ERROR associated constant `A` is private","highlight_start":5,"highlight_end":9}],"label":"the trait `assoc_const::A` is not implemented for `dyn assoc_const::C`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"required by `assoc_const::A::A`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":789,"byte_end":805,"line_start":35,"line_end":35,"column_start":9,"column_end":25,"is_primary":true,"text":[{"text":"        const A: u8 = 0;","highlight_start":9,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:111:5\n   |\nLL |     C::A; //~ ERROR associated constant `A` is private\n   |     ^^^^ the trait `assoc_const::A` is not implemented for `dyn assoc_const::C`\n   |\nnote: required by `assoc_const::A::A`\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:35:9\n   |\nLL |         const A: u8 = 0;\n   |         ^^^^^^^^^^^^^^^^\n\n"}
[00:47:07] {"message":"the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied","code":{"codees. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3026,"byte_end":3030,"line_start":114,"line_end":114,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":"    C::B; // ERROR the trait `assoc_const::C` cannot be made into an object","highlight_start":5,"highlight_end":9}],"label":"the trait `assoc_const::B` is not implemented for `dyn assoc_const::C`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"required by `assoc_const::B::B`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":839,"byte_end":855,"line_start":39,"line_end":39,"column_start":9,"column_end":25,"is_primary":true,"text":[{"text":"        const B: u8 = 0;","highlight_start":9,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound ollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the following:\n\n```\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nimpl Trait for String {\n    fn foo(&self) -> Self {\n        \"hi\".to_owned()\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) -> Self {\n        1\n    }\n}\n```\n\n(Note that `&self` and `&mut self` are okay, it's additional `Self` types which\ncause this problem.)\n\nIn such a case, the compiler cannot predict the return type of `foo()` in a\nsituation like the following:\n\n```compile_fail\ntrait Trait {\n    fn foo(&self) -> Self;\n}\n\nfn call_foo(x: Box<Trait>) {\n    let y = x.foo(); // What type is y?\n    // ...\n}\n```\n\nIf only some methods aren't object-safe, you can add a `where Self: Sized` bound\non them to mark them as explicitly unavailable to trait objects. The\nfunctionality will still be available to all other implementers, including\n`Box<Trait>` which is itself sized (assuming you `impl Trait for Box<Trait>`).\n\n```\ntrait Trait {\n    fn foo(&self) -> Self where Self: Sized;\n    // more functions\n}\n```\n\nNow, `foo()` can no longer be called on a trait object, but you will now be\nallowed to make a trait object, and that will be able to call any object-safe\nmethods. With such a bound, one can still call `foo()` on types implementing\nthat trait that aren't behind trait objects.\n\n### Method has generic type parameters\n\nAs mentioned before, trait objects contain pointers to method tables. So, if we\nhave:\n\n```\ntrait Trait {\n    fn foo(&self);\n}\n\nimpl Trait for String {\n    fn foo(&self) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo(&self) {\n        // implementation 2\n    }\n}\n// ...\n```\n\nAt compile time each implementation of `Trait` will produce a table containing\nthe various methods (and other items) related to the implementation.\n\nThis works fine, but when the method gains generic parameters, we can have a\nproblem.\n\nUsually, generic parameters get _monomorphized_. For example, if I have\n\n```\nfn foo<T>(x: T) {\n    // ...\n}\n```\n\nThe machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any\nother type substitution is different. Hence the compiler generates the\nimplementation on-demand. If you call `foo()` with a `bool` parameter, the\ncompiler will only generate code for `foo::<bool>()`. When we have additional\ntype parameters, the number of monomorphized implementations the compiler\ngenerates does not grow drastically, since the compiler will only generate an\nimplementation if the function is called with unparametrized substitutions\n(i.e., substitutions where none of the substituted types are themselves\nparametrized).\n\nHowever, with trait objects we have to make a table containing _every_ object\nthat implements the trait. Now, if it has type parameters, we need to add\nimplementations for every type that implements the trait, and there could\ntheoretically be an infinite number of types.\n\nFor example, with:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T);\n    // more methods\n}\n\nimpl Trait for String {\n    fn foo<T>(&self, on: T) {\n        // implementation 1\n    }\n}\n\nimpl Trait for u8 {\n    fn foo<T>(&self, on: T) {\n        // implementation 2\n    }\n}\n\n// 8 more implementations\n```\n\nNow, if we have the following code:\n\n```compile_fail,E0038\n# trait Trait { fn foo<T>(&self, on: T); }\n# impl Trait for String { fn foo<T>(&self, on: T) {} }\n# impl Trait for u8 { fn foo<T>(&self, on: T) {} }\n# impl Trait for bool { fn foo<T>(&self, on: T) {} }\n# // etc.\nfn call_foo(thing: Box<Trait>) {\n    thing.foo(true); // this could be any one of the 8 types above\n    thing.foo(1);\n    thing.foo(\"hello\");\n}\n```\n\nWe don't just need to create a table of all implementations of all methods of\n`Trait`, we need to create such a table, for each different type fed to\n`foo()`. In this case this turns out to be (10 types implementing `Trait`)*(3\ntypes being fed to `foo()`) = 30 implementations!\n\nWith real world traits these numbers can grow drastically.\n\nTo fix this, it is suggested to use a `where Self: Sized` bound similar to the\nfix for the sub-error above if you do not intend to call the method with type\nparameters:\n\n```\ntrait Trait {\n    fn foo<T>(&self, on: T) where Self: Sized;\n    // more methods\n}\n```\n\nIf this is not an option, consider replacing the type parameter with another\ntrait object (e.g. if `T: OtherTrait`, use `on: Box<OtherTrait>`). If the number\nof types you intend to feed to this method is limited, consider manually listing\nout the methods of different types.\n\n### Method has no receiver\n\nMethods that do not take a `self` parameter can't be called since there won't be\na way to get a pointer to the method table for them.\n\n```\ntrait Foo {\n    fn foo() -> u8;\n}\n```\n\nThis could be called as `<Foo as Foo>::foo()`, which would not be able to pick\nan implementation.\n\nAdding a `Self: Sized` bound to these methods will generally make this compile.\n\n```\ntrait Foo {\n    fn foo() -> u8 where Self: Sized;\n}\n```\n\n### The trait cannot contain associated constants\n\nJust like static functions, associated constants aren't stored on the method\ntable. If the trait or any subtrait contain an associated constant, they cannot\nbe made into an object.\n\n```compile_fail,E0038\ntrait Foo {\n    const X: i32;\n}\n\nimpl Foo {}\n```\n\nA simple workaround is to use a helper method instead:\n\n```\ntrait Foo {\n    fn x(&self) -> i32;\n}\n```\n\n### The trait cannot use `Self` as a type parameter in the supertrait listing\n\nThis is similar to the second sub-error, but subtler. It happens in situations\nlike the following:\n\n```compile_fail\ntrait Super<A> {}\n\ntrait Trait: Super<Self> {\n}\n\nstruct Foo;\n\nimpl Super<Foo> for Foo{}\n\nimpl Trait for Foo {}\n```\n\nHere, the supertrait might have methods as follows:\n\n```\ntrait Super<A> {\n    fn get_a(&self) -> A; // note that this is object safe!\n}\n```\n\nIf the trait `Foo` was deriving from something like `Super<String>` or\n`Super<T>` (where `Foo` itself is `Foo<T>`), this is okay, because given a type\n`get_a()` will definits":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3591,"byte_end":3595,"line_start":129,"line_end":129,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: S::C; //~ ERROR ambiguous associated type","highlight_start":12,"highlight_end":16}],"label":"ambiguous associated type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<S as Trait>::C`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:129:12\n   |\nLL |     let _: S::C; //~ ERROR ambiguous associated type\n   |            ^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<S as Trait>::C`\n\n"}
[00:47:07] {"message":"associated type `A` is private","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3730,"byte_end":3734,"line_start":131,"line_end":131,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":"    let _: T::A; //~ ERROR associated type `A` is private","highlight_start":12,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: associated type `A` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:131:12\n   |\nLL |     let _: T::A; //~ ERROR associated type `A` is private\n   |            ^^^^\n\n"}
[00:47:07] {"message":"associated type `A` is private","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-item-privacy.rs","byte_start":3933,"byte_end":3939,"line_start":140,"line_end":140,"column_start":9,"column_end":15,"is_primary":true,"text":[{"text":"        A = u8, //~ ERROR associated type `A` is private","highlight_start":9,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: associated type `A` is private\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:140:9\n   |\nLL |         A = u8, //~ ERROR associated type `A` is private\n   |         ^^^^^^\n\n"}
[00:47:07] {"message":"the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implemht_start":12,"highlight_end":24},{"text":"        B = u8, // OK","highlight_start":1,"highlight_end":22},{"text":"    >;","highlight_start":1,"highlight_end":6}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `dyn assoc_ty::B<B=u8>` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:136:12\n   |\nLL |       let _: assoc_ty::B<\n   |  ____________^\nLL | |         B = u8, // OK\nLL | |     >;\n   | |_____^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::B<B=u8>`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:07] {"message":"the size for values of type `dyn assoc_ty::C<C=u8, B=u8, A=u8>` cannot be known at compilation time","code":{"code":"E0277"es-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `dyn assoc_ty::C<C=u8, B=u8, A=u8>` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-item-privacy.rs:139:12\n   |\nLL |       let _: C<\n   |  ____________^\nLL | |         A = u8, //~ ERROR associated type `A` is private\nLL | |         B = u8, // OK\nLL | |         C = u8, // OK\nLL | |     >;\n   | |_____^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `dyn assoc_ty::C<C=u8, B=u8, A=u8>`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:07] {"message":"aborting due to 19 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 19 previous errors\n\n"}
[00:47:07] {"message":"Some errors occurred: E0038, E0223, E0277, E0599, E0624.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0038, E0223, E0277, E0599, E0624.\n"}
[00:47:07] {"message":"For more information about an error, try `rustc --explain E0038`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0038`.\n"}
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] thread '[ui] ui/traits/trait-item-privacy.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3196:9
[00:47:07] 
[00:47:07] 
[00:47:07] ---- [ui] ui/traits/trait-object-macro-matcher.rs stdout ----
[00:47:07] diff of stderr:
[00:47:07] 
[00:47:07] 4 LL |     m!('static +); //~ ERROR at least one non-builtin trait is required for an object type
[00:47:07] 6 
[00:47:07] 6 
[00:47:07] + error[E0277]: the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time
[00:47:07] +   --> $DIR/trait-object-macro-matcher.rs:18:8
[00:47:07] +    |
[00:47:07] + LL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object
[00:47:07] +    |
[00:47:07] +    |
[00:47:07] +    = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`
[00:47:07] +    = note: the return type of a function must have a statically known size
[00:47:07] + 
[00:47:07] + 
[00:47:07] + error[E0277]: the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time
[00:47:07] +   --> $DIR/trait-object-macro-matcher.rs:19:8
[00:47:07] +    |
[00:47:07] + LL |     m!('static + Send);
[00:47:07] +    |        ^^^^^^^^^^^^^^ doesn't have a size known at compile-ti/src/test/ui/traits/trait-object-macro-matcher.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-macro-matcher/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] ------------------------------------------
[00:47:07] stderr:
[00:47:07] stderr:
[00:47:07] ------------------------------------------
[00:47:07] {"message":"at least one non-builtin trait is required for an object type","code":{"code":"E0224","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":706,"byte_end":715,"line_start":20,"line_end":20,"column_start":8,"column_end":17,"is_primary":true,"text":[{"text":"    m!('static +); //~ ERROR at least one non-builtin trait is required for an object type","highlight_start":8,"highlight_end":17}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0224]: at least one non-builtin trait is required for an object type\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:20:8\n   |\nLL |     m!('static +); //~ ERROR at least one non-builtin trait is required for an object type\n   |        ^^^^^^^^^\n\n"}
[00:47:07] {"message":"the size for values of type `(dyn std::marmessage":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `(dyn std::marker::Copy + std::marker::Send + 'static)` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:18:8\n   |\nLL |     m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object\n   |        ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + std::marker::Send + 'static)`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:07] {"message":"the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-macro-matcher.rs","byte_start":682,"byte_end":696,"line_start":19,"line_end":19,"column_start":8,"column_end":22,"is_primary":true,"text":[{"text":"    m!('static + Send);","highlight_start":8,"highlight_end":22}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Send + 'static)`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `(dyn std::marker::Send + 'static)` cannot be known at compilation time\n  --> /checkout/src/test/ui/traits/trait-object-macro-matcher.rs:19:8\n   |\nLL |     m!('static + Send);\n   |        ^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Send + 'static)`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:07] {"message":"the trait `std::marker::Copy` cannot be made into an object","code":{"code":"E0038","explanation":"\nTrait objects like `Box<Trait>` can only be constructed when certain\nrequirements are satisfied by the trait in question.\n\nTrait objects are a form of dynamic dispatch and use a dynamically sized type\nfor the inner type. So, for a given trait `Trait`, when `Trait` is treated as a\ntype, as in `Box<Trait>`, the inner type is 'unsized'. In such cases the boxed\npointer is a 'fat pointer' that contains an extra pointer to a table of methods\n(among other things) for dynamic dispatch. This design mandates some\nrestrictions on the types of traits that are allowed to be used in trait\nobjects, which are collectively termed as 'object safety' rules.\n\nAttempting to create a trait object for a non object-safe trait will trigger\nthis error.\n\nThere are various rules:\n\n### The trait cannot require `Self: Sized`\n\nWhen `Trait` is treated as a type, the type does not implement the special\n`Sized` trait, because the type does not have a known size at compile time and\ncan only be accessed behind a pointer. Thus, if we have a trait like the\nfollowing:\n\n```\ntrait Foo where Self: Sized {\n\n}\n```\n\nWe cannot create an object of type `Box<Foo>` or `&Foo` since in this case\n`Self` would not be `Sized`.\n\nGenerally, `Self : Sized` is used to indicate that the trait should not be used\nas a trait object. If the trait comes from your own crate, consider removing\nthis restriction.\n\n### Method references the `Self` type in its arguments or return type\n\nThis happens when a trait has a method like the8`.\n"}
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] thread '[ui] ui/traits/trait-object-macro-matcher.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3196:9
[00:47:07] 
[00:47:07] 
[00:47:07] ---- [ui] ui/unsized6.rs stdout ----
[00:47:07] diff of stderr:
[00:47:07] 
[00:47:07] + error[E0277]: the size for values of type `W` cannot be known at compilation time
[00:47:07] +   --> $DIR/unsized6.rs:16:12
[00:47:07] +    |
[00:47:07] + LL |     let _: W; // <-- this is OK, no bindings created, no initializer.
[00:47:07] +    |            ^ doesn't have a size known at compile-time
[00:47:07] +    = help: the trait `std::marker::Sized` is not implemented for `W`
[00:47:07] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:07] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:07] +    = help: consider adding a `where W: std::marker::Sized` bound
[00:47:07] +    = note: the return type of a function must have a statically known size
[00:47:07] + 
[00:47:07] 1 error[E0277]: the size for values of type `Y` cannot be known at compilation time
[00:47:07] +   --> $DIR/unsized6.rs:19:12
[00:47:07] +    |
[00:47:07] + LL |     let y: Y;
[00:47:07] +    |            ^ doesn't have a size known at compile-time
[00:47:07] +    = help: the trait `std::marker::Sized` is not implemented for `Y`
[00:47:07] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:07] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:07] +    = help: consider adding a `where Y: std::marker::Sized` bound
[00:47:07] +    = note: the return type of a function must have a statically known size
[00:47:07] + 
[00:47:07] + error[E0277]: the size for values of type `Y` cannot be known at compilation time
[00:47:07] 3    |
[00:47:07] 3    |
[00:47:07] 4 LL |     let y: Y;
[00:47:07] 
[00:47:07] 33    = note: only the last element of a tuple may have a dynamically sized type
[00:47:07] 35 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:47:07] +   --> $DIR/unsized6.rs:25:12
[00:47:07] +    |
[00:47:07] +    |
[00:47:07] + LL |     let y: X;
[00:47:07] +    |            ^ doesn't have a size known at compile-time
[00:47:07] +    = help: the trait `std::marker::Sized` is not implemented for `X`
[00:47:07] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:07] +    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:47:07] +    = help: consider adding a `where X: std::marker::Sized` bound
[00:47:07] +    = note: the return type of a function must have a statically known size
[00:47:07] + 
[00:47:07] + error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:47:07] 37    |
[00:47:07] 37    |
[00:47:07] 38 LL |     let y: X;
[00:47:07] 
[00:47:07] 56    = note: only the last element of a tuple may have a dynamically sized type
[00:47:07] 58 error[E0277]: the size for values of type `X` cannot be known at compilation time
[00:47:07] +   --> $DIR/unsized6.rs:32:12
[00:47:07] +   --> $DIR/unsized6.rs:32:12
[00:4type `X` cannot be known at compilation time
[00:47:07] 96    |
[00:47:07] 96    |
[00:47:07] 97 LL |     let y: X = *x1;
[00:47:07] 151    = note: all local variables must have a statically known size
[00:47:07] 152    = help: unsized locals are gated as an unstable feature
[00:47:07] 153 
[00:47:07] - error: aborting due to 13 previous errors
---
[00:47:07] 
[00:47:07] 
[00:47:07] The actual stderr differed from the expected stderr.
[00:47:07] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsized6/unsized6.stderr
[00:47:07] To update references, rerun the tests and pass the `--bless` flag
[00:47:07] To only update this specific test, also pass `--test-args unsized6.rs`
[00:47:07] error: 1 errors occurred comparing output.
[00:47:07] status: exit code: 1
[00:47:07] status: exit code: 1
[00:47:07] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unsized6.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsized6/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsized6/auxiliary" "-A" "unused"
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] 
[00:47:07] ------------------------{"message":"consider adding a `where W: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `W` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:16:12\n   |\nLL |     let _: W; // <-- this is OK, no bindings created, no initializer.\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `W`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where W: std::marker::Sized` bound\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:07] {"message":"the size for values of type `Y` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for e statically known size\n\n"}
[00:47:07] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:497:22
[00:47:07] {"message":"the size for values of type `Y` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n`5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":654,"byte_end":673,"line_start":17,"line_end":17,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let _: (isize, (X, isize));","highlight_start":12,"highlight_end":31}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"only the last element of a tuple may have a dynamically sized type","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:17:12\n   |\nLL |     let _: (isize, (X, isize));\n   |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: only the last element of a tuple may have a dynamically sized type\n\n"}
[00:47:07] {"message":"the size for values of type `Z` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":786,"byte_end":805,"line_start":21,"line_end":21,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let y: (isize, (Z, usize));","highlight_start":12,"highlight_end":31}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `Z`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","sans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:25:9\n   |\nLL |     let y: X;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:07] {"message":"the size for values of type `Y` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will er::Sized` bound\n   = note: only the last element of a tuple may have a dynamically sized type\n\n"}
[00:47:07] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1090,"byte_end":1091,"line_start":32,"line_end":32,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":12,"highlight_end":13}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:32:12\n   |\nLL |     let y: X = *x1;\n   |            ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: the return type of a function must have a statically known size\n\n"}
[00:47:07] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\zed6.rs","byte_start":1087,"byte_end":1088,"line_start":32,"line_end":32,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y: X = *x1;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:32:9\n   |\nLL |     let y: X = *x1;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all`where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:34:9\n   |\nLL |     let y = *x2;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:07] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1211,"byte_end":1212,"line_start":36,"line_end":36,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":"    let (y, z) = (*x3, 4);","highlight_start":10,"highlight_end":11}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:36:10\n   |\nLL |     let (y, z) = (*x3, 4);\n   |          ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:07] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                                          //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1404,"byte_end":1405,"line_start":42,"line_end":42,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    let y = *x2;","highlight_start":9,"highlight_end":10}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:42:9\n   |\nLL |     let y = *x2;\n   |         ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:07] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an objeci32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/unsized6.rs","byte_start":1465,"byte_end":1466,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":"    let (y, z) = (*x3, 4);","highlight_start":10,"highlight_end":11}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:44:10\n   |\nLL |}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `X`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding a `where X: std::marker::Sized` bound","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"all local variables must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"unsized locals are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:48:18\n   |\nLL | fn g1<X: ?Sized>(x: X) {}\n   |                  ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:07] {"message":"the size for values of type `X` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccep","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `X` cannot be known at compilation time\n  --> /checkout/src/test/ui/unsized6.rs:50:22\n   |\nLL | fn g2<X: ?Sized + T>(x: X) {}\n   |                      ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `X`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = help: consider adding a `where X: std::marker::Sized` bound\n   = note: all local variables must have a statically known size\n   = help: unsized locals are gated as an unstable feature\n\n"}
[00:47:07] {"message":"aborting due to 18 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 18 previous errors\n\n"}
[00:47:07] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:47:07] ------------------------------------------
[00:47:07] 
[00:47:07] thread '[ui] ui/unsized6.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3196:9
[00:47:07] 

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

self.fcx.tables.borrow_mut().user_provided_tys_mut().insert(ty.hir_id, c_ty);

Some(o_ty)
Some(revealed_ty)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to track both o_ty and revealed_ty here, and add a special check so that assigning to the variable is only allowed with revealed_ty and reading from the variable is only allowed with o_ty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably very related to what the assign method on self does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. It occurred to me before in fact, but I was hoping there may be a simpler way... I think you're right in that it's necessary though.

@alexreg
Copy link
Contributor Author

alexreg commented Sep 4, 2018

@oli-obk New WIP version pushed. The problem seems to be that instantiate_value_path (which I believe is the function for type-checking paths, such as references to local variables) is not picking up the actual defs for the locals, but rather the defs for their values, as if they're being inlined! That, or resolve_ty_and_def_ufcs is returning the wrong thing. Thoughts?

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:29] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:30] tidy error: /checkout/src/librustc_typeck/check/mod.rs:4479: line longer than 100 chars
[00:04:30] tidy error: /checkout/src/librustc_typeck/check/mod.rs:5032: line longer than 100 chars
[00:04:31] some tidy checks failed
[00:04:31] 
[00:04:31] 
[00:04:31] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:31] 
[00:04:31] 
[00:04:31] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:31] Build completed unsuccessfully in 0:00:49
[00:04:31] Build completed unsuccessfully in 0:00:49
[00:04:31] make: *** [tidy] Error 1
[00:04:31] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:258e3133
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0a4d8e86:start=1536030117441173588,finish=1536030117450981155,duration=9807567
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:12c74e13
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:06ada6e6
travis_time:start:06ada6e6
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:06aa86d7
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexreg
Copy link
Contributor Author

alexreg commented Sep 5, 2018

Okay, this is my declaration that I'm officially giving up on this, at least until someone provides in @rust-lang/lang provides can provide proper mentorship. (I thank @oli-obk for his efforts to guide me so far, but I'm afraid I need more low-level guidance. MIR officially makes everything here an unholy mess, which I don't see any way around.)

e.g. The current main obstacle is this error:

error: internal compiler error: broken MIR in DefId(0/0:3 ~ foo[317d]::main[0]) (_1 = const 123i32): bad assignment (impl std::cmp::PartialEq<i32> = i32): NoSolution
 --> foo.rs:8:34
  |
8 |     let x: impl PartialEq<i32> = 123_i32;
  |                                  ^^^^^^^

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:45] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:46] tidy error: /checkout/src/librustc_typeck/check/mod.rs:4479: line longer than 100 chars
[00:04:46] tidy error: /checkout/src/librustc_typeck/check/mod.rs:5032: line longer than 100 chars
[00:04:47] some tidy checks failed
[00:04:47] 
[00:04:47] 
[00:04:47] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:47] 
[00:04:47] 
[00:04:47] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:47] Build completed unsuccessfully in 0:00:48
[00:04:47] Build completed unsuccessfully in 0:00:48
[00:04:47] make: *** [tidy] Error 1
[00:04:47] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0b81cded
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0252b664:start=1536178983235969751,finish=1536178983251115428,duration=15145677
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0998f7c7
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0b601f30
travis_time:start:0b601f30
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:22432197
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexreg alexreg force-pushed the impl-trait-in-bindings branch 2 times, most recently from e06f098 to e60c068 Compare September 25, 2018 02:05
@alexreg
Copy link
Contributor Author

alexreg commented Sep 25, 2018

@cramertj All tests passing. LGTM!

@@ -0,0 +1,35 @@
error[E0434]: can't capture dynamic environment in a fn item
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: these error messages are pretty misleading. Can you open an issue about improving these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it could definitely be clearer. I figured out what it meant immediately, but probably only because I've been working on this for a while. Will open an issue now.

@cramertj
Copy link
Member

Awesome! Looks good apart from the one error message, but we can tackle that in a followup.

@bors r+

@bors
Copy link
Contributor

bors commented Sep 25, 2018

📌 Commit 16cf404 has been approved by cramertj

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Sep 25, 2018
@alexreg
Copy link
Contributor Author

alexreg commented Sep 25, 2018

@cramertj Okay great, thanks!

@bors
Copy link
Contributor

bors commented Sep 25, 2018

⌛ Testing commit 16cf404 with merge 4141a40...

bors added a commit that referenced this pull request Sep 25, 2018
`impl trait` in bindings (feature: impl-trait-existential-types)

This PR enables `impl Trait` syntax (opaque types) to be used in bindings, e.g.

* `let foo: impl Clone = 1;`
* `static foo: impl Clone = 2;`
* `const foo: impl Clone = 3;`

This is part of [RFC 2071](https://github.com/rust-lang/rfcs/blob/master/text/2071-impl-trait-existential-types.md) ([tracking issue](#34511)), but exists behind the separate feature gate `impl_trait_in_bindings`.

CC @cramertj @oli-obk @eddyb @Centril @varkor
@bors
Copy link
Contributor

bors commented Sep 25, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: cramertj
Pushing 4141a40 to master...

@eddyb
Copy link
Member

eddyb commented Sep 26, 2018

cc @nikomatsakis I believe this PR caused #54593, can you take a look at the NLL changes?

@@ -883,6 +891,23 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
)
}

fn sub_types_or_anon(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "anon" here supposed to be opaque?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway this PR is already merged, so best to open a new one with these changes.

fn eq_opaque_type_and_type(
&mut self,
revealed_ty: Ty<'tcx>,
anon_ty: Ty<'tcx>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think anon_ty as a parameter name fits in with the naming scheme elsewhere, but not sure...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That naming scheme probably got missed by the anon -> opaque mass rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably yep.

None => return Ok(()),
};

// Finally, if we instantiated the anon types successfully, we
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And in this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants