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

Remove E0245; improve E0404 #48446

Merged
merged 1 commit into from
Mar 2, 2018
Merged

Remove E0245; improve E0404 #48446

merged 1 commit into from
Mar 2, 2018

Conversation

mark-i-m
Copy link
Member

Fix #36337

Somehow this is currently breaking --explain, but I don't understand how.

r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2018
@@ -1674,6 +1674,29 @@ fn main() {
```
"##,

E0910: r##"
You tried to use something as a trait bound that is not a trait.
Copy link
Contributor

@estebank estebank Feb 22, 2018

Choose a reason for hiding this comment

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

"You tried to use something that is not a trait as a trait bound." is slightly easier to read for me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -1674,6 +1674,29 @@ fn main() {
```
"##,

E0910: r##"
Copy link
Contributor

@estebank estebank Feb 22, 2018

Choose a reason for hiding this comment

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

Is 909 the biggest error code so far? I could have sworn we're still <700!

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I'm off by two... The largest I found was 907:

E0907, // type inside generator must be known in this context

I wasn't really sure how to choose the error number, though...

Copy link
Contributor

Choose a reason for hiding this comment

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

Tidy is supposed to tell you:

[00:05:36] * 534 error codes
[00:05:36] * highest error code: E0908
[00:05:36] * 175 features

I think that somebody sneaked a high error code skipping a bunch somewhere 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm... maybe if I run the full test suite? Let me try.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, it appears that tidy does not run for a full build...

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I changed it to E0909

@estebank
Copy link
Contributor

r=me once travis passes

@mark-i-m
Copy link
Member Author

@estebank There are ui tests failing for me locally...

These are the test failures I am currently getting that I cannot understand:

failures:

---- [ui] ui/explain.rs stdout ----
	
error: test compilation failed although it shouldn't!
status: exit code: 101
command: "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/nobackup/rust/src/test/ui/explain.rs" "-L" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/explain.stage1-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/nobackup/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--explain" "E0591" "-L" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/explain.stage1-x86_64-unknown-linux-gnu.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
{"message":"no extended information for E0591","code":null,"level":"error","spans":[],"children":[],"rendered":"error: no extended information for E0591\n\n"}

------------------------------------------

thread '[ui] ui/explain.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2892:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- [ui] ui/lint/use_suggestion_json.rs stdout ----
	diff of stderr:

2	  "message": "cannot find type `Iter` in this scope",
3	  "code": {
4	    "code": "E0412",
-	    "explanation": "
-	The type name used is not in scope.
-	
-	Erroneous code examples:
-	
-	```compile_fail,E0412
-	impl Something {} // error: type name `Something` is not in scope
-	
-	// or:
-	
-	trait Foo {
-	    fn bar(N); // error: type name `N` is not in scope
-	}
-	
-	// or:
-	
-	fn foo(x: T) {} // type name `T` is not in scope
-	```
-	
-	To fix this error, please verify you didn't misspell the type name, you did
-	declare it or imported it into the scope. Examples:
-	
-	```
-	struct Something;
-	
-	impl Something {} // ok!
-	
-	// or:
-	
-	trait Foo {
-	    type N;
-	
-	    fn bar(_: Self::N); // ok!
-	}
-	
-	// or:
-	
-	fn foo<T>(x: T) {} // ok!
-	```
-	
-	Another case that causes this error is when a type is imported into a parent
-	module. To fix this, you can follow the suggestion and use File directly or
-	`use super::File;` which will import the types from the parent namespace. An
-	example that causes this error is below:
-	
-	```compile_fail,E0412
-	use std::fs::File;
-	
-	mod foo {
-	    fn some_function(f: File) {}
-	}
-	```
-	
-	```
-	use std::fs::File;
-	
-	mod foo {
-	    // either
-	    use super::File;
-	    // or
-	    // use std::fs::File;
-	    fn foo(f: File) {}
-	}
-	# fn main() {} // don't insert it for us; that'll break imports
-	```
-	"
+	    "explanation": null
71	  },
72	  "level": "error",
73	  "spans": [

89	      ],
90	      "label": "not found in this scope",
91	      "suggested_replacement": null,
+	      "suggestion_approximate": null,
92	      "expansion": null
93	    }
94	  ],

118	          "suggested_replacement": "use std::collections::binary_heap::Iter;
119	
120	",
+	          "suggestion_approximate": null,
121	          "expansion": null
122	        },
123	        {

140	          "suggested_replacement": "use std::collections::btree_map::Iter;
141	
142	",
+	          "suggestion_approximate": null,
143	          "expansion": null
144	        },
145	        {

162	          "suggested_replacement": "use std::collections::btree_set::Iter;
163	
164	",
+	          "suggestion_approximate": null,
165	          "expansion": null
166	        },
167	        {

184	          "suggested_replacement": "use std::collections::hash_map::Iter;
185	
186	",
+	          "suggestion_approximate": null,
187	          "expansion": null
188	        },
189	        {

206	          "suggested_replacement": "use std::collections::hash_set::Iter;
207	
208	",
+	          "suggestion_approximate": null,
209	          "expansion": null
210	        },
211	        {

228	          "suggested_replacement": "use std::collections::linked_list::Iter;
229	
230	",
+	          "suggestion_approximate": null,
231	          "expansion": null
232	        },
233	        {

250	          "suggested_replacement": "use std::collections::vec_deque::Iter;
251	
252	",
+	          "suggestion_approximate": null,
253	          "expansion": null
254	        },
255	        {

272	          "suggested_replacement": "use std::option::Iter;
273	
274	",
+	          "suggestion_approximate": null,
275	          "expansion": null
276	        },
277	        {

294	          "suggested_replacement": "use std::path::Iter;
295	
296	",
+	          "suggestion_approximate": null,
297	          "expansion": null
298	        },
299	        {

316	          "suggested_replacement": "use std::result::Iter;
317	
318	",
+	          "suggestion_approximate": null,
319	          "expansion": null
320	        },
321	        {

338	          "suggested_replacement": "use std::slice::Iter;
339	
340	",
+	          "suggestion_approximate": null,
341	          "expansion": null
342	        },
343	        {

360	          "suggested_replacement": "use std::sync::mpsc::Iter;
361	
362	",
+	          "suggestion_approximate": null,
363	          "expansion": null
364	        }
365	      ],


The actual stderr differed from the expected stderr.
Actual stderr saved to /nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/lint/use_suggestion_json.stderr
To update references, run this command from build directory:
/nobackup/rust/src/test/ui/update-references.sh '/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui' 'lint/use_suggestion_json.rs'

error: 1 errors occurred comparing output.
status: exit code: 101
command: "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs" "-L" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/lint/use_suggestion_json.stage1-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/nobackup/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--error-format" "pretty-json" "-Zunstable-options" "-L" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/lint/use_suggestion_json.stage1-x86_64-unknown-linux-gnu.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
{
  "message": "cannot find type `Iter` in this scope",
  "code": {
    "code": "E0412",
    "explanation": null
  },
  "level": "error",
  "spans": [
    {
      "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
      "byte_start": 907,
      "byte_end": 911,
      "line_start": 21,
      "line_end": 21,
      "column_start": 12,
      "column_end": 16,
      "is_primary": true,
      "text": [
        {
          "text": "    let x: Iter;",
          "highlight_start": 12,
          "highlight_end": 16
        }
      ],
      "label": "not found in this scope",
      "suggested_replacement": null,
      "suggestion_approximate": null,
      "expansion": null
    }
  ],
  "children": [
    {
      "message": "possible candidates are found in other modules, you can import them into scope",
      "code": null,
      "level": "help",
      "spans": [
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::binary_heap::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::btree_map::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::btree_set::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::hash_map::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::hash_set::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::linked_list::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::collections::vec_deque::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::option::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::path::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::result::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::slice::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        },
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/use_suggestion_json.rs",
          "byte_start": 884,
          "byte_end": 884,
          "line_start": 20,
          "line_end": 20,
          "column_start": 1,
          "column_end": 1,
          "is_primary": true,
          "text": [
            {
              "text": "fn main() {",
              "highlight_start": 1,
              "highlight_end": 1
            }
          ],
          "label": null,
          "suggested_replacement": "use std::sync::mpsc::Iter;\n\n",
          "suggestion_approximate": null,
          "expansion": null
        }
      ],
      "children": [],
      "rendered": null
    }
  ],
  "rendered": "error[E0412]: cannot find type `Iter` in this scope\n  --> /nobackup/rust/src/test/ui/lint/use_suggestion_json.rs:21:12\n   |\n21 |     let x: Iter;\n   |            ^^^^ not found in this scope\nhelp: possible candidates are found in other modules, you can import them into scope\n   |\n20 | use std::collections::binary_heap::Iter;\n   |\n20 | use std::collections::btree_map::Iter;\n   |\n20 | use std::collections::btree_set::Iter;\n   |\n20 | use std::collections::hash_map::Iter;\n   |\nand 8 other candidates\n\n"
}
{
  "message": "aborting due to previous error",
  "code": null,
  "level": "error",
  "spans": [],
  "children": [],
  "rendered": "error: aborting due to previous error\n\n"
}

------------------------------------------

thread '[ui] ui/lint/use_suggestion_json.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2892:9

---- [ui] ui/lint/unused_parens_json_suggestion.rs stdout ----
	diff of stderr:

24	      ],
25	      "label": null,
26	      "suggested_replacement": null,
+	      "suggestion_approximate": null,
27	      "expansion": null
28	    }
29	  ],

51	          ],
52	          "label": null,
53	          "suggested_replacement": null,
+	          "suggestion_approximate": null,
54	          "expansion": null
55	        }
56	      ],

80	          ],
81	          "label": null,
82	          "suggested_replacement": "1 / (2 + 3)",
+	          "suggestion_approximate": null,
83	          "expansion": null
84	        }
85	      ],


The actual stderr differed from the expected stderr.
Actual stderr saved to /nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/lint/unused_parens_json_suggestion.stderr
To update references, run this command from build directory:
/nobackup/rust/src/test/ui/update-references.sh '/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui' 'lint/unused_parens_json_suggestion.rs'

error: 1 errors occurred comparing output.
status: exit code: 0
command: "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/nobackup/rust/src/test/ui/lint/unused_parens_json_suggestion.rs" "-L" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/lint/unused_parens_json_suggestion.stage1-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/nobackup/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--error-format" "pretty-json" "-Zunstable-options" "-L" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui/lint/unused_parens_json_suggestion.stage1-x86_64-unknown-linux-gnu.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
{
  "message": "unnecessary parentheses around assigned value",
  "code": {
    "code": "unused_parens",
    "explanation": null
  },
  "level": "warning",
  "spans": [
    {
      "file_name": "/nobackup/rust/src/test/ui/lint/unused_parens_json_suggestion.rs",
      "byte_start": 1056,
      "byte_end": 1069,
      "line_start": 25,
      "line_end": 25,
      "column_start": 14,
      "column_end": 27,
      "is_primary": true,
      "text": [
        {
          "text": "    let _a = (1 / (2 + 3));",
          "highlight_start": 14,
          "highlight_end": 27
        }
      ],
      "label": null,
      "suggested_replacement": null,
      "suggestion_approximate": null,
      "expansion": null
    }
  ],
  "children": [
    {
      "message": "lint level defined here",
      "code": null,
      "level": "note",
      "spans": [
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/unused_parens_json_suggestion.rs",
          "byte_start": 902,
          "byte_end": 915,
          "line_start": 20,
          "line_end": 20,
          "column_start": 9,
          "column_end": 22,
          "is_primary": true,
          "text": [
            {
              "text": "#![warn(unused_parens)]",
              "highlight_start": 9,
              "highlight_end": 22
            }
          ],
          "label": null,
          "suggested_replacement": null,
          "suggestion_approximate": null,
          "expansion": null
        }
      ],
      "children": [],
      "rendered": null
    },
    {
      "message": "remove these parentheses",
      "code": null,
      "level": "help",
      "spans": [
        {
          "file_name": "/nobackup/rust/src/test/ui/lint/unused_parens_json_suggestion.rs",
          "byte_start": 1056,
          "byte_end": 1069,
          "line_start": 25,
          "line_end": 25,
          "column_start": 14,
          "column_end": 27,
          "is_primary": true,
          "text": [
            {
              "text": "    let _a = (1 / (2 + 3));",
              "highlight_start": 14,
              "highlight_end": 27
            }
          ],
          "label": null,
          "suggested_replacement": "1 / (2 + 3)",
          "suggestion_approximate": null,
          "expansion": null
        }
      ],
      "children": [],
      "rendered": null
    }
  ],
  "rendered": "warning: unnecessary parentheses around assigned value\n  --> /nobackup/rust/src/test/ui/lint/unused_parens_json_suggestion.rs:25:14\n   |\n25 |     let _a = (1 / (2 + 3));\n   |              ^^^^^^^^^^^^^ help: remove these parentheses\n   |\nnote: lint level defined here\n  --> /nobackup/rust/src/test/ui/lint/unused_parens_json_suggestion.rs:20:9\n   |\n20 | #![warn(unused_parens)]\n   |         ^^^^^^^^^^^^^\n\n"
}

------------------------------------------

thread '[ui] ui/lint/unused_parens_json_suggestion.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2892:9


failures:
    [ui] ui/explain.rs
    [ui] ui/lint/unused_parens_json_suggestion.rs
    [ui] ui/lint/use_suggestion_json.rs

test result: FAILED. 0 passed; 3 failed; 1233 ignored; 0 measured; 0 filtered out

thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:476:22


command did not execute successfully: "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage1/lib" "--run-lib-path" "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/nobackup/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--src-base" "/nobackup/rust/src/test/ui" "--build-base" "/nobackup/rust/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage1-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/nobackup/rust/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/nobackup/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python" "--lldb-python" "/usr/bin/python" "--gdb" "/usr/bin/gdb" "--llvm-version" "6.0.0\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" ""
expected success, got: exit code: 101


failed to run: /nobackup/rust/build/bootstrap/debug/bootstrap test --stage 1 src/test/ui src/test/compile-fail src/test/run-pass
Build completed unsuccessfully in 0:00:06

@mark-i-m
Copy link
Member Author

They seem completely unrelated, which I find confusing...

@estebank
Copy link
Contributor

@mark-i-m oh, those. I believe that with a fresh clone of the repo those error go away... I've just been ignoring them :-/

If those are the only ones failing, travis will probably succeed.

@mark-i-m
Copy link
Member Author

That's good to know... maybe it's because I'm running tests against the stage1 compiler locally?

@mark-i-m mark-i-m changed the title [WIP] Split E0404 to E0910; get rid of E0245 Split E0404 to E0910; get rid of E0245 Feb 23, 2018
@mark-i-m mark-i-m changed the title Split E0404 to E0910; get rid of E0245 Split E0404 to E0909; get rid of E0245 Feb 23, 2018
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
enum PathSource<'a> {
// Type paths `Path`.
Type,
// Trait paths in bounds or impls.
Trait(AliasPossibility),
Trait(AliasPossibility, ImplOrBound),
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait.
AliasPossibility is supposed to be exactly the same thing as ImplOrBound - aliases can be used in bounds, but cannot be used in impl Trait for ....
Also, poly-trait-ref is always a bound, no need to change visitors.
What this PR tries to achieve?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @petrochenkov ! That's really useful info. The goal was simply to emit a different error if something that is not a trait is used in a bound as opposed to an impl (i.e. impl Struct for Foo vs foo<T: Struct>(...) {}).

Copy link
Member Author

Choose a reason for hiding this comment

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

So you are saying that if AliasPossibility::Maybe it must be a bound. But is it also true that if AliasPossibility::No it must be an impl?

Copy link
Member Author

Choose a reason for hiding this comment

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

@petrochenkov Is this correct:

diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index bf8beb1..5492cd6 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -548,9 +541,9 @@ impl<'a> PathSource<'a> {
         __diagnostic_used!(E0578);
         __diagnostic_used!(E0909);
         match (self, has_unexpected_resolution) {
-            (PathSource::Trait(_, ImplOrBound::Impl), true) => "E0404",
-            (PathSource::Trait(_, ImplOrBound::Bound), true) => "E0909",
-            (PathSource::Trait(_, _), false) => "E0405",
+            (PathSource::Trait(AliasPossibility::No), true) => "E0404",
+            (PathSource::Trait(AliasPossibility::Maybe), true) => "E0909",
+            (PathSource::Trait(_), false) => "E0405",
             (PathSource::Type, true) => "E0573",
             (PathSource::Type, false) => "E0412",
             (PathSource::Struct, true) => "E0574",

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the existing code is already correct, only E0245 need to be removed as dead code.
Also docs for E0404 should probably be tweaked to mention bounds in addition to impls.

Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify, #48446 (comment) is correct too, if you really want to make these error codes more fine grained, I'm just not sure this makes sense given that trait aliases are not even implemented yet.

If you do want to spend time on this, I'd suggest to split E0405 as well and document differences between bounds and impls and how trait aliases can be used in bounds but not in impls in the descriptions of E0404/E0405/E0909/E0910.

Copy link
Member Author

Choose a reason for hiding this comment

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

if you really want to make these error codes more fine grained

I think that was the conclusion of #36337

If you do want to spend time on this, I'd suggest to split E0405 as well and document differences between bounds and impls and how trait aliases can be used in bounds but not in impls in the descriptions of E0404/E0405/E0909/E0910.

Sure, I can try to do that.

@petrochenkov petrochenkov self-assigned this Feb 23, 2018
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 23, 2018
@mark-i-m mark-i-m changed the title Split E0404 to E0909; get rid of E0245 [WIP] Split E0404 to E0909; get rid of E0245 Feb 24, 2018
@mark-i-m
Copy link
Member Author

Made this WIP again... I will look into splitting E0405 too. In the meantime, I removed the ImplOrBound enum.

@mark-i-m
Copy link
Member Author

@petrochenkov

If you do want to spend time on this, I'd suggest to split E0405 as well and document differences between bounds and impls and how trait aliases can be used in bounds but not in impls in the descriptions of E0404/E0405/E0909/E0910.

Hmm... Reading this again, I'm not 100% sure we need to mention trait aliases at all. Can't we just mention say that structs are not allowed as bounds?

@petrochenkov
Copy link
Contributor

That's what I suggested originally. If trait aliases are not mentioned, then there's no difference between impls and bounds, structs are not allowed "in trait position" generally (i.e. in both impls and bounds), and splitting error codes is not necessary, only error descriptions need to be updated.

@mark-i-m
Copy link
Member Author

@petrochenkov @estebank Updated.

  • Remove E0245
  • Remove E0909 (or rather, I didn't add any new error codes)
  • Expanded the explanation of E0404

Let me know what you think.

@mark-i-m mark-i-m changed the title [WIP] Split E0404 to E0909; get rid of E0245 Remove E0245; improve E0404 Feb 27, 2018
@estebank
Copy link
Contributor

LGTM.

r? @petrochenkov

@petrochenkov
Copy link
Contributor

Thanks!
r=me after squashing commits and updating the failing test

@petrochenkov
Copy link
Contributor

@bors delegate+

@bors
Copy link
Contributor

bors commented Feb 28, 2018

✌️ @mark-i-m can now approve this pull request

@mark-i-m
Copy link
Member Author

@bors r+

🎉

@bors
Copy link
Contributor

bors commented Feb 28, 2018

📌 Commit c03ef66 has been approved by mark-i-m

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 28, 2018
@mark-i-m
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 28, 2018
@mark-i-m
Copy link
Member Author

mark-i-m commented Feb 28, 2018

Oh, I should have read "after squashing commits and fixing the failing test"!

@mark-i-m
Copy link
Member Author

Ok, I squashed and fixed the test. Will wait for travis, then r+

@mark-i-m
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Feb 28, 2018

📌 Commit 2ec79f9 has been approved by mark-i-m

@bors
Copy link
Contributor

bors commented Feb 28, 2018

🌲 The tree is currently closed for pull requests below priority 200, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 28, 2018
@estebank
Copy link
Contributor

@bors rollup

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 1, 2018
Remove E0245; improve E0404

Fix rust-lang#36337

Somehow this is currently breaking --explain, but I don't understand how.

r? @estebank
@bors bors merged commit 2ec79f9 into rust-lang:master Mar 2, 2018
@mark-i-m mark-i-m deleted the e0245 branch November 14, 2018 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants