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

Include scope names in diagnostics #49898

Closed
wants to merge 2 commits into from

Conversation

da-x
Copy link
Member

@da-x da-x commented Apr 12, 2018

Pre-RFC: rust-lang/rfcs#2399

So far, rustc has only printed about filenames and line numbers for warnings and errors. I think it is rather missed, compared to gcc and other compiler, that useful context information such as function
names and structs is not included.

The changes in this pull request introduce new emissions in diagnostics to implement this.

Short example:

warning: unused variable: `a`
  --> pr.rs:18:9: in fn test
   |
18 |     let a = 1;
   |         ^ help: consider using `_a` instead

Check in fn test above.

The information for the line is gathered by a mechanism to resolve a Span to the corresponding named scope, by a Trait dynamic call from librustc_error back to libsyntax, in addition to what is done with
CodeMap. The call does a quick DFS into the AST for the Span and collects the relevant Ident path, so it should handle nested scopes properly.

To do:

  • A merged RFC for these set of changes
  • More fixes and refactoring following review
  • Is it practical to also allow context diagnostics for the
    AST prior to macro expansion?
  • Fix all tests that compare stdout/stderr
  • Additional tests to cover all cases

A larger example:

struct OkStruct {
    i: u32,
}

#[derive(Debug)]
enum OkEnum {
    ItemA,
    ItemB,
}

impl OkStruct {
    fn method() {
        let a = 1;
    }
}

fn test() {
    let a = 1;
}

fn test_nested() {
    let a = 1;

    fn nested() {
        let b = 2;
    }
}

fn main() {
    let a = 1;

    println!("{:?}", OkEnum::ItemA);
}

The output is:

warning: unused variable: `a`
  --> pr.rs:18:9: in fn test
   |
18 |     let a = 1;
   |         ^ help: consider using `_a` instead
   |
   = note: #[warn(unused_variables)] on by default

warning: unused variable: `a`
  --> pr.rs:22:9: in fn test_nested
   |
22 |     let a = 1;
   |         ^ help: consider using `_a` instead

warning: unused variable: `b`
  --> pr.rs:25:13: in fn test_nested::nested
   |
25 |         let b = 2;
   |             ^ help: consider using `_b` instead

warning: unused variable: `a`
  --> pr.rs:30:9: in fn main
   |
30 |     let a = 1;
   |         ^ help: consider using `_a` instead

warning: unused variable: `a`
  --> pr.rs:13:13: in fn method::method
   |
13 |         let a = 1;
   |             ^ help: consider using `_a` instead

warning: struct is never used: `OkStruct`
 --> pr.rs:1:1
  |
1 | struct OkStruct {
  | ^^^^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default

warning: variant is never constructed: `ItemB`
 --> pr.rs:8:5: in enum OkEnum
  |
8 |     ItemB,
  |     ^^^^^

warning: method is never used: `method`
  --> pr.rs:12:5
   |
12 |     fn method() {
   |     ^^^^^^^^^^^

warning: function is never used: `test`
  --> pr.rs:17:1
   |
17 | fn test() {
   | ^^^^^^^^^

warning: function is never used: `test_nested`
  --> pr.rs:21:1
   |
21 | fn test_nested() {
   | ^^^^^^^^^^^^^^^^

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 12, 2018
@da-x
Copy link
Member Author

da-x commented Apr 12, 2018

I opened a pre-RFC for this. https://internals.rust-lang.org/t/pre-rfc-include-scope-names-in-diagnostics/7304 . Will rewrite the implementation to suite the consensus from discussion.

@eddyb
Copy link
Member

eddyb commented Apr 17, 2018

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Apr 17, 2018
@bors
Copy link
Contributor

bors commented Apr 18, 2018

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

@pietroalbini
Copy link
Member

Ping from triage @nikomatsakis! This PR needs your review!

@nikomatsakis
Copy link
Contributor

Some thoughts:

  • The current output is the result of a lot of iteration.
    • I'm quite wary of making such a major change without more discussion.
    • Good that we opened the thread, therefore!

I do agree that this information is valuable, but I think I would prefer an alternate presentation. I'd also prefer for us to gather the information in a different way. I think however I'll move my concerns over to the internals thread.

I'm going to mark this PR as S-blocked for the time being -- however, I'm sort of inclined to close it, just because my queue is long and we're not ready to move here yet. But I'll hold off on that for now.

@nikomatsakis nikomatsakis added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2018
@nikomatsakis
Copy link
Contributor

cc @estebank @jonathandturner

@shepmaster shepmaster added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels May 6, 2018
@pietroalbini pietroalbini added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels May 14, 2018
@da-x da-x force-pushed the scope-names-in-diagnostics branch 2 times, most recently from 14857fa to 92dd733 Compare May 15, 2018 21:02
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/e0/2d/8dfbc3294db5b217570c41543549bb47feac371a122dde206bc542bb12ff/awscli-1.15.21-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 34.8MB/s eta 0:00:01
    1% |▌                               | 20kB 1.4MB/s eta 0:00:01
    2% |▉                               | 30kB 1.4MB/s eta 0:00:01
    3% |█                               | 40kB 1.5MB/s eta 0:00:01
---
    100% |████████████████████████████████| 61kB 6.8MB/s 
Collecting botocore==1.10.21 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/be/02/c225b57b9b775f9d70d5b70a6d950cdd7e3dd0ee7b0a6c8a322c90732f9d/botocore-1.10.21-py2.py3-none-any.whl (4.2MB)
    0% |                                | 10kB 29.0MB/s eta 0:00:01
    0% |▏                               | 20kB 26.2MB/s eta 0:00:01
    0% |▎                               | 30kB 29.8MB/s eta 0:00:01
    0% |▎                               | 40kB 30.3MB/s eta 0:00:01
---

[00:04:53] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:53] tidy error: /checkout/src/librustc_errors/emitter.rs:1420: line longer than 100 chars
[00:04:54] some tidy checks failed
[00:04:54] 
[00:04:54] 
[00:04:54] 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:54] 
[00:04:54] 
[00:04:54] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:54] Build completed unsuccessfully in 0:01:54
[00:04:54] Build completed unsuccessfully in 0:01:54
[00:04:54] Makefile:79: recipe for target 'tidy' failed
[00:04:54] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1096024e
$ 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)

@da-x da-x force-pushed the scope-names-in-diagnostics branch from 92dd733 to 30c21ad Compare May 16, 2018 05:27
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
travis_time:start:test_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:47:18] 
[00:47:18] running 1405 tests
[00:47:22] ..FF.FFFF.FF.FFFF...FFFFFFFFFFF.FFFFFFFFF.FFFFFF.FF..FFF.FF.....FFFFFF..F.FFFFF.F.i.F..F..F.....F...
[00:47:28] ...F...FF..FF......F.F..F..F.FF..i............FFFFFFFFFFF.FFFF..FF.FF......F..FFF.F.F.FFF........FFF
[00:47:32] FFFFFF..F.FFFFFFFFFFFF..F..FFFFFFFFFFFF...F.FFFFF....FFF.......FF..FF.F..FFFF......F.........FFFF.FF
[00:47:35] ......FFFF.FF.F.F.FFFFFFF...F.....FFF...................................FF.....F..F.FFFFFFFFFF....FF
[00:47:39] F....FF.....FF.F.F.FFFFFFFFFFFFF.FFFF....FFFF.........F..F....................F.......F.............
[00:47:42] FF..................F..F...............................F..F.F.F.........F...FF.FF..FFFFFFF.FFFF.FF.F
[00:47:48] F.FFFF...FFF.F.F.FF.FFF...FFF..FFFFFF..F..F...FFF.FF.F..F.F...FFFFFFFF.FF.FFFFFFF..FFFFF.FF.FFFFF.FF
[00:47:54] F...FFFFFFFF....F.FFF.FF.FF..FFFFF...FF.FF...FFF.FF.FFF.F.FF...FFF....F.FFF.F.FFFF.FFF.FFF.FFF......
[00:47:59] .F.FF..FFFFFF.FFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF..F.FFFFF.FF.F.FFFF...FFFFFFF.............
[00:48:05] .....F..FFF.FFFFFFFFFFF.FFF.FFFFF.FFF.FFiF.F.F.FF.FF.FFFFFFFFFFFFFFFFFFFFFF.FFF..F.FF.F.FF.FF.F.FF..
[00:48:10] FFFFFFFFFFFFFF.Fi...FFF....F..FFFFFF..F.....................FFFF.FFFFFFFFFFF.FFFFFF..F.F............
[00:48:16] ...F....F........FF.....F.F.FFF.FFFiiFF.FFF..F.F.F.FF.FF....FFFFFF.FFF.FF.F...F.....F...F......FFFFF
[00:48:22] FFFFFFFF....FFFFF.FFFFFFFFFFF..FFFFFF..FFFFFFF.F.F.F.FFF.FFF.FFFFFFFFFFF...FF..F..FFFFFFFFFFFFFFFFFF
[00:48:29] FFF..F..FFF.F....F.FF.FFF..F.F.....Fi.............FFFFFFFFF.FFFFF.FFFF.FFFF.FFFF.FFF.FFFF.F...FF..FF
[00:48:29] ....F
[00:48:30] 
[00:48:30] ---- [ui] ui/arbitrary-self-types-not-object-safe.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 
[00:48:30] 1 error[E0038]: the trait `Foo` cannot be made into an object
[00:48:30] -   --> $DIR/arbitrary-self-types-not-object-safe.rs:40:33
[00:48:30] +   --> $DIR/arbitrary-self-types-not-object-safe.rs:40:33: in fn make_foo
[00:48:30] 3    |
[00:48:30] 4 LL |     let x = Box::new(5usize) as Box<Foo>;
[00:48:30] 5    |                                 ^^^^^^^^ the trait `Foo` cannot be made into an object
[00:48:30] 
[00:48:30] 7    = note: method `foo` has a non-standard `self` type
[00:48:30] 8 
[00:48:30] 9 error[E0038]: the trait `Foo` cannot be made into an object
[00:48:30] -   --> $DIR/arbitrary-self-types-not-object-safe.rs:40:13
[00:48:30] +   --> $DIR/arbitrary-self-types-not-object-safe.rs:40:13: in fn make_foo
[00:48:30] 11    |
[00:48:30] 12 LL |     let x = Box::new(5usize) as Box<Foo>;
[00:48:30] 13    |             ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/arbitrary-self-types-not-object-safe.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'arbitrary-self-types-not-object-safe.rs'
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/arbitrary-self-types-not-object-safe.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/arbitrary-self-types-not-object-safe.stage2-x86_64-unknown-linux-gnu" "-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/arbitrary-self-types-not-object-safe.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"the trait `Foo` 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\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 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/arbitrary-self-types-not-object-safe.rs","byte_start":951,"byte_end":959,"line_start":40,"line_end":40,"column_start":33,"column_end":41,"is_primary":true,"text":[{"text":"    let x = Box::new(5usize) as Box<Foo>;","highlight_start":33,"highlight_end":41}],"label":"the trait `Foo` cannot be made into an object","suggested_replacement":null,"expansion":null}],"children":[{"message":"method `foo` has a non-standard `self` type","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `Foo` cannot be made into an object\n  --> /checkout/src/test/ui/arbitrary-self-types-not-object-safe.rs:40:33: in fn make_foo\n   |\nLL |     let x = Box::new(5usize) as Box<Foo>;\n   |                                 ^^^^^^^^ the trait `Foo` cannot be made into an object\n   |\n   = note: method `foo` has a non-standard `self` type\n\n"}
[00:48:30] {"message":"the trait `Foo` 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\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 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/arbitrary-self-types-not-object-safe.rs","byte_start":931,"byte_end":947,"line_start":40,"line_end":40,"column_start":13,"column_end":29,"is_primary":true,"text":[{"text":"    let x = Box::new(5usize) as Box<Foo>;","highlight_start":13,"highlight_end":29}],"label":"the trait `Foo` cannot be made into an object","suggested_replacement":null,"expansion":null}],"children":[{"message":"method `foo` has a non-standard `self` type","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0038]: the trait `Foo` cannot be made into an object\n  --> /checkout/src/test/ui/arbitrary-self-types-not-object-safe.rs:40:13: in fn make_foo\n   |\nLL |     let x = Box::new(5usize) as Box<Foo>;\n   |             ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object\n   |\n   = note: method `foo` has a non-standard `self` type\n   = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>`\n\n"}
[00:48:30] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:48:30] {"message":"For more information about this error, try `rustc --explain E0038`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0038`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/arbitrary-self-types-not-object-safe.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:48:30] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:48:30] 
[00:48:30] ---- [ui] ui/anonymous-higher-ranked-lifetime.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5: in fn main
[00:48:30] 3    |
[00:48:30] 4 LL |     f1(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 5    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 13    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 14 
[00:48:30] 15 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5: in fn main
[00:48:30] 17    |
[00:48:30] 18 LL |     f2(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 19    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 27    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 28 
[00:48:30] 29 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5: in fn main
[00:48:30] 31    |
[00:48:30] 32 LL |     f3(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 33    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 41    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 42 
[00:48:30] 43 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5: in fn main
[00:48:30] 45    |
[00:48:30] 46 LL |     f4(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 47    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 55    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 56 
[00:48:30] 57 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5: in fn main
[00:48:30] 59    |
[00:48:30] 60 LL |     f5(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 61    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 69    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 70 
[00:48:30] 71 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5: in fn main
[00:48:30] 73    |
[00:48:30] 74 LL |     g1(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 75    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 83    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 84 
[00:48:30] 85 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5: in fn main
[00:48:30] 87    |
[00:48:30] 88 LL |     g2(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 89    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 97    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 98 
[00:48:30] 99 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:19:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:19:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:19:5: in fn main
[00:48:30] 101    |
[00:48:30] 102 LL |     g3(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 103    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 111    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 112 
[00:48:30] 113 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5: in fn main
[00:48:30] 115    |
[00:48:30] 116 LL |     g4(|_: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 117    |     ^^ -------------- found signature of `fn((), ()) -> _`
[00:48:30] 125    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 126 
[00:48:30] 127 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:21:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:21:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:21:5: in fn main
[00:48:30] 129    |
[00:48:30] 130 LL |     h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 131    |     ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
[00:48:30] 139    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:48:30] 140 
[00:48:30] 141 error[E0631]: type mismatch in closure arguments
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5
[00:48:30] -   --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5
[00:48:30] +   --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5: in fn main
[00:48:30] 143    |
[00:48:30] 144 LL |     h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
[00:48:30] 145    |     ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/anonymous-higher-ranked-lifetime.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'anonymous-higher-ranked-lifetime.rs'
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/anonymous-higher-ranked-lifetime.stage2-x86_64-unknown-linux-gnu" "-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/anonymous-higher-ranked-lifetime.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":483,"byte_end":485,"line_start":12,"line_end":12,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    f1(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":486,"byte_end":500,"line_start":12,"line_end":12,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    f1(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `f1`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1080,"byte_end":1116,"line_start":26,"line_end":26,"column_start":1,"column_end":37,"is_primary":true,"text":[{"text":"fn f1<F>(_: F) where F: Fn(&(), &()) {}","highlight_start":1,"highlight_end":37}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:12:5: in fn main\n   |\nLL |     f1(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _`\n   |\nnote: required by `f1`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:26:1\n   |\nLL | fn f1<F>(_: F) where F: Fn(&(), &()) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":534,"byte_end":536,"line_start":13,"line_end":13,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    f2(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":537,"byte_end":551,"line_start":13,"line_end":13,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    f2(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `f2`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1120,"byte_end":1167,"line_start":27,"line_end":27,"column_start":1,"column_end":48,"is_primary":true,"text":[{"text":"fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}","highlight_start":1,"highlight_end":48}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:13:5: in fn main\n   |\nLL |     f2(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _`\n   |\nnote: required by `f2`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:27:1\n   |\nLL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":585,"byte_end":587,"line_start":14,"line_end":14,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    f3(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r> fn(&(), &'r ()) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":588,"byte_end":602,"line_start":14,"line_end":14,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    f3(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `f3`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1171,"byte_end":1214,"line_start":28,"line_end":28,"column_start":1,"column_end":44,"is_primary":true,"text":[{"text":"fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}","highlight_start":1,"highlight_end":44}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:14:5: in fn main\n   |\nLL |     f3(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'r> fn(&(), &'r ()) -> _`\n   |\nnote: required by `f3`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:28:1\n   |\nLL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":636,"byte_end":638,"line_start":15,"line_end":15,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    f4(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":639,"byte_end":653,"line_start":15,"line_end":15,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    f4(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `f4`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1218,"byte_end":1265,"line_start":29,"line_end":29,"column_start":1,"column_end":48,"is_primary":true,"text":[{"text":"fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}","highlight_start":1,"highlight_end":48}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:15:5: in fn main\n   |\nLL |     f4(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _`\n   |\nnote: required by `f4`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:29:1\n   |\nLL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":687,"byte_end":689,"line_start":16,"line_end":16,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    f5(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r> fn(&'r (), &'r ()) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":690,"byte_end":704,"line_start":16,"line_end":16,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    f5(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `f5`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1269,"byte_end":1319,"line_start":30,"line_end":30,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:16:5: in fn main\n   |\nLL |     f5(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'r> fn(&'r (), &'r ()) -> _`\n   |\nnote: required by `f5`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:30:1\n   |\nLL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":738,"byte_end":740,"line_start":17,"line_end":17,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    g1(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":741,"byte_end":755,"line_start":17,"line_end":17,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    g1(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `g1`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1334,"byte_end":1379,"line_start":33,"line_end":33,"column_start":1,"column_end":46,"is_primary":true,"text":[{"text":"fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}","highlight_start":1,"highlight_end":46}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:17:5: in fn main\n   |\nLL |     g1(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _`\n   |\nnote: required by `g1`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:33:1\n   |\nLL | fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":789,"byte_end":791,"line_start":18,"line_end":18,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    g2(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":792,"byte_end":806,"line_start":18,"line_end":18,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    g2(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `g2`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1383,"byte_end":1423,"line_start":34,"line_end":34,"column_start":1,"column_end":41,"is_primary":true,"text":[{"text":"fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}","highlight_start":1,"highlight_end":41}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:18:5: in fn main\n   |\nLL |     g2(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _`\n   |\nnote: required by `g2`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:34:1\n   |\nLL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":840,"byte_end":842,"line_start":19,"line_end":19,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    g3(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":843,"byte_end":857,"line_start":19,"line_end":19,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    g3(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `g3`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1427,"byte_end":1483,"line_start":35,"line_end":35,"column_start":1,"column_end":57,"is_primary":true,"text":[{"text":"fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}","highlight_start":1,"highlight_end":57}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:19:5: in fn main\n   |\nLL |     g3(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _`\n   |\nnote: required by `g3`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:35:1\n   |\nLL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":891,"byte_end":893,"line_start":20,"line_end":20,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    g4(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":894,"byte_end":908,"line_start":20,"line_end":20,"column_start":8,"column_end":22,"is_primary":false,"text":[{"text":"    g4(|_: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":22}],"label":"found signature of `fn((), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `g4`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1487,"byte_end":1538,"line_start":36,"line_end":36,"column_start":1,"column_end":52,"is_primary":true,"text":[{"text":"fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}","highlight_start":1,"highlight_end":52}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:20:5: in fn main\n   |\nLL |     g4(|_: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ -------------- found signature of `fn((), ()) -> _`\n   |     |\n   |     expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _`\n   |\nnote: required by `g4`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:36:1\n   |\nLL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":942,"byte_end":944,"line_start":21,"line_end":21,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":945,"byte_end":973,"line_start":21,"line_end":21,"column_start":8,"column_end":36,"is_primary":false,"text":[{"text":"    h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":36}],"label":"found signature of `fn((), (), (), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `h1`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1552,"byte_end":1616,"line_start":39,"line_end":39,"column_start":1,"column_end":65,"is_primary":true,"text":[{"text":"fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:21:5: in fn main\n   |\nLL |     h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`\n   |     |\n   |     expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`\n   |\nnote: required by `h1`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:39:1\n   |\nLL | fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"type mismatch in closure arguments","code":{"code":"E0631","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1007,"byte_end":1009,"line_start":22,"line_end":22,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":5,"highlight_end":7}],"label":"expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1010,"byte_end":1038,"line_start":22,"line_end":22,"column_start":8,"column_end":36,"is_primary":false,"text":[{"text":"    h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch","highlight_start":8,"highlight_end":36}],"label":"found signature of `fn((), (), (), ()) -> _`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `h2`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs","byte_start":1620,"byte_end":1697,"line_start":40,"line_end":40,"column_start":1,"column_end":78,"is_primary":true,"text":[{"text":"fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}","highlight_start":1,"highlight_end":78}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0631]: type mismatch in closure arguments\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:22:5: in fn main\n   |\nLL |     h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch\n   |     ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`\n   |     |\n   |     expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`\n   |\nnote: required by `h2`\n  --> /checkout/src/test/ui/anonymous-higher-ranked-lifetime.rs:40:1\n   |\nLL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:48:30] {"message":"aborting due to 11 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 11 previous errors\n\n"}
[00:48:30] {"message":"For more information about this error, try `rustc --explain E0631`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0631`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/anonymous-higher-ranked-lifetime.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/associated-types-ICE-when-projecting-out-of-err.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0277]: the trait bound `(): Add<A>` is not satisfied
[00:48:30] -   --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11
[00:48:30] +   --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11: in fn ice
[00:48:30] 3    |
[00:48:30] 4 LL |     r = r + a;
[00:48:30] 5    |           ^ the trait `Add<A>` is not implemented for `()`
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'associated-types-ICE-when-projecting-out-of-err.rs'
[00:48:30] 
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/associated-types-ICE-when-projecting-out-of-err.stage2-x86_64-unknown-linux-gnu" "-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/associated-types-ICE-when-projecting-out-of-err.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"the trait bound `(): Add<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    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/associated-types-ICE-when-projecting-out-of-err.rs","byte_start":850,"byte_end":851,"line_start":33,"line_end":33,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":"    r = r + a;","highlight_start":11,"highlight_end":12}],"label":"the trait `Add<A>` is not implemented for `()`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0277]: the trait bound `(): Add<A>` is not satisfied\n  --> /checkout/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs:33:11: in fn ice\n   |\nLL |     r = r + a;\n   |           ^ the trait `Add<A>` is not implemented for `()`\n\n"}
[00:48:30] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:48:30] {"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:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/associated-types-ICE-when-projecting-out-of-err.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/asm-out-assign-imm.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0384]: cannot assign twice to immutable variable `x`
[00:48:30] -   --> $DIR/asm-out-assign-imm.rs:30:9
[00:48:30] +   --> $DIR/asm-out-assign-imm.rs:30:9: in fn main
[00:48:30] 3    |
[00:48:30] 4 LL |     x = 1;
[00:48:30] 5    |     ----- first assignment to `x`
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/asm-out-assign-imm.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'asm-out-assign-imm.rs'
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/asm-out-assign-imm.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/asm-out-assign-imm.stage2-x86_64-unknown-linux-gnu" "-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/asm-out-assign-imm.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"cannot assign twice to immutable variable `x`","code":{"code":"E0384","explanation":"\nThis error occurs when an attempt is made to reassign an immutable variable.\nFor example:\n\n```compile_fail,E0384\nfn main() {\n    let x = 3;\n    x = 5; // error, reassignment of immutable variable\n}\n```\n\nBy default, variables in Rust are immutable. To fix this error, add the keyword\n`mut` after the keyword `let` when declaring the variable. For example:\n\n```\nfn main() {\n    let mut x = 3;\n    x = 5;\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/asm-out-assign-imm.rs","byte_start":829,"byte_end":867,"line_start":30,"line_end":30,"column_start":9,"column_end":47,"is_primary":true,"text":[{"text":"        asm!(\"mov $1, $0\" : \"=r\"(x) : \"r\"(5));","highlight_start":9,"highlight_end":47}],"label":"cannot assign twice to immutable variable","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/asm-out-assign-imm.rs","byte_start":789,"byte_end":794,"line_start":27,"line_end":27,"column_start":5,"column_end":10,"is_primary":false,"text":[{"text":"    x = 1;","highlight_start":5,"highlight_end":10}],"label":"first assignment to `x`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0384]: cannot assign twice to immutable variable `x`\n  --> /checkout/src/test/ui/asm-out-assign-imm.rs:30:9: in fn main\n   |\nLL |     x = 1;\n   |     ----- first assignment to `x`\n...\nLL |         asm!(\"mov $1, $0\" : \"=r\"(x) : \"r\"(5));\n   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable\n\n"}
[00:48:30] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:48:30] {"message":"For more information about this error, try `rustc --explain E0384`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0384`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/asm-out-assign-imm.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/associated-const-impl-wrong-type.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0326]: implemented const `BAR` has an incompatible type for trait
[00:48:30] -   --> $DIR/associated-const-impl-wrong-type.rs:19:16
[00:48:30] +   --> $DIR/associated-const-impl-wrong-type.rs:19:16: in impl BAR
[00:48:30] 3    |
[00:48:30] 4 LL |     const BAR: u32;
[00:48:30] 5    |                --- type in trait
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-const-impl-wrong-type.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'associated-const-impl-wrong-type.rs'
[00:48:30] 
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/associated-const-impl-wrong-type.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/associated-const-impl-wrong-type.stage2-x86_64-unknown-linux-gnu" "-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/associated-const-impl-wrong-type.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"implemented const `BAR` has an incompatible type for trait","code":{"code":"E0326","explanation":"\nThe types of any associated constants in a trait implementation must match the\ntypes in the trait definition. This error indicates that there was a mismatch.\n\nHere's an example of this error:\n\n```compile_fail,E0326\ntrait Foo {\n    const BAR: bool;\n}\n\nstruct Bar;\n\nimpl Foo for Bar {\n    const BAR: u32 = 5; // error, expected bool, found u32\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/associated-const-impl-wrong-type.rs","byte_start":562,"byte_end":565,"line_start":19,"line_end":19,"column_start":16,"column_end":19,"is_primary":true,"text":[{"text":"    const BAR: i32 = -1;","highlight_start":16,"highlight_end":19}],"label":"expected u32, found i32","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-const-impl-wrong-type.rs","byte_start":495,"byte_end":498,"line_start":13,"line_end":13,"column_start":16,"column_end":19,"is_primary":false,"text":[{"text":"    const BAR: u32;","highlight_start":16,"highlight_end":19}],"label":"type in trait","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0326]: implemented const `BAR` has an incompatible type for trait\n  --> /checkout/src/test/ui/associated-const-impl-wrong-type.rs:19:16: in impl BAR\n   |\nLL |     const BAR: u32;\n   |                --- type in trait\n...\nLL |     const BAR: i32 = -1;\n   |                ^^^ expected u32, found i32\n\n"}
[00:48:30] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:48:30] {"message":"For more information about this error, try `rustc --explain E0326`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0326`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/associated-const-impl-wrong-type.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/associated-type-projection-from-multiple-supertraits.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0221]: ambiguous associated type `Color` in bounds of `C`
[00:48:30] -   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:29:32
[00:48:30] +   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:29:32: in fn dent
[00:48:30] 3    |
[00:48:30] 4 LL |     type Color;
[00:48:30] 5    |     ----------- ambiguous `Color` from `Vehicle`
[00:48:30] 
[00:48:30] 11    |                                ^^^^^^^^ ambiguous associated type `Color`
[00:48:30] 12 
[00:48:30] 13 error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar`
[00:48:30] -   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:33
[00:48:30] +   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:33: in fn dent_object
[00:48:30] 15    |
[00:48:30] 16 LL |     type Color;
[00:48:30] 17    |     ----------- ambiguous `Color` from `Vehicle`
[00:48:30] 
[00:48:30] 23    |                                 ^^^^^^^^^^^ ambiguous associated type `Color`
[00:48:30] 24 
[00:48:30] 25 error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified
[00:48:30] -   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:26
[00:48:30] +   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:26: in fn dent_object
[00:48:30] 27    |
[00:48:30] 28 LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
[00:48:30] 29    |                          ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value
[00:48:30] 30 
[00:48:30] 30 
[00:48:30] 31 error[E0221]: ambiguous associated type `Color` in bounds of `C`
[00:48:30] -   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29
[00:48:30] +   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29: in fn paint
[00:48:30] 33    |
[00:48:30] 34 LL |     type Color;
[00:48:30] 35    |     ----------- ambiguous `Color` from `Vehicle`
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-type-projection-from-multiple-supertraits.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'associated-type-projection-from-multiple-supertraits.rs'
[00:48:30] 
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/associated-type-projection-from-multiple-supertraits.stage2-x86_64-unknown-linux-gnu" "-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/associated-type-projection-from-multiple-supertraits.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"ambiguous associated type `Color` in bounds of `C`","code":{"code":"E0221","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0221\ntrait T1 {}\ntrait T2 {}\n\ntrait Foo {\n    type A: T1;\n}\n\ntrait Bar : Foo {\n    type A: T2;\n    fn do_something() {\n        let _: Self::A;\n    }\n}\n```\n\nIn this example, `Foo` defines an associated type `A`. `Bar` inherits that type\nfrom `Foo`, and defines another associated type of the same name. As a result,\nwhen we attempt to use `Self::A`, it's ambiguous whether we mean the `A` defined\nby `Foo` or the one defined by `Bar`.\n\nThere are two options to work around this issue. The first is simply to rename\none of the types. Alternatively, one can specify the intended type using the\nfollowing syntax:\n\n```\ntrait T1 {}\ntrait T2 {}\n\ntrait Foo {\n    type A: T1;\n}\n\ntrait Bar : Foo {\n    type A: T2;\n    fn do_something() {\n        let _: <Self as Bar>::A;\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":769,"byte_end":777,"line_start":29,"line_end":29,"column_start":32,"column_end":40,"is_primary":true,"text":[{"text":"fn dent<C:BoxCar>(c: C, color: C::Color) {","highlight_start":32,"highlight_end":40}],"label":"ambiguous associated type `Color`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":654,"byte_end":665,"line_start":21,"line_end":21,"column_start":5,"column_end":16,"is_primary":false,"text":[{"text":"    type Color;","highlight_start":5,"highlight_end":16}],"label":"ambiguous `Color` from `Box`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":596,"byte_end":607,"line_start":15,"line_end":15,"column_start":5,"column_end":16,"is_primary":false,"text":[{"text":"    type Color;","highlight_start":5,"highlight_end":16}],"label":"ambiguous `Color` from `Vehicle`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0221]: ambiguous associated type `Color` in bounds of `C`\n  --> /checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs:29:32: in fn dent\n   |\nLL |     type Color;\n   |     ----------- ambiguous `Color` from `Vehicle`\n...\nLL |     type Color;\n   |     ----------- ambiguous `Color` from `Box`\n...\nLL | fn dent<C:BoxCar>(c: C, color: C::Color) {\n   |                                ^^^^^^^^ ambiguous associated type `Color`\n\n"}
[00:48:30] {"message":"ambiguous associated type `Color` in bounds of `BoxCar`","code":{"code":"E0221","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0221\ntrait T1 {}\ntrait T2 {}\n\ntrait Foo {\n    type A: T1;\n}\n\ntrait Bar : Foo {\n    type A: T2;\n    fn do_something() {\n        let _: Self::A;\n    }\n}\n```\n\nIn this example, `Foo` defines an associated type `A`. `Bar` inherits that type\nfrom `Foo`, and defines another associated type of the same name. As a result,\nwhen we attempt to use `Self::A`, it's ambiguous whether we mean the `A` defined\nby `Foo` or the one defined by `Bar`.\n\nThere are two options to work around this issue. The first is simply to rename\none of the types. Alternatively, one can specify the intended type using the\nfollowing syntax:\n\n```\ntrait T1 {}\ntrait T2 {}\n\ntrait Foo {\n    type A: T1;\n}\n\ntrait Bar : Foo {\n    type A: T2;\n    fn do_something() {\n        let _: <Self as Bar>::A;\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":882,"byte_end":893,"line_start":33,"line_end":33,"column_start":33,"column_end":44,"is_primary":true,"text":[{"text":"fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {","highlight_start":33,"highlight_end":44}],"label":"ambiguous associated type `Color`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":654,"byte_end":665,"line_start":21,"line_end":21,"column_start":5,"column_end":16,"is_primary":false,"text":[{"text":"    type Color;","highlight_start":5,"highlight_end":16}],"label":"ambiguous `Color` from `Box`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":596,"byte_end":607,"line_start":15,"line_end":15,"column_start":5,"column_end":16,"is_primary":false,"text":[{"text":"    type Color;","highlight_start":5,"highlight_end":16}],"label":"ambiguous `Color` from `Vehicle`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar`\n  --> /checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs:33:33: in fn dent_object\n   |\nLL |     type Color;\n   |     ----------- ambiguous `Color` from `Vehicle`\n...\nLL |     type Color;\n   |     ----------- ambiguous `Color` from `Box`\n...\nLL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {\n   |                                 ^^^^^^^^^^^ ambiguous associated type `Color`\n\n"}
[00:48:30] {"message":"the value of the associated type `Color` (from the trait `Vehicle`) must be specified","code":{"code":"E0191","explanation":"\nTrait objects need to have all associated types specified. Erroneous code\nexample:\n\n```compile_fail,E0191\ntrait Trait {\n    type Bar;\n}\n\ntype Foo = Trait; // error: the value of the associated type `Bar` (from\n                  //        the trait `Trait`) must be specified\n```\n\nPlease verify you specified all associated types of the trait and that you\nused the right trait. Example:\n\n```\ntrait Trait {\n    type Bar;\n}\n\ntype Foo = Trait<Bar=i32>; // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":875,"byte_end":894,"line_start":33,"line_end":33,"column_start":26,"column_end":45,"is_primary":true,"text":[{"text":"fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {","highlight_start":26,"highlight_end":45}],"label":"missing associated type `Color` value","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified\n  --> /checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs:33:26: in fn dent_object\n   |\nLL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {\n   |                          ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value\n\n"}
[00:48:30] {"message":"ambiguous associated type `Color` in bounds of `C`","code":{"code":"E0221","explanation":"\nAn attempt was made to retrieve an associated type, but the type was ambiguous.\nFor example:\n\n```compile_fail,E0221\ntrait T1 {}\ntrait T2 {}\n\ntrait Foo {\n    type A: T1;\n}\n\ntrait Bar : Foo {\n    type A: T2;\n    fn do_something() {\n        let _: Self::A;\n    }\n}\n```\n\nIn this example, `Foo` defines an associated type `A`. `Bar` inherits that type\nfrom `Foo`, and defines another associated type of the same name. As a result,\nwhen we attempt to use `Self::A`, it's ambiguous whether we mean the `A` defined\nby `Foo` or the one defined by `Bar`.\n\nThere are two options to work around this issue. The first is simply to rename\none of the types. Alternatively, one can specify the intended type using the\nfollowing syntax:\n\n```\ntrait T1 {}\ntrait T2 {}\n\ntrait Foo {\n    type A: T1;\n}\n\ntrait Bar : Foo {\n    type A: T2;\n    fn do_something() {\n        let _: <Self as Bar>::A;\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":1071,"byte_end":1079,"line_start":38,"line_end":38,"column_start":29,"column_end":37,"is_primary":true,"text":[{"text":"fn paint<C:BoxCar>(c: C, d: C::Color) {","highlight_start":29,"highlight_end":37}],"label":"ambiguous associated type `Color`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":654,"byte_end":665,"line_start":21,"line_end":21,"column_start":5,"column_end":16,"is_primary":false,"text":[{"text":"    type Color;","highlight_start":5,"highlight_end":16}],"label":"ambiguous `Color` from `Box`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs","byte_start":596,"byte_end":607,"line_start":15,"line_end":15,"column_start":5,"column_end":16,"is_primary":false,"text":[{"text":"    type Color;","highlight_start":5,"highlight_end":16}],"label":"ambiguous `Color` from `Vehicle`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0221]: ambiguous associated type `Color` in bounds of `C`\n  --> /checkout/src/test/ui/associated-type-projection-from-multiple-supertraits.rs:38:29: in fn paint\n   |\nLL |     type Color;\n   |     ----------- ambiguous `Color` from `Vehicle`\n...\nLL |     type Color;\n   |     ----------- ambiguous `Color` from `Box`\n...\nLL | fn paint<C:BoxCar>(c: C, d: C::Color) {\n   |                             ^^^^^^^^ ambiguous associated type `Color`\n\n"}
[00:48:30] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:48:30] {"message":"Some errors occurred: E0191, E0221.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0191, E0221.\n"}
[00:48:30] {"message":"For more information about an error, try `rustc --explain E0191`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0191`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/associated-type-projection-from-multiple-supertraits.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/associated-types-in-ambiguous-context.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0223]: ambiguous associated type
[00:48:30] -   --> $DIR/associated-types-in-ambiguous-context.rs:16:36
[00:48:30] +   --> $DIR/associated-types-in-ambiguous-context.rs:16:36: in fn get
[00:48:30] 3    |
[00:48:30] 4 LL | fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
[00:48:30] 5    |                                    ^^^^^^^^^^ ambiguous associated type
[00:48:30] 
[00:48:30] 15    = note: specify the type using the syntax `<Type as std::ops::Deref>::Target`
[00:48:30] 17 error[E0223]: ambiguous associated type
[00:48:30] -   --> $DIR/associated-types-in-ambiguous-context.rs:21:23
[00:48:30] -   --> $DIR/associated-types-in-ambiguous-context.rs:21:23
[00:48:30] +   --> $DIR/associated-types-in-ambiguous-context.rs:21:23: in trait Grab::grab
[00:48:30] 19    |
[00:48:30] 20 LL |     fn grab(&self) -> Grab::Value;
[00:48:30] 21    |                       ^^^^^^^^^^^ ambiguous associated type
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types-in-ambiguous-context.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'associated-types-in-ambiguous-context.rs'
[00:48:30] 
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/associated-types-in-ambiguous-context.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/associated-types-in-ambiguous-context.stage2-x86_64-unknown-linux-gnu" "-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/associated-types-in-ambiguous-context.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"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/associated-types-in-ambiguous-context.rs","byte_start":576,"byte_end":586,"line_start":16,"line_end":16,"column_start":36,"column_end":46,"is_primary":true,"text":[{"text":"fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}","highlight_start":36,"highlight_end":46}],"label":"ambiguous associated type","suggested_replacement":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<Type as Get>::Value`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/associated-types-in-ambiguous-context.rs:16:36: in fn get\n   |\nLL | fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}\n   |                                    ^^^^^^^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<Type as Get>::Value`\n\n"}
[00:48:30] {"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/associated-types-in-ambiguous-context.rs","byte_start":745,"byte_end":768,"line_start":25,"line_end":25,"column_start":10,"column_end":33,"is_primary":true,"text":[{"text":"type X = std::ops::Deref::Target;","highlight_start":10,"highlight_end":33}],"label":"ambiguous associated type","suggested_replacement":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<Type as std::ops::Deref>::Target`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/associated-types-in-ambiguous-context.rs:25:10\n   |\nLL | type X = std::ops::Deref::Target;\n   |          ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<Type as std::ops::Deref>::Target`\n\n"}
[00:48:30] {"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/associated-types-in-ambiguous-context.rs","byte_start":679,"byte_end":690,"line_start":21,"line_end":21,"column_start":23,"column_end":34,"is_primary":true,"text":[{"text":"    fn grab(&self) -> Grab::Value;","highlight_start":23,"highlight_end":34}],"label":"ambiguous associated type","suggested_replacement":null,"expansion":null}],"children":[{"message":"specify the type using the syntax `<Type as Grab>::Value`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0223]: ambiguous associated type\n  --> /checkout/src/test/ui/associated-types-in-ambiguous-context.rs:21:23: in trait Grab::grab\n   |\nLL |     fn grab(&self) -> Grab::Value;\n   |                       ^^^^^^^^^^^ ambiguous associated type\n   |\n   = note: specify the type using the syntax `<Type as Grab>::Value`\n\n"}
[00:48:30] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:48:30] {"message":"For more information about this error, try `rustc --explain E0223`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0223`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/associated-types-in-ambiguous-context.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/augmented-assignments.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0596]: cannot borrow immutable local variable `y` as mutable
[00:48:30] -   --> $DIR/augmented-assignments.rs:30:5
[00:48:30] +   --> $DIR/augmented-assignments.rs:30:5: in fn main
[00:48:30] 3    |
[00:48:30] 4 LL |     let y = Int(2);
[00:48:30] 5    |         - consider changing this to `mut y`
[00:48:30] 
[00:48:30] 8    |     ^ cannot borrow mutably
[00:48:30] 9 
[00:48:30] 10 error[E0382]: use of moved value: `x`
[00:48:30] -   --> $DIR/augmented-assignments.rs:23:5
[00:48:30] +   --> $DIR/augmented-assignments.rs:23:5: in fn main
[00:48:30] 12    |
[00:48:30] 13 LL |     x   //~ error: use of moved value: `x`
[00:48:30] 14    |     ^ value used here after move
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/augmented-assignments.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'augmented-assignments.rs'
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/augmented-assignments.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/augmented-assignments.stage2-x86_64-unknown-linux-gnu" "-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/augmented-assignments.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"cannot borrow immutable local variable `y` as mutable","code":{"code":"E0596","explanation":"\nThis error occurs because you tried to mutably borrow a non-mutable variable.\n\nExample of erroneous code:\n\n```compile_fail,E0596\nlet x = 1;\nlet y = &mut x; // error: cannot borrow mutably\n```\n\nIn here, `x` isn't mutable, so when we try to mutably borrow it in `y`, it\nfails. To fix this error, you need to make `x` mutable:\n\n```\nlet mut x = 1;\nlet y = &mut x; // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/augmented-assignments.rs","byte_start":828,"byte_end":829,"line_start":30,"line_end":30,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    y   //~ error: cannot borrow immutable local variable `y` as mutable","highlight_start":5,"highlight_end":6}],"label":"cannot borrow mutably","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/augmented-assignments.rs","byte_start":769,"byte_end":770,"line_start":28,"line_end":28,"column_start":9,"column_end":10,"is_primary":false,"text":[{"text":"    let y = Int(2);","highlight_start":9,"highlight_end":10}],"label":"consider changing this to `mut y`","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0596]: cannot borrow immutable local variable `y` as mutable\n  --> /checkout/src/test/ui/augmented-assignments.rs:30:5: in fn main\n   |\nLL |     let y = Int(2);\n   |         - consider changing this to `mut y`\nLL |     //~^ consider changing this to `mut y`\nLL |     y   //~ error: cannot borrow immutable local variable `y` as mutable\n   |     ^ cannot borrow mutably\n\n"}
[00:48:30] {"message":"use of moved value: `x`","code":{"code":"E0382","explanation":"\nThis error occurs when an attempt is made to use a variable after its contents\nhave been moved elsewhere. For example:\n\n```compile_fail,E0382\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = MyStruct{ s: 5u32 };\n    let y = x;\n    x.s = 6;\n    println!(\"{}\", x.s);\n}\n```\n\nSince `MyStruct` is a type that is not marked `Copy`, the data gets moved out\nof `x` when we set `y`. This is fundamental to Rust's ownership system: outside\nof workarounds like `Rc`, a value cannot be owned by more than one variable.\n\nSometimes we don't need to move the value. Using a reference, we can let another\nfunction borrow the value without changing its ownership. In the example below,\nwe don't actually have to move our string to `calculate_length`, we can give it\na reference to it with `&` instead.\n\n```\nfn main() {\n    let s1 = String::from(\"hello\");\n\n    let len = calculate_length(&s1);\n\n    println!(\"The length of '{}' is {}.\", s1, len);\n}\n\nfn calculate_length(s: &String) -> usize {\n    s.len()\n}\n```\n\nA mutable reference can be created with `&mut`.\n\nSometimes we don't want a reference, but a duplicate. All types marked `Clone`\ncan be duplicated by calling `.clone()`. Subsequent changes to a clone do not\naffect the original variable.\n\nMost types in the standard library are marked `Clone`. The example below\ndemonstrates using `clone()` on a string. `s1` is first set to \"many\", and then\ncopied to `s2`. Then the first character of `s1` is removed, without affecting\n`s2`. \"any many\" is printed to the console.\n\n```\nfn main() {\n    let mut s1 = String::from(\"many\");\n    let s2 = s1.clone();\n    s1.remove(0);\n    println!(\"{} {}\", s1, s2);\n}\n```\n\nIf we control the definition of a type, we can implement `Clone` on it ourselves\nwith `#[derive(Clone)]`.\n\nSome types have no ownership semantics at all and are trivial to duplicate. An\nexample is `i32` and the other number types. We don't have to call `.clone()` to\nclone them, because they are marked `Copy` in addition to `Clone`.  Implicit\ncloning is more convenient in this case. We can mark our own types `Copy` if\nall their members also are marked `Copy`.\n\nIn the example below, we implement a `Point` type. Because it only stores two\nintegers, we opt-out of ownership semantics with `Copy`. Then we can\n`let p2 = p1` without `p1` being moved.\n\n```\n#[derive(Copy, Clone)]\nstruct Point { x: i32, y: i32 }\n\nfn main() {\n    let mut p1 = Point{ x: -1, y: 2 };\n    let p2 = p1;\n    p1.x = 1;\n    println!(\"p1: {}, {}\", p1.x, p1.y);\n    println!(\"p2: {}, {}\", p2.x, p2.y);\n}\n```\n\nAlternatively, if we don't control the struct's definition, or mutable shared\nownership is truly required, we can use `Rc` and `RefCell`:\n\n```\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nstruct MyStruct { s: u32 }\n\nfn main() {\n    let mut x = Rc::new(RefCell::new(MyStruct{ s: 5u32 }));\n    let y = x.clone();\n    x.borrow_mut().s = 6;\n    println!(\"{}\", x.borrow().s);\n}\n```\n\nWith this approach, x and y share ownership of the data via the `Rc` (reference\ncount type). `RefCell` essentially performs runtime borrow checking: ensuring\nthat at most one writer or multiple readers can access the data at any one time.\n\nIf you wish to learn more about ownership in Rust, start with the chapter in the\nBook:\n\nhttps://doc.rust-lang.org/book/first-edition/ownership.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/augmented-assignments.rs","byte_start":649,"byte_end":650,"line_start":23,"line_end":23,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    x   //~ error: use of moved value: `x`","highlight_start":5,"highlight_end":6}],"label":"value used here after move","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/augmented-assignments.rs","byte_start":735,"byte_end":736,"line_start":26,"line_end":26,"column_start":5,"column_end":6,"is_primary":false,"text":[{"text":"    x;  //~ value moved here","highlight_start":5,"highlight_end":6}],"label":"value moved here","suggested_replacement":null,"expansion":null}],"children":[{"message":"move occurs because `x` has type `Int`, which does not implement the `Copy` trait","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0382]: use of moved value: `x`\n  --> /checkout/src/test/ui/augmented-assignments.rs:23:5: in fn main\n   |\nLL |     x   //~ error: use of moved value: `x`\n   |     ^ value used here after move\n...\nLL |     x;  //~ value moved here\n   |     - value moved here\n   |\n   = note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait\n\n"}
[00:48:30] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:48:30] {"message":"Some errors occurred: E0382, E0596.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0382, E0596.\n"}
[00:48:30] {"message":"For more information about an error, try `rustc --explain E0382`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0382`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/augmented-assignments.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/block-result/block-must-not-have-result-do.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0308]: mismatched types
[00:48:30] -   --> $DIR/block-must-not-have-result-do.rs:13:9
[00:48:30] +   --> $DIR/block-must-not-have-result-do.rs:13:9: in fn main
[00:48:30] 3    |
[00:48:30] 4 LL |         true //~  ERROR mismatched types
[00:48:30] 5    |         ^^^^ expected (), found bool
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/block-result/block-must-not-have-result-do.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'block-result/block-must-not-have-result-do.rs'
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/block-result/block-must-not-have-result-do.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/block-result/block-must-not-have-result-do.stage2-x86_64-unknown-linux-gnu" "-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/block-result/block-must-not-have-result-do.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] ------------------------------------------
[00:48:30] stderr:
[00:48:30] stderr:
[00:48:30] ------------------------------------------
[00:48:30] {"message":"mismatched types","code":{"code":"E0308","explanation":"\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can occur for several cases, the most common of which is a\nmismatch in the expected type that the compiler inferred for a variable's\ninitializing expression, and the actual type explicitly assigned to the\nvariable.\n\nFor example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n//     ~~~   ~~~~~~~~~~~~~~~~~~~~\n//      |             |\n//      |    initializing expression;\n//      |    compiler infers type `&str`\n//      |\n//    type `i32` assigned to variable `x`\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/block-result/block-must-not-have-result-do.rs","byte_start":498,"byte_end":502,"line_start":13,"line_end":13,"column_start":9,"column_end":13,"is_primary":true,"text":[{"text":"        true //~  ERROR mismatched types","highlight_start":9,"highlight_end":13}],"label":"expected (), found bool","suggested_replacement":null,"expansion":null}],"children":[{"message":"expected type `()`\n   found type `bool`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0308]: mismatched types\n  --> /checkout/src/test/ui/block-result/block-must-not-have-result-do.rs:13:9: in fn main\n   |\nLL |         true //~  ERROR mismatched types\n   |         ^^^^ expected (), found bool\n   |\n   = note: expected type `()`\n              found type `bool`\n\n"}
[00:48:30] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:48:30] {"message":"For more information about this error, try `rustc --explain E0308`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0308`.\n"}
[00:48:30] ------------------------------------------
[00:48:30] 
[00:48:30] thread '[ui] ui/block-result/block-must-not-have-result-do.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:48:30] 
[00:48:30] 
[00:48:30] ---- [ui] ui/block-result/block-must-not-have-result-res.rs stdout ----
[00:48:30]  diff of stderr:
[00:48:30] 
[00:48:30] 1 error[E0308]: mismatched types
[00:48:30] -   --> $DIR/block-must-not-have-result-res.rs:15:9
[00:48:30] +   --> $DIR/block-must-not-have-result-res.rs:15:9: in fn drop::drop
[00:48:30] 3    |
[00:48:30] 4 LL |     fn drop(&mut self) {
[00:48:30] 5    |                        - expected `()` because of default return type
[00:48:30] 
[00:48:30] The actual stderr differed from the expected stderr.
[00:48:30] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/block-result/block-must-not-have-result-res.stderr
[00:48:30] To update references, run this command from build directory:
[00:48:30] To update references, run this command from build directory:
[00:48:30] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'block-result/block-must-not-have-result-res.rs'
[00:48:30] error: 1 errors occurred comparing output.
[00:48:30] status: exit code: 101
[00:48:30] status: exit code: 101
[00:48:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/block-result/block-must-not-have-result-res.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/block-result/block-must-not-have-result-res.stage2-x86_64-unknown-linux-gnu" "-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/block-result/block-must-not-have-result-res.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"

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)

@sophiajt
Copy link
Contributor

@nikomatsakis - reminded you pinged about this.

When we designed the current error messages, we did go through an iteration of giving more information about the location. When we did our original survey of developers, many said the first they they look for is the file and line number.

After seeing this pattern, we simplified the idea down to have the file and line number on a line by itself. The drawback of this proposal is that it loses some of that, and it makes it more difficult to, at-a-glance, catch the file and line number for those types of developers.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:49:44] ....................................................................................................
[00:49:48] ....................................................................................................
[00:49:53] ....................................................................................................
[00:49:59] ....................................................................................................
[00:50:05] ........F.............F.F...........................................................................
[00:50:16] ..........................i.........................................................................
[00:50:16] ..........................i.........................................................................
[00:50:22] ................................F.............ii....................................................
[00:50:28] ...........................................................F........................................
[00:50:36] ...............................................i....................F....F.F........................
ckout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-49851/compiler-builtins-error.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "thumbv7em-none-eabihf" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-49851/compiler-builtins-error.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] ------------------------------------------
[00:50:37] stderr:
[00:50:37] stderr:
[00:50:37] ------------------------------------------
[00:50:37] {"message":"can't find crate for `core`","code":{"code":"E0463","explanation":"\nA plugin/crate was declared but cannot be found. Erroneous code example:\n\n```compile_fail,E0463\n#![feature(plugin)]\n#![plugin(cookie_monster)] // error: can't find crate for `cookie_monster`\nextern crate cake_is_a_lie; // error: can't find crate for `cake_is_a_lie`\n```\n\nYou need to link your code to the relevant crate in order to be able to use it\n(through Cargo or the `-L` option of rustc example). Plugins are crates as\nwell, and you link to them the same way.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issue-49851/compiler-builtins-error.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"//~ ERROR 1:1: 1:1: can't find crate for `core` [E0463]","highlight_start":1,"highlight_end":1}],"label":"can't find crate","suggested_replacement":null,"expansion":null}],"children":[{"message":"the `thumbv7em-none-eabihf` target may not be installed","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0463]: can't find crate for `core`\n   |\n   = note: the `thumbv7em-none-eabihf` target may not be installed\n\n"}
[00:50:37] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:50:37] {"message":"For more information about this error, try `rustc --explain E0463`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0463`.\n"}
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] thread '[ui] ui/issue-49851/compiler-builtins-error.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:50:37] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:50:37] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:50:37] 
[00:50:37] ---- [ui] ui/label_break_value_continue.rs stdout ----
[00:50:37]  diff of stderr:
[00:50:37] 
[00:50:37] 1 error[E0695]: unlabeled `continue` inside of a labeled block
[00:50:37] -   --> $DIR/label_break_value_continue.rs:16:9
[00:50:37] +   --> $DIR/label_break_value_continue.rs:16:9: in fn continue_simple
[00:50:37] 3    |
[00:50:37] 4 LL |         continue; //~ ERROR unlabeled `continue` inside of a labeled block
[00:50:37] 5    |         ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label
[00:50:37] 6 
[00:50:37] 6 
[00:50:37] 7 error[E0696]: `continue` pointing to a labeled block
[00:50:37] -   --> $DIR/label_break_value_continue.rs:23:9
[00:50:37] +   --> $DIR/label_break_value_continue.rs:23:9: in fn continue_labeled
[00:50:37] 9    |
[00:50:37] 10 LL |         continue 'b; //~ ERROR `continue` pointing to a labeled block
[00:50:37] 11    |         ^^^^^^^^^^^ labeled blocks cannot be `continue`'d
[00:50:37] 12    |
[00:50:37] 12    |
[00:50:37] 13 note: labeled block the continue points to
[00:50:37] -   --> $DIR/label_break_value_continue.rs:22:5
[00:50:37] +   --> $DIR/label_break_value_continue.rs:22:5: in fn continue_labeled
[00:50:37] 15    |
[00:50:37] 16 LL | /     'b: {
[00:50:37] 17 LL | |         continue 'b; //~ ERROR `continue` pointing to a labeled block
[00:50:37] 19    | |_____^
[00:50:37] 20 
[00:50:37] 20 
[00:50:37] 21 error[E0695]: unlabeled `continue` inside of a labeled block
[00:50:37] -   --> $DIR/label_break_value_continue.rs:31:13
[00:50:37] +   --> $DIR/label_break_value_continue.rs:31:13: in fn continue_crossing
[00:50:37] 23    |
[00:50:37] 24 LL |             continue; //~ ERROR unlabeled `continue` inside of a labeled block
[00:50:37] 25    |             ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label
[00:50:37] 
[00:50:37] The actual stderr differed from the expected stderr.
[00:50:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/label_break_value_continue.stderr
[00:50:37] To update references, run this command from build directory:
[00:50:37] To update references, run this command from build directory:
[00:50:37] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'label_break_value_continue.rs'
[00:50:37] error: 1 errors occurred comparing output.
[00:50:37] status: exit code: 101
[00:50:37] status: exit code: 101
[00:50:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/label_break_value_continue.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/label_break_value_continue.stage2-x86_64-unknown-linux-gnu" "-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/label_break_value_continue.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] ------------------------------------------
[00:50:37] stderr:
[00:50:37] stderr:
[00:50:37] ------------------------------------------
[00:50:37] {"message":"unlabeled `continue` inside of a labeled block","code":{"code":"E0695","explanation":"\nA `break` statement without a label appeared inside a labeled block.\n\nExample of erroneous code:\n\n```compile_fail,E0695\n# #![feature(label_break_value)]\nloop {\n    'a: {\n        break;\n    }\n}\n```\n\nMake sure to always label the `break`:\n\n```\n# #![feature(label_break_value)]\n'l: loop {\n    'a: {\n        break 'l;\n    }\n}\n```\n\nOr if you want to `break` the labeled block:\n\n```\n# #![feature(label_break_value)]\nloop {\n    'a: {\n        break 'a;\n    }\n    break;\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/label_break_value_continue.rs","byte_start":615,"byte_end":623,"line_start":16,"line_end":16,"column_start":9,"column_end":17,"is_primary":true,"text":[{"text":"        continue; //~ ERROR unlabeled `continue` inside of a labeled block","highlight_start":9,"highlight_end":17}],"label":"`continue` statements that would diverge to or through a labeled block need to bear a label","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0695]: unlabeled `continue` inside of a labeled block\n  --> /checkout/src/test/ui/label_break_value_continue.rs:16:9: in fn continue_simple\n   |\nLL |         continue; //~ ERROR unlabeled `continue` inside of a labeled block\n   |         ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label\n\n"}
[00:50:37] {"message":"`continue` pointing to a labeled block","code":{"code":"E0696","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/label_break_value_continue.rs","byte_start":809,"byte_end":820,"line_start":23,"line_end":23,"column_start":9,"column_end":20,"is_primary":true,"text":[{"text":"        continue 'b; //~ ERROR `continue` pointing to a labeled block","highlight_start":9,"highlight_end":20}],"label":"labeled blocks cannot be `continue`'d","suggested_replacement":null,"expansion":null}],"children":[{"message":"labeled block the continue points to","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/label_break_value_continue.rs","byte_start":795,"byte_end":876,"line_start":22,"line_endak_value_continue.rs","byte_start":1019,"byte_end":1027,"line_start":31,"line_end":31,"column_start":13,"column_end":21,"is_primary":true,"text":[{"text":"            continue; //~ ERROR unlabeled `continue` inside of a labeled block","highlight_start":13,"highlight_end":21}],"label":"`continue` statements that would diverge to or through a labeled block need to bear a label","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0695]: unlabeled `continue` inside of a labeled block\n  --> /checkout/src/test/ui/label_break_value_continue.rs:31:13: in fn continue_crossing\n   |\nLL |             continue; //~ ERROR unlabeled `continue` inside of a labeled block\n   |             ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label\n\n"}
[00:50:37] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:50:37] {"message":"Some errors occurred: E0695, E0696.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0695, E0696.\n"}
[00:50:37] {"message":"For more information about an error, try `rustc --explain E0695`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0695`.\n"}
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] thread '[ui] ui/label_break_value_continue.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:50:37] 
[00:50:37] 
[00:50:37] ---- [ui] ui/label_break_value_unlabeled_break.rs stdout ----
[00:50:37]  diff of stderr:
[00:50:37] 
[00:50:37] 1 error[E0695]: unlabeled `break` inside of a labeled block
[00:50:37] -   --> $DIR/label_break_value_unlabeled_break.rs:16:9
[00:50:37] +   --> $DIR/label_break_value_unlabeled_break.rs:16:9: in fn unlabeled_break_simple
[00:50:37] 3    |
[00:50:37] 4 LL |         break; //~ ERROR unlabeled `break` inside of a labeled block
[00:50:37] 5    |         ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label
[00:50:37] 6 
[00:50:37] 6 
[00:50:37] 7 error[E0695]: unlabeled `break` inside of a labeled block
[00:50:37] -   --> $DIR/label_break_value_unlabeled_break.rs:24:13
[00:50:37] +   --> $DIR/label_break_value_unlabeled_break.rs:24:13: in fn unlabeled_break_crossing
[00:50:37] 9    |
[00:50:37] 10 LL |             break; //~ ERROR unlabeled `break` inside of a labeled block
[00:50:37] 11    |             ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label
[00:50:37] 
[00:50:37] The actual stderr differed from the expected stderr.
[00:50:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/label_break_value_unlabeled_break.stderr
[00:50:37] To update references, run this command from build directory:
[00:50:37] To update references, run this command from build directory:
[00:50:37] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'label_break_value_unlabeled_break.rs'
[00:50:37] error: 1 errors occurred comparing output.
[00:50:37] status: exit code: 101
[00:50:37] status: exit code: 101
[00:50:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bint would diverge to or through a labeled block need to bear a label","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0695]: unlabeled `break` inside of a labeled block\n  --> /checkout/src/test/ui/label_break_value_unlabeled_break.rs:24:13: in fn unlabeled_break_crossing\n   |\nLL |             break; //~ ERROR unlabeled `break` inside of a labeled block\n   |             ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label\n\n"}
[00:50:37] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:50:37] {"message":"For more information about this error, try `rustc --explain E0695`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0695`.\n"}
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] thread '[ui] ui/label_break_value_unlabeled_break.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:50:37] 
[00:50:37] 
[00:50:37] ---- [ui] ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs stdout ----
[00:50:37]  diff of stderr:
[00:50:37] 
[00:50:37] 1 error[E0277]: `main` has invalid return type `impl std::marker::Copy`
[00:50:37] -   --> $DIR/termination-trait-impl-trait.rs:12:14
[00:50:37] +   --> $DIR/termination-trait-impl-trait.rs:12:14: in fn main
[00:50:37] 3    |
[00:50:37] 4 LL | fn main() -> impl Copy { }
[00:50:37] 5    |              ^^^^^^^^^ `main` can only return types that implement `std::prer::Copy`","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/rfc-1937-termination-trait/termination-trait-impl-trait.rs","byte_start":556,"byte_end":565,"line_start":12,"line_end":12,"column_start":14,"column_end":23,"is_primary":true,"text":[{"text":"fn main() -> impl Copy { }","highlight_start":14,"highlight_end":23}],"label":"`main` can only return types that implement `std::process::Termination`","suggested_replacement":null,"expansion":null}],"children":[{"message":"consider using `()`, or a `Result`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: `main` has invalid return type `impl std::marker::Copy`\n  --> /checkout/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs:12:14: in fn main\n   |\nLL | fn main() -> impl Copy { }\n   |              ^^^^^^^^^ `main` can only return types that implement `std::process::Termination`\n   |\n   = help: consider using `()`, or a `Result`\n\n"}
[00:50:37] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:50:37] {"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:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] thread '[ui] ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:50:37] 
[00:50:37] 
[00:50:37] ---- [ui] ui/span/method-and-field-eager-resolution.rs stdout ----
[00:50:37]  diff of stderr:
[00:50:37] 
[00:50:37] 1 error[E0282]: type annotations needed
[00:50:37] -   --> $DIR/method-and-field-eager-resolution.rs:15:5
[00:50:37] +   --> $DIR/method-and-field-eager-resolution.rs:15:5: in fn main
[00:50:37] 3    |
[00:50:37] 4 LL |     let mut x = Default::default();
[00:50:37] 5    |         ----- consider giving `x` a type
[00:50:37] 
[00:50:37] 9    = note: type must be known at this point
[00:50:37] 11 error[E0282]: type annotations needed
[00:50:37] -   --> $DIR/method-and-field-eager-resolution.rs:22:5
[00:50:37] -   --> $DIR/method-and-field-eager-resolution.rs:22:5
[00:50:37] +   --> $DIR/method-and-field-eager-resolution.rs:22:5: in fn foo
[00:50:37] 13    |
[00:50:37] 14 LL |     let mut x = Default::default();
[00:50:37] 15    |         ----- consider giving `x` a type
[00:50:37] 
[00:50:37] The actual stderr differed from the expected stderr.
[00:50:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/span/method-and-field-eager-resolution.stderr
[00:50:37] To update references, run this command from build directory:
[00:50:37] To update references, run this command from build directory:
[00:50:37] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'span/method-and-field-eager-resolution.rs'
[00:50:37] error: 1 errors occurred comparing output.
[00:50:37] status: exit code: 101
[00:50:37] status: exit code: 101
[00:50:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/span/method-and-field-eager-resolution.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/span/method-and-field-eager-resolution.stage2-x86_64-unknown-linux-gnu" "-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/span/method-and-field-eager-resolution.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] ------------------------------------------
[00:50:37] stderr:
[00:50:37] stderr:
[00:50:37] ------------------------------------------
[00:50:37] {"message":"type annotations needed","code":{"code":"E0282","explanation":"\nThis error indicates that type inference did not result in one unique possible\ntype, and extra information is required. In most cases this can be provided\nby adding a type annotation. Sometimes you need to specify a generic type\nparameter manually.\n\nA common example is the `collect` method on `Iterator`. It has a generic type\nparameter with a `FromIterator` bound, which for a `char` iterator is\nimplemented by `Vec` and `String` among others. Consider the following snippet\nthat reverses the characters of a string:\n\n```compile_fail,E0282\nlet x = \"hello\".chars().rev().collect();\n```\n\nIn this case, the compiler cannot infer what the type of `x` should be:\n`Vec<char>` and `String` are both suitable candidates. To specify which type to\nuse, you can use a type annotation on `x`:\n\n```\nlet x: Vec<char> = \"hello\".chars().rev().collect();\n```\n\nIt is not necessary to annotate the full type. Once the ambiguity is resolved,\nthe compiler can infer the rest:\n\n```\nlet x: Vec<_> = \"hello\".chars().rev().collect();\n```\n\nAnother way to provide the compiler with enough information, is to specify the\ngeneric type parameter:\n\n```\nlet x = \"hello\".chars().rev().collect::<Vec<char>>();\n```\n\nAgain, you need not specify the full type if the compiler can infer it:\n\n```\nlet x = \"hello\".chars().rev().collect::<Vec<_>>();\n```\n\nApart from a method or function with a generic type parameter, this error can\noccur when a type parameter of a struct or trait cannot be inferred. In that\ncase it is not always possible to use a type annotation, because all candidates\nhave the same return type. For instance:\n\n```compile_fail,E0282\nstruct Foo<T> {\n    num: T,\n}\n\nimpl<T> Foo<T> {\n    fn bar() -> i32 {\n        0\n    }\n\n    fn baz() {\n        let number = Foo::bar();\n    }\n}\n```\n\nThis will fail because the compiler does not know which instance of `Foo` to\ncall `bar` on. Change `Foo::bar()` to `Foo::<T>::bar()` to resolve the error.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/span/method-and-field-eager-resolution.rs","byte_start":607,"byte_end":608,"line_start":15,"line_end":15,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    x.0;","highlight_start":5,"highlight_end":6}],"label":"cannot infer type for `_`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/span/method-and-field-eager-resolution.rs","byte_start":575,"byte_end":580,"line_start":14,"line_end":14,"column_start":9,"column_end":14,"is_primary":false,"text":[{"text":"    let mut x = Default::default();","highlight_start":9,"highlight_end":14}],"label":"consider giving `x` a type","suggested_replacement":null,"expansion":null}],"children":[{"message":"type must be known at this point","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0282]: type annotations needed\n  --> /checkout/src/test/ui/span/method-and-field-eager-resolution.rs:15:5: in fn main\n   |\nLL |     let mut x = Default::default();\n   |         ----- consider giving `x` a type\nLL |     x.0;\n   |     ^ cannot infer type for `_`\n   |\n   = note: type must be known at this point\n\n"}
[00:50:37] {"message":"type annotations needed","code":{"code":"E0282","explanation":"\nThis error indicates that type inference did not result in one unique possible\ntype, and extra information is required. In most cases this can be provided\nby adding a type annotation. Sometimes you need to specify a generic type\nparameter manually.\n\nA common example is the `collect` method on `Iterator`. It has a generic type\nparameter with a `FromIterator` bound, which for a `char` iterator is\nimplemented by `Vec` and `String` among others. Consider the following snippet\nthat reverses the characters of a string:\n\n```compile_fail,E0282\nlet x = \"hello\".chars().rev().collect();\n```\n\nIn this case, the compiler cannot infer what the type of `x` should be:\n`Vec<char>` and `String` are both suitable candidates. To specify which type to\nuse, you can use a type annotation on `x`:\n\n```\nlet x: Vec<char> = \"hello\".chars().rev().collect();\n```\n\nIt is not necessary to annotate the full type. Once the ambiguity is resolved,\nthe compiler can infer the rest:\n\n```\nlet x: Vec<_> = \"hello\".chars().rev().collect();\n```\n\nAnother way to provide the compiler with enough information, is to specify the\ngeneric type parameter:\n\n```\nlet x = \"hello\".chars().rev().collect::<Vec<char>>();\n```\n\nAgain, you need not specify the full type if the compiler can infer it:\n\n```\nlet x = \"hello\".chars().rev().collect::<Vec<_>>();\n```\n\nApart from a method or function with a generic type parameter, this error can\noccur when a type parameter of a struct or trait cannot be inferred. In that\ncase it is not always possible to use a type annotation, because all candidates\nhave the same return type. For instance:\n\n```compile_fail,E0282\nstruct Foo<T> {\n    num: T,\n}\n\nimpl<T> Foo<T> {\n    fn bar() -> i32 {\n        0\n    }\n\n    fn baz() {\n        let number = Foo::bar();\n    }\n}\n```\n\nThis will fail because the compiler does not know which instance of `Foo` to\ncall `bar` on. Change `Foo::bar()` to `Foo::<T>::bar()` to resolve the error.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/span/method-and-field-eager-resolution.rs","byte_start":716,"byte_end":717,"line_start":22,"line_end":22,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    x[0];","highlight_start":5,"highlight_end":6}],"label":"cannot infer type for `_`","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/span/method-and-field-eager-resolution.rs","byte_start":684,"byte_end":689,"line_start":21,"line_end":21,"column_start":9,"column_end":14,"is_primary":false,"text":[{"text":"    let mut x = Default::default();","highlight_start":9,"highlight_end":14}],"label":"consider giving `x` a type","suggested_replacement":null,"expansion":null}],"children":[{"message":"type must be known at this point","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0282]: type annotations needed\n  --> /checkout/src/test/ui/span/method-and-field-eager-resolution.rs:22:5: in fn foo\n   |\nLL |     let mut x = Default::default();\n   |         ----- consider giving `x` a type\nLL |     x[0];\n   |     ^ cannot infer type for `_`\n   |\n   = note: type must be known at this point\n\n"}
[00:50:37] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:50:37] {"message":"For more information about this error, try `rustc --explain E0282`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, tu8,\n}\n\nfn main() {\n    let mut fancy = FancyNum{ num: 5 };\n    let fancy_ref = &(&mut fancy);\n    fancy_ref.num = 6; // error: cannot assign to data in a `&` reference\n    println!(\"{}\", fancy_ref.num);\n}\n```\n\nHere, `&mut fancy` is mutable, but `&(&mut fancy)` is not. Creating an\nimmutable reference to a value borrows it immutably. There can be multiple\nreferences of type `&(&mut T)` that point to the same value, so they must be\nimmutable to prevent multiple mutable references to the same value.\n\nTo fix this, either remove the outer reference:\n\n```\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy = FancyNum{ num: 5 };\n\n    let fancy_ref = &mut fancy;\n    // `fancy_ref` is now &mut FancyNum, rather than &(&mut FancyNum)\n\n    fancy_ref.num = 6; // No error!\n\n    println!(\"{}\", fancy_ref.num);\n}\n```\n\nOr make the outer reference mutable:\n\n```\nstruct FancyNum {\n    num: u8\n}\n\nfn main() {\n    let mut fancy = FancyNum{ num: 5 };\n\n    let fancy_ref = &mut (&mut fancy);\n    // `fancy_ref` is now &mut(&mut FancyNum), rather than &(&mut FancyNum)\n\n    fancy_ref.num = 6; // No error!\n\n    println!(\"{}\", fancy_ref.num);\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs","byte_start":670,"byte_end":672,"line_start":16,"line_end":16,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    *t //~ ERROR","highlight_start":5,"highlight_end":7}],"label":"assignment into an immutable reference","suggested_replacement":null,"expansion":null},{"file_name":"/checkout/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs","byte_start":608,"byte_end":623,"line_start":15,"line_end":15,"column_start":24,"column_end":39,"is_primary":false,"text":[{"text":"fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy {","highlight_start":24,"highlight_end":39}],"label":"use `&'a mut &'a mut i32` here to make mutable","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0389]: cannot borrow data mutably in a `&` reference\n  --> /checkout/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs:16:5: in fn reborrow_mut\n   |\nLL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy {\n   |                        --------------- use `&'a mut &'a mut i32` here to make mutable\nLL |     *t //~ ERROR\n   |     ^^ assignment into an immutable reference\n\n"}
[00:50:37] {"message":"cannot borrow data mutably in a `&` reference","code":{"code":"E0389","explanation":"\nAn attempt was made to mutate data using a non-mutable reference. This\ncommonly occurs when attempting to assign to a non-mutable reference of a\nmutable reference (`&(&mut T)`).\n\nExample of erroneous code:\n\n```compile_fail,E0389\nstruct FancyNum {\n    num: u8,\n}\n\nfn main() {\n    let mut fancy = FancyNum{ num: 5 };\n    let fancy_ref = &(&mut fancy);\n    fancy_ref.num = 6; // error: cannot assign to data in a `&` reference\n    println!(\"{}\", fancy_ref.num);\n}\n```\n\nHere, `&mut fancy` is mutable, but `&(&mut fancy)` is not. Creating an\nimmutable reference to a value borrows it immutably. There can be multiple\nreferences of type `&(&mut T)` that point to the same value, so theygnu/test/ui/trivial-bounds-leak-copy.stderr
[00:50:37] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'trivial-bounds-leak-copy.rs'
[00:50:37] 
[00:50:37] error: 1 errors occurred comparing output.
[00:50:37] status: exit code: 101
[00:50:37] status: exit code: 101
[00:50:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/trivial-bounds-leak-copy.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/trivial-bounds-leak-copy.stage2-x86_64-unknown-linux-gnu" "-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/trivial-bounds-leak-copy.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] ------------------------------------------
[00:50:37] stderr:
[00:50:37] stderr:
[00:50:37] ------------------------------------------
[00:50:37] {"message":"cannot move out of borrowed content","code":{"code":"E0507","explanation":"\nYou tried to move out of a value which was borrowed. Erroneous code example:\n\n```compile_fail,E0507\nuse std::cell::RefCell;\n\nstruct TheDarkKnight;\n\nimpl TheDarkKnight {\n    fn nothing_is_true(self) {}\n}\n\nfn main() {\n    let x = RefCell::new(TheDarkKnight);\n\n    x.borrow().nothing_is_true(); // er_is_true(); // E0507\n}\n```\n\nIt is fine only if you put something back. `mem::replace` can be used for that:\n\n```\n# struct TheDarkKnight;\n# impl TheDarkKnight { fn nothing_is_true(self) {} }\n# struct Batcave { knight: TheDarkKnight }\nuse std::mem;\n\nlet mut cave = Batcave {\n    knight: TheDarkKnight\n};\nlet borrowed = &mut cave;\n\nmem::replace(&mut borrowed.knight, TheDarkKnight).nothing_is_true(); // ok!\n```\n\nYou can find more information about borrowing in the rust-book:\nhttp://doc.rust-lang.org/book/first-edition/references-and-borrowing.html\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/trivial-bounds-leak-copy.rs","byte_start":658,"byte_end":660,"line_start":19,"line_end":19,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":"    *t //~ ERROR","highlight_start":5,"highlight_end":7}],"label":"cannot move out of borrowed content","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0507]: cannot move out of borrowed content\n  --> /checkout/src/test/ui/trivial-bounds-leak-copy.rs:19:5: in fn move_out_string\n   |\nLL |     *t //~ ERROR\n   |     ^^ cannot move out of borrowed content\n\n"}
[00:50:37] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:50:37] {"message":"For more information about this error, try `rustc --explain E0507`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0507`.\n"}
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] thread '[ui] ui/trivial-bounds-leak-copy.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:50:37] 
[00:50:37] 
[00:50:37] ---- [ui] ui/trivial-bounds-leak.rs stdout ----
[00:50:37]  diff of stderr:
[00:50:37] 
[00:50:37] 1 error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
[00:50:37] -   --> $DIR/trivial-bounds-leak.rs:22:25
[00:50:37] +   --> $DIR/trivial-bounds-leak.rs:22:25: in fn cant_return_str
[00:50:37] 3    |
[00:50:37] 4 LL | fn cant_return_str() -> str { //~ ERROR
[00:50:37] 5    |                         ^^^ `str` does not have a constant size known at compile-time
[00:50:37] 
[00:50:37] 8    = note: the return type of a function must have a statically known size
[00:50:37] 9 
[00:50:37] 10 error[E0599]: no method named `test` found for type `i32` in the current scope
[00:50:37] -   --> $DIR/trivial-bounds-leak.rs:34:10
[00:50:37] +   --> $DIR/trivial-bounds-leak.rs:34:10: in fn foo
[00:50:37] 12    |
[00:50:37] 13 LL |     3i32.test(); //~ ERROR
[00:50:37] 
[00:50:37] 18            candidate #1: `Foo`
[00:50:37] 19 
[00:50:37] 19 
[00:50:37] 20 error[E0277]: the trait bound `i32: Foo` is not satisfied
[00:50:37] -   --> $DIR/trivial-bounds-leak.rs:35:5
[00:50:37] +   --> $DIR/trivial-bounds-leak.rs:35:5: in fn foo
[00:50:37] 22    |
[00:50:37] 23 LL |     Foo::test(&4i32); //~ ERROR
[00:50:37] 24    |     ^^^^^^^^^ the trait `Foo` is not implemented for `i32`
[00:50:37] 25    |
[00:50:37] 25    |
[00:50:37] 26 note: required by `Foo::test`
[00:50:37] -   --> $DIR/trivial-bounds-leak.rs:15:5
[00:50:37] +   --> $DIR/trivial-bounds-leak.rs:15:5: in trait Foo
[00:50:37] 28    |
[00:50:37] 29 LL |     fn test(&self);
[00:50:37] 
[00:50:37] 31 
[00:50:37] 31 
[00:50:37] 32 error[E0277]: the trait bound `i32: Foo` is not satisfied
[00:50:37] -   --> $DIR/trivial-bounds-leak.rs:36:5
[00:50:37] +   --> $DIR/trivial-bounds-leak.rs:36:5: in fn foo
[00:50:37] 34    |
[00:50:37] 35 LL |     generic_function(5i32); //~ ERROR
[00:50:37] 36    |     ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
[00:50:37] 
[00:50:37] The actual stderr differed from the expected stderr.
[00:50:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/trivial-bounds-leak.stderr
[00:50:37] To update references, run this command from build directory:
[00:50:37] To update references, run this command from build directory:
[00:50:37] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'trivial-bounds-leak.rs'
[00:50:37] 
[00:50:37] error: 1 errors occurred comparing output.
[00:50:37] status: exit code: 101
[00:50:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/trivial-bounds-leak.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/trivial-bounds-leak.stage2-x86_64-unknown-linux-gnu" "-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/trivial-bounds-leak.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] ------------------------------------------
[00:50:37] stderr:
[00:50:37] stderr:
[00:50:37] ------------------------------------------
[00:50:37] {"message":"the trait bound `str: std::marker::Sized` 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   or[E0599]: no method named `test` found for type `i32` in the current scope\n  --> /checkout/src/test/ui/trivial-bounds-leak.rs:34:10: in fn foo\n   |\nLL |     3i32.test(); //~ ERROR\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 `test`, perhaps you need to implement it:\n           candidate #1: `Foo`\n\n"}
[00:50:37] {"message":"the trait bound `i32: Foo` 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    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/trivial-bounds-leak.rs","byte_start":891,"byte_end":900,"line_start":35,"line_end":35,"column_start":5,"column_end":14,"is_primary":true,"text":[{"text":"    Foo::test(&4i32); //~ ERROR","highlight_start":5,"highlight_end":14}],"label":"the trait `Foo` is not implemented for `i32`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `Foo::test`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/trivgeneric_function(5i32); //~ ERROR","highlight_start":5,"highlight_end":21}],"label":"the trait `Foo` is not implemented for `i32`","suggested_replacement":null,"expansion":null}],"children":[{"message":"required by `generic_function`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/trivial-bounds-leak.rs","byte_start":960,"byte_end":993,"line_start":39,"line_end":39,"column_start":1,"column_end":34,"is_primary":true,"text":[{"text":"fn generic_function<T: Foo>(t: T) {}","highlight_start":1,"highlight_end":34}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `i32: Foo` is not satisfied\n  --> /checkout/src/test/ui/trivial-bounds-leak.rs:36:5: in fn foo\n   |\nLL |     generic_function(5i32); //~ ERROR\n   |     ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`\n   |\nnote: required by `generic_function`\n  --> /checkout/src/test/ui/trivial-bounds-leak.rs:39:1\n   |\nLL | fn generic_function<T: Foo>(t: T) {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[00:50:37] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:50:37] {"message":"Some errors occurred: E0277, E0599.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0277, E0599.\n"}
[00:50:37] {"message":"For more information about an error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0277`.\n"}
[00:50:37] ------------------------------------------
[00:50:37] 
[00:50:37] thread '[ui] ui/trivial-bounds-leak.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3033:9
[00:50:37] 
---
[00:50:37] 
[00:50:37] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:492:22
[00:50:37] 
[00:50:37] 
[00:50:37] 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-3.9/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" "3.9.1\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:50:37] 
[00:50:37] 
[00:50:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:37] Build completed unsuccessfully in 0:02:35
[00:50:37] Build completed unsuccessfully in 0:02:35
[00:50:37] make: *** [check] Error 1
[00:50:37] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0e5fa80c
$ 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)

da-x added 2 commits May 17, 2018 15:42
So far, rustc has only printed about filenames and line numbers for
warnings and errors. I think it is rather missed, compared to `gcc`
and other compiler, that useful context information such as function
names and structs is not included.

The changes in this pull request introduce a new line emission in
diagnostics to implement this.
@da-x da-x force-pushed the scope-names-in-diagnostics branch from 6efc19e to 5de482c Compare May 17, 2018 13:35
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:49:27] ....................................................................................................
[00:49:30] ....................................................................................................
[00:49:35] ....................................................................................................
[00:49:40] ....................................................................................................
[00:49:45] ........F...........................................................................................
[00:49:55] ...........................i........................................................................
[00:50:00] ...............................................ii...................................................
[00:50:05] ....................................................................................................
[00:50:12] ................................................i...................................................
[00:50:12] ................................................i...................................................
[00:50:13] ..........................
[00:50:13] failures:
[00:50:13] 
[00:50:13] ---- [ui] ui/issue-49851/compiler-builtins-error.rs stdout ----
[00:50:13]  diff of stderr:
[00:50:13] 
[00:50:13] - error: Could not create LLVM TargetMachine for triple: thumbv7em-none-eabihf: No available targets are compatible with this triple.
[00:50:13] + error[E0463]: can't find crate for `core`
[00:50:13] +    |
[00:50:13] +    = note: the `thumbv7em-none-eabihf` target may not be installed
[00:50:13] + error: aborting due to previous error
[00:50:13] + 
[00:50:13] + For more information about this error, try `rustc --explain E0463`.
[00:50:13] 3 
---
[00:50:13] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'issue-49851/compiler-builtins-error.rs'
[00:50:13] 
[00:50:13] error: 1 errors occurred comparing output.
[00:50:13] status: exit code: 101
[00:50:13] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issue-49851/compiler-builtins-error.rs" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-49851/compiler-builtins-error/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "thumbv7em-none-eabihf" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-49851/compiler-builtins-error/auxiliary" "-A" "unused"
[00:50:13] ------------------------------------------
[00:50:13] 
[00:50:13] ------------------------------------------
[00:50:13] stderr:
[00:50:13] stderr:
[00:50:13] ------------------------------------------
[00:50:13] {"message":"can't find crate for `core`","code":{"code":"E0463","explanation":"\nA plugin/crate was declared but cannot be found. Erroneous code example:\n\n```compile_fail,E0463\n#![feature(plugin)]\n#![plugin(cookie_monster)] // error: can't find crate for `cookie_monster`\nextern crate cake_is_a_lie; // error: can't find crate for `cake_is_a_lie`\n```\n\nYou need to link your code to the relevant crate in order to be able to use it\n(through Cargo or the `-L` option of rustc example). Plugins are crates as\nwell, and you link to them the same way.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issue-49851/compiler-builtins-error.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"//~ ERROR 1:1: 1:1: can't find crate for `core` [E0463]","highlight_start":1,"highlight_end":1}],"label":"can't find crate","suggested_replacement":null,"expansion":null}],"children":[{"message":"the `thumbv7em-none-eabihf` target may not be installed","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0463]: can't find crate for `core`\n   |\n   = note: the `thumbv7em-none-eabihf` target may not be installed\n\n"}
[00:50:13] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:50:13] {"message":"For more information about this error, try `rustc --explain E0463`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0463`.\n"}
[00:50:13] ------------------------------------------
[00:50:13] 
[00:50:13] thread '[ui] ui/issue-49851/compiler-builtins-error.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3014:9
[00:50:13] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:50:13] test result: FAILED. 1418 passed; 1 failed; 7 ignored; 0 measured; 0 filtered out
[00:50:13] 
[00:50:13] 
[00:50:13] 
[00:50:13] 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-3.9/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" "3.9.1\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:50:13] 
[00:50:13] 
[00:50:13] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:13] Build completed unsuccessfully in 0:02:27
[00:50:13] Build completed unsuccessfully in 0:02:27
[00:50:13] make: *** [check] Error 1
[00:50:13] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:10fc191e
$ 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)

@nikomatsakis
Copy link
Contributor

Because I have so many dang PRs pending, I'm going to close this pending any final decision (we can always re-open!). I think my post on the internals thread (which I confess I've been too slammed to keep up with) still represents my opinion.

@da-x
Copy link
Member Author

da-x commented May 17, 2018

@nikomatsakis Thanks! I am going to prepare an RFC based on all the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants