Skip to content

Remove anonymous trait params from 2018 and beyond #53612

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

Merged
merged 6 commits into from
Aug 26, 2018

Conversation

mark-i-m
Copy link
Member

@mark-i-m mark-i-m commented Aug 22, 2018

cc @Centril @nikomatsakis
cc #41686 rust-lang/rfcs#2522 #53272

This PR removes support for anonymous trait parameters syntactically in rust 2018 and onward.

TODO:

  • Add tests

@rust-highfive
Copy link
Contributor

r? @petrochenkov

(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 Aug 22, 2018
@rust-highfive
Copy link
Contributor

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

Click to expand the log.
[00:06:44]    Compiling rustc_data_structures v0.0.0 (file:///checkout/src/librustc_data_structures)
[00:06:47]    Compiling arena v0.0.0 (file:///checkout/src/libarena)
[00:06:47]    Compiling syntax_pos v0.0.0 (file:///checkout/src/libsyntax_pos)
[00:06:50]    Compiling rustc_errors v0.0.0 (file:///checkout/src/librustc_errors)
[00:07:06] error[E0502]: cannot borrow `self` as immutable because `*self` is also borrowed as mutable
[00:07:06]      |
[00:07:06]      |
[00:07:06] 1374 |             let d = self.parse_fn_decl_with_self(|p: &mut Parser<'a>| {
[00:07:06]      |                     |
[00:07:06]      |                     mutable borrow occurs here
[00:07:06] ...
[00:07:06] ...
[00:07:06] 1380 |                 if self.span.edition() >= Edition::Edition2018 {
[00:07:06]      |                    ---- borrow occurs due to use of `self` in closure
[00:07:06] 1385 |             })?;
[00:07:06] 1385 |             })?;
[00:07:06]      |              - mutable borrow ends here
[00:07:07] error: aborting due to previous error
[00:07:07] 
[00:07:07] For more information about this error, try `rustc --explain E0502`.
[00:07:07] error: Could not compile `syntax`.
[00:07:07] error: Could not compile `syntax`.
[00:07:07] 
[00:07:07] Caused by:
[00:07:07]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name syntax libsyntax/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=64bbe8e4870170a3 -C extra-filename=-64bbe8e4870170a3 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-3907cba388d41ef0.rlib --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-b6c566856a1e65b9.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-8b624a6d6082b2ff.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-89eed8215142aadd.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/dWed, 22 Aug 2018 18:55:12 GMT

The command "date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
" exited with 0.
travis_fold:start:after_failure.1

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)

@rust-highfive
Copy link
Contributor

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

Click to expand the log.

[00:04:24] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:24] tidy error: /checkout/src/test/ui/anon-params-denied-2018.rs: incorrect license
[00:04:26] some tidy checks failed
[00:04:26] 
[00:04:26] 
[00:04:26] 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:26] 
[00:04:26] 
[00:04:26] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:26] Build completed unsuccessfully in 0:00:51
[00:04:26] Build completed unsuccessfully in 0:00:51
[00:04:26] Makefile:79: recipe for target 'tidy' failed
[00:04:26] make: *** [tidy] Error 1

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

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

@mark-i-m mark-i-m changed the title [WIP] Remove anonymous trait params from 2018 and beyond Remove anonymous trait params from 2018 and beyond Aug 22, 2018
@@ -1,4 +1,6 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// Test that anonymous parameters are disallowed in 2018 edition.
Copy link
Member

Choose a reason for hiding this comment

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

I think the copyright notice has to be the first thing in the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, thanks. I didn't notice I had done that.

@mark-i-m
Copy link
Member Author

Actually, if we wait for #53617, we won't need the license at all.

@rust-highfive
Copy link
Contributor

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

Click to expand the log.
/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/4e/cf/0c313db4b8e3b231447d3807657db4f5e7fad26d5eaeb294b3cfa1388a6c/awscli-1.15.84-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 11.4MB/s eta 0:00:01
    1% |▌                               | 20kB 1.9MB/s eta 0:00:01
    2% |▊                               | 30kB 2.2MB/s eta 0:00:01
    3% |█                               | 40kB 2.0MB/s eta 0:00:01
---
travis_time:start:test_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:48:29] 
[00:48:29] running 4155 tests
[00:48:31] .............................F......................................................................
[00:48:37] ....................................................................................................
[00:48:40] ....................................................................................................
[00:48:43] ....................................................................................................
[00:48:46] ..............i.....................................................................................
---
[00:50:22] ...................................................i................................................
[00:50:25] ....................................................................................................
[00:50:28] ....................................................................................................
[00:50:31] ..............................................................................................i.....
to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/anon-params-denied-2018/anon-params-denied-2018.stderr
[00:50:32] To update references, rerun the tests and pass the `--bless` flag
[00:50:32] To only update this specific test, also pass `--test-args anon-params-denied-2018.rs`
[00:50:32] error: 1 errors occurred comparing output.
[00:50:32] status: exit code: 1
[00:50:32] status: exit code: 1
[00:50:32] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/anon-params-denied-2018.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/anon-params-denied-2018/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/anon-params-denied-2018/auxiliary" "-A" "unused"
[00:50:32] ------------------------------------------
[00:50:32] 
[00:50:32] ------------------------------------------
[00:50:32] stderr:
[00:50:32] stderr:
[00:50:32] ------------------------------------------
[00:50:32] {"message":"expected one of `:` or `@`, found `)`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anon-params-denied-2018.rs","byte_start":578,"byte_end":579,"line_start":16,"line_end":16,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":"    fn foo(i32); //~ expected one of `:` or `@`, found `)`","highlight_start":15,"highlight_end":16}],"label":"expected one of `:` or `@` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: expected one of `:` or `@`, found `)`\n  --> /checkout/src/test/ui/anon-params-denied-2018.rs:16:15\n   |\nLL |     fn foo(i32); //~ expected one of `:` or `@`, found `)`\n   |               ^ expected one of `:` or `@` here\n\n"}
[00:50:32] {"message":"expected one of `:` or `@`, found `,`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/anon-params-denied-2018.rs","byte_start":659,"byte_end":660,"line_start":18,"line_end":18,"column_start":36,"column_end":37,"is_primary":true,"text":[{"text":"    fn bar_with_default_impl(String, String) {}","highlight_start":36,"highlight_end":37}],"label":"expected one of `:` or `@` here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: expected one of `:` or `@`, found `,`\n  --> /checkout/src/test/ui/anon-params-denied-2018.rs:18:36\n   |\nLL |     fn bar_with_default_impl(String, String) {}\n   |                                    ^ expected one of `:` or `@` here\n\n"}
[00:50:32] {"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:32] ------------------------------------------
[00:50:32] 
[00:50:32] thread '[ui] ui/anon-params-denied-2018.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3189:9
[00:50:32] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:50:32] 
[00:50:32] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:497:22
[00:50:32] 
[00:50:32] 
[00:50:32] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:50:32] 
[00:50:32] 
[00:50:32] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:32] Build completed unsuccessfully in 0:03:12
[00:50:32] Build completed unsuccessfully in 0:03:12
[00:50:32] make: *** [check] Error 1
[00:50:32] Makefile:58: recipe for target 'check' failed

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

@mark-i-m
Copy link
Member Author

Ugh... The line numbers changed. I will wait until the license isn't needed and then fix.

@petrochenkov
Copy link
Contributor

r=me after fixing tests

@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 Aug 22, 2018
@mark-i-m mark-i-m force-pushed the anon_param_disallowed_2018 branch from 20f24c4 to b32b6e8 Compare August 24, 2018 20:48
@mark-i-m
Copy link
Member Author

Tests should be fixed hopefully (this is taking a while to run locally)

@mark-i-m
Copy link
Member Author

@petrochenkov time for another review? Thanks!

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 25, 2018

📌 Commit b32b6e8 has been approved by petrochenkov

@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 Aug 25, 2018
@bors
Copy link
Collaborator

bors commented Aug 25, 2018

⌛ Testing commit b32b6e8 with merge f272688...

bors added a commit that referenced this pull request Aug 25, 2018
…enkov

Remove anonymous trait params from 2018 and beyond

cc @Centril @nikomatsakis
cc #41686 rust-lang/rfcs#2522 #53272

This PR removes support for anonymous trait parameters syntactically in rust 2018 and onward.

TODO:
- [x] Add tests
@bors
Copy link
Collaborator

bors commented Aug 26, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: petrochenkov
Pushing f272688 to master...

@bors bors merged commit b32b6e8 into rust-lang:master Aug 26, 2018
@mark-i-m mark-i-m deleted the anon_param_disallowed_2018 branch November 14, 2018 16:39
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